feat(web): add qrcode dependency and setup echarts按需引入
新增qrcode第三方依赖,创建echarts统一按需初始化文件,注册常用图表和组件以避免重复引入
This commit is contained in:
parent
1bbfdb56c3
commit
80296b7db1
@ -37,6 +37,7 @@
|
|||||||
"markmap-view": "^0.18.12",
|
"markmap-view": "^0.18.12",
|
||||||
"pinia": "^3.0.4",
|
"pinia": "^3.0.4",
|
||||||
"pinia-plugin-persistedstate": "^4.7.1",
|
"pinia-plugin-persistedstate": "^4.7.1",
|
||||||
|
"qrcode": "^1.5.4",
|
||||||
"shiki": "^4.0.2",
|
"shiki": "^4.0.2",
|
||||||
"sigma": "^3.0.3",
|
"sigma": "^3.0.3",
|
||||||
"vue": "^3.5.34",
|
"vue": "^3.5.34",
|
||||||
|
|||||||
60
web/src/utils/echartsSetup.js
Normal file
60
web/src/utils/echartsSetup.js
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
/**
|
||||||
|
* ECharts 按需引入初始化
|
||||||
|
*
|
||||||
|
* 本项目使用 ECharts 5+ 的按需引入模式。任何需要调用 echarts.init 的组件/组合式函数
|
||||||
|
* 应先导入本文件(副作用导入),由本文件统一注册常用图表与组件,避免各业务文件
|
||||||
|
* 重复注册。
|
||||||
|
*
|
||||||
|
* 注意:dashboard 模块的部分旧组件仍使用 `import * as echarts from 'echarts'` 全量导入,
|
||||||
|
* 不受本文件影响;本文件主要服务于使用 `import * as echarts from 'echarts/core'` 的新组件。
|
||||||
|
*/
|
||||||
|
import { use } from 'echarts/core'
|
||||||
|
|
||||||
|
// 图表类型
|
||||||
|
import { LineChart, BarChart, PieChart, ScatterChart, RadarChart } from 'echarts/charts'
|
||||||
|
|
||||||
|
// 组件
|
||||||
|
import {
|
||||||
|
GridComponent,
|
||||||
|
TooltipComponent,
|
||||||
|
LegendComponent,
|
||||||
|
TitleComponent,
|
||||||
|
DatasetComponent,
|
||||||
|
TransformComponent,
|
||||||
|
MarkLineComponent,
|
||||||
|
ToolboxComponent,
|
||||||
|
DataZoomComponent,
|
||||||
|
VisualMapComponent,
|
||||||
|
GraphicComponent,
|
||||||
|
AriaComponent
|
||||||
|
} from 'echarts/components'
|
||||||
|
|
||||||
|
// 渲染器
|
||||||
|
import { CanvasRenderer, SVGRenderer } from 'echarts/renderers'
|
||||||
|
|
||||||
|
// 标签布局与动画
|
||||||
|
import { LabelLayout, UniversalTransition } from 'echarts/features'
|
||||||
|
|
||||||
|
use([
|
||||||
|
LineChart,
|
||||||
|
BarChart,
|
||||||
|
PieChart,
|
||||||
|
ScatterChart,
|
||||||
|
RadarChart,
|
||||||
|
GridComponent,
|
||||||
|
TooltipComponent,
|
||||||
|
LegendComponent,
|
||||||
|
TitleComponent,
|
||||||
|
DatasetComponent,
|
||||||
|
TransformComponent,
|
||||||
|
MarkLineComponent,
|
||||||
|
ToolboxComponent,
|
||||||
|
DataZoomComponent,
|
||||||
|
VisualMapComponent,
|
||||||
|
GraphicComponent,
|
||||||
|
AriaComponent,
|
||||||
|
CanvasRenderer,
|
||||||
|
SVGRenderer,
|
||||||
|
LabelLayout,
|
||||||
|
UniversalTransition
|
||||||
|
])
|
||||||
Loading…
Reference in New Issue
Block a user