diff --git a/src/api/mock/index.ts b/src/api/mock/index.ts index 9f639513..d8952c47 100644 --- a/src/api/mock/index.ts +++ b/src/api/mock/index.ts @@ -1,4 +1,5 @@ import test from './test.mock' +import vchart from './vchart.mock' import { MockMethod } from 'vite-plugin-mock' import { RequestHttpEnum } from '@/enums/httpEnum' @@ -22,6 +23,8 @@ export const threeEarth01Url = '/mock/threeEarth01Data' export const sankeyUrl = '/mock/sankey' export const graphUrl = '/mock/graphData' +export const vchartBarDataUrl = '/mock/vchart/barDataUrl' + const mockObject: MockMethod[] = [ { // 正则 @@ -115,6 +118,11 @@ const mockObject: MockMethod[] = [ method: RequestHttpEnum.GET, response: () => test.graphData }, + { + url: vchartBarDataUrl, + method: RequestHttpEnum.GET, + response: () => vchart.bar + } ] export default mockObject diff --git a/src/api/mock/vchart.mock.ts b/src/api/mock/vchart.mock.ts new file mode 100644 index 00000000..4e1d70c0 --- /dev/null +++ b/src/api/mock/vchart.mock.ts @@ -0,0 +1,10 @@ +import bar from './vchart/bar.json' + +export default { + bar: { + code: 0, + status: 200, + msg: '请求成功', + data: bar + } +} diff --git a/src/api/mock/vchart/bar.json b/src/api/mock/vchart/bar.json new file mode 100644 index 00000000..3372ec56 --- /dev/null +++ b/src/api/mock/vchart/bar.json @@ -0,0 +1,16 @@ +{ + "values": [ + { "type": "Nail polish", "year": "Africa", "value|100-900": 3 }, + { "type": "Nail polish", "year": "EU", "value|100-900": 3 }, + { "type": "Nail polish", "year": "China", "value|100-900": 3 }, + { "type": "Nail polish", "year": "USA", "value|100-900": 3 }, + { "type": "Eyebrow pencil", "year": "Africa", "value|100-900": 3 }, + { "type": "Eyebrow pencil", "year": "EU", "value|100-900": 3 }, + { "type": "Eyebrow pencil", "year": "China", "value|100-900": 3 }, + { "type": "Eyebrow pencil", "year": "USA", "value|100-900": 3 }, + { "type": "Rouge", "year": "Africa", "value|100-900": 3 }, + { "type": "Rouge", "year": "EU", "value|100-900": 3 }, + { "type": "Rouge", "year": "China", "value|100-900": 3 }, + { "type": "Rouge", "year": "USA", "value|100-900": 3 } + ] +} diff --git a/src/components/GoVChart/index.vue b/src/components/GoVChart/index.vue index 9f6e7471..3f99e3a0 100644 --- a/src/components/GoVChart/index.vue +++ b/src/components/GoVChart/index.vue @@ -2,13 +2,13 @@
diff --git a/tsconfig.json b/tsconfig.json index 07a4c65b..8880f8e4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -20,6 +20,6 @@ // "strictNullChecks": true, //不允许使用null "noImplicitThis": true //不允许往this上面挂属性 }, - "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue", "types/**/*"], + "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue", "types/**/*", "src/api/mock/vchart/bar.js"], "exclude": ["node_modules", "dist", "**/*.js"] }