使用本地mock数据

2018-11-23  本文已影响0人  ing1023

1.在config中的index.js中配置:

proxyTable: {
      '/api': {
        target: 'http://localhost:8080',
        pathRewrite: {
          '^/api': '/static/mock'
        }
      }

2.组件中使用

this.$axios.get('/api/data.json')
    .then((res) => {
       this.seller = res.data.seller
       console.log(res)
    })
上一篇下一篇

猜你喜欢

热点阅读