美文网首页
使用本地mock数据

使用本地mock数据

作者: ing1023 | 来源:发表于2018-11-23 10:47 被阅读0次

    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)
        })
    

    相关文章

      网友评论

          本文标题:使用本地mock数据

          本文链接:https://www.haomeiwen.com/subject/bsodqqtx.html