feat: 添加vue-echarts并注册到全局

This commit is contained in:
caoqianming 2024-10-24 11:25:04 +08:00
parent d10f4a790a
commit 15db849fd6
3 changed files with 56 additions and 1 deletions

View File

@ -28,7 +28,7 @@
"dagre": "^0.8.5", "dagre": "^0.8.5",
"dagre-d3": "^0.6.4", "dagre-d3": "^0.6.4",
"dhtmlx-gantt": "^8.0.6", "dhtmlx-gantt": "^8.0.6",
"echarts": "5.4.1", "echarts": "^5.5.1",
"element-plus": "^2.7.4", "element-plus": "^2.7.4",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"html2canvas": "^1.4.1", "html2canvas": "^1.4.1",
@ -42,6 +42,7 @@
"three": "^0.155.0", "three": "^0.155.0",
"tinymce": "6.3.2", "tinymce": "6.3.2",
"vue": "3.2.47", "vue": "3.2.47",
"vue-echarts": "^7.0.3",
"vue-i18n": "9.2.2", "vue-i18n": "9.2.2",
"vue-router": "4.1.6", "vue-router": "4.1.6",
"vuedraggable": "4.0.3", "vuedraggable": "4.0.3",

View File

@ -18,6 +18,9 @@ import htmlToPdf from "./utils/htmlToPdf";
import * as Cesium from "cesium"; import * as Cesium from "cesium";
import "echarts";
import ECharts from 'vue-echarts';
const app = createApp(App); const app = createApp(App);
app.use(store); app.use(store);
@ -33,6 +36,7 @@ app.use(Xlsx);
app.use(htmlToPdf); app.use(htmlToPdf);
app.use(jsBarCode); app.use(jsBarCode);
app.use(DataVVue3); app.use(DataVVue3);
app.component('v-chart', ECharts);
//挂载app //挂载app
app.mount("#app"); app.mount("#app");

View File

@ -6,6 +6,7 @@
<el-menu-item index="2" @click="currentM='带默认的选择'">带默认的选择</el-menu-item> <el-menu-item index="2" @click="currentM='带默认的选择'">带默认的选择</el-menu-item>
<el-menu-item index="3" @click="currentM='图标选择'">图标选择</el-menu-item> <el-menu-item index="3" @click="currentM='图标选择'">图标选择</el-menu-item>
<el-menu-item index="4" @click="currentM='表格选择'">表格选择</el-menu-item> <el-menu-item index="4" @click="currentM='表格选择'">表格选择</el-menu-item>
<el-menu-item index="5" @click="currentM='vue-echarts'">vue-echarts</el-menu-item>
</el-menu> </el-menu>
</el-aside> </el-aside>
<el-main> <el-main>
@ -34,6 +35,9 @@
></el-table-column> ></el-table-column>
</ehsTableSelect> </ehsTableSelect>
</div> </div>
<div v-if="currentM=='vue-echarts'">
<v-chart :option="chartOption" autoresize style="height: 400px; width: 400px"/>
</div>
</el-main> </el-main>
</el-container> </el-container>
</template> </template>
@ -50,6 +54,52 @@ export default {
// x:null, // x:null,
apiObj2: this.$API.system.user.list, apiObj2: this.$API.system.user.list,
x2: {}, x2: {},
chartOption: {
textStyle: {
fontFamily: 'Inter, "Helvetica Neue", Arial, sans-serif',
},
title: {
text: 'Traffic Sources',
left: 'center',
},
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c} ({d}%)',
},
legend: {
orient: 'vertical',
left: 'left',
data: [
'Direct',
'Email',
'Ad Networks',
'Video Ads',
'Search Engines',
],
},
series: [
{
name: 'Traffic Sources',
type: 'pie',
radius: '55%',
center: ['50%', '60%'],
data: [
{ value: 335, name: 'Direct' },
{ value: 310, name: 'Email' },
{ value: 234, name: 'Ad Networks' },
{ value: 135, name: 'Video Ads' },
{ value: 1548, name: 'Search Engines' },
],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)',
},
},
},
],
},
}; };
}, },
mounted() {}, mounted() {},