Skip to content

Commit fc5c23e

Browse files
committed
模拟菜单数据
1 parent 4dcdf72 commit fc5c23e

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

menus.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"code":0,
3+
"message":"Permintaan berhasil",
4+
"result":[
5+
{
6+
"id":1,
7+
"name":"Demo1",
8+
"parentId":-1,
9+
"path":"demo1"
10+
},
11+
{
12+
"id":2,
13+
"name":"Demo11",
14+
"parentId":1,
15+
"path":"demo1.demo11"
16+
},
17+
{
18+
"id":3,
19+
"name":"Demo12",
20+
"parentId":1,
21+
"path":"demo1.demo12"
22+
},
23+
{
24+
"id":4,
25+
"name":"demo2",
26+
"parentId":-1,
27+
"path":"demo2"
28+
}
29+
]
30+
}

vue.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
const path = require('path');
22
const HtmlWebpackPlugin = require('html-webpack-plugin');
33
const pjson = require('./package.json');
4+
5+
// 模拟菜单
6+
const menuList = require('./menus.json');
47
// 自定义webpack
58
module.exports = {
69
outputDir: path.join(__dirname, './dist', pjson.name),
10+
// 配置模拟数据接口
11+
devServer: {
12+
compress: false, // 开启压缩
13+
before (app) {
14+
app.get('/api/v1/menu', (req, res) => {
15+
res.json(menuList)
16+
})
17+
},
18+
},
719
configureWebpack: (config) => {
820
const env = process.env.NODE_ENV;
921
switch (env) {

0 commit comments

Comments
 (0)