安装安装vue-cli

npm install -g @vue/cli
# 或者
yarn global add @vue/cli

创建项目

vue create hello-world

至此项目搭建完成

使用cube-ui

地址https://didi.github.io/cube-ui/#/zh-CN

vue add cube-ui

 采用Mock模拟数据,使用devServer

在vue.config.js中配置

const data = require('./data.json')
const seller = data.seller
console.log(seller)
module.exports = {
  devServer: {
    before (app) {
      app.get('/api/seller', (req, res) => {
        res.json({
          code: 0,
          seller
        })
      })
    }
  }
}

Mock数据配置完成

 

posted on 2018-11-30 15:43  苏荷酒吧  阅读(402)  评论(0编辑  收藏  举报