一、首先要有json数据。(自己添加模拟数据)
二、进入vue.config.js进行配置
const appData = require('./data.json') const seller = appData.seller const goods = appData.goods const ratings = appData.ratings
devServer: { before (app) { app.get('/api/seller', function (req, res) { res.json({ errno: 0, data: seller }) }) app.get('/api/goods', function (req, res) { res.json({ errno: 0, data: goods }) }) app.get('/api/ratings', function (req, res) { res.json({ errno: 0, data: ratings }) }) },