diff --git a/package.json b/package.json index b5a1ad6e..01b70207 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "element-plus": "^1.0.2-beta.44", "lib-flexible": "^0.3.2", "lodash": "^4.17.21", + "mockjs": "^1.1.0", "moment-timezone": "^0.5.33", "node-sass": "^4.14.1", "postcss-plugin-px2rem": "^0.8.1", diff --git a/src/main.js b/src/main.js index b4c912f4..c1497699 100644 --- a/src/main.js +++ b/src/main.js @@ -9,6 +9,7 @@ import commonMixin from '@/mixins/common' import { cancelWithChange, noData } from '@/utils/tools' import { ClickOutside } from 'element-plus/lib/directives' import i18n from '@/i18n' +import '@/mock/index.js' import hljsVuePlugin from '@highlightjs/vue-plugin' import 'highlight.js/styles/color-brewer.css' import '@/assets/css/main.scss' // 样式入口 diff --git a/src/mock/index.js b/src/mock/index.js new file mode 100644 index 00000000..7704277b --- /dev/null +++ b/src/mock/index.js @@ -0,0 +1 @@ +import './npm' diff --git a/src/mock/npm.js b/src/mock/npm.js new file mode 100644 index 00000000..8bd87669 --- /dev/null +++ b/src/mock/npm.js @@ -0,0 +1,33 @@ +import Mock from 'mockjs' + +const openMock = false +if (openMock) { + Mock.mock(RegExp(BASE_CONFIG.baseUrl + 'visual/panel*'), 'get', function (requestObj) { + return { + "msg": "success", + "code": 200, + "data": { + "total": 1, + "pageSize": 10, + "pages": 1, + "pageNo": 1, + "list": [ + { + "id": 2, + "name": "Network & App", + "i18n": "npm.npm", + "type": 2, + "params": "", + "cby": 1, + "ctime": "2021-06-03 08:27:32", + "uby": 1, + "utime": "2021-06-03 08:28:10", + "remark": "", + "state": 1, + "buildIn": 1 + } + ] + } + } + }) +}