首页 新闻 会员 周边

怎么用vue模拟ajax请求

0
[已关闭问题] 关闭于 2018-04-15 19:47

形如我有一个db.json文件,内容为 

{

  "getPrice": {
    "amount": 678
  }

}

怎么使用代理方式比如:

this.$http.get('api/getPrice')
.then((res) => {
  this.newsList = res.data//me === this
}, (err) => {
  console.log(err)
})

获得数据?

(我的项目build目录下没有dev-server.js,只有这个build/webpack.dev.conf.js)

index.js里设置如下:

dev: {

  env: require('./dev.env'),
  port: 8090,
  assetsSubDirectory: 'static',
  assetsPublicPath: '/',
  proxyTable: {
    '/api': 'http://localhost:8091'
  },
  cssSourceMap: false
}

求指导

lilian'sblog的主页 lilian'sblog | 菜鸟二级 | 园豆:206
提问于:2018-04-15 19:29
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册