<template>
<div id="chart" :style="{ width: '300px', height: '300px' }"></div>
</template>
<script>
const echarts = require("echarts/lib/echarts");
require("echarts/lib/component/title");
require("echarts/lib/component/tooltip");
require("echarts/lib/component/legend");
require("echarts/lib/chart/pie");
var option;
option = {
title: {
text: "Referer of a Website",
subtext: "Fake Data",
left: "center",
},
tooltip: {
trigger: "item",
},
legend: {
orient: "vertical",
left: "left",
},
series: [
{
name: "Access From",
type: "pie",
radius: "50%",
data: [
{ value: 1048, name: "Search Engine" },
{ value: 735, name: "Direct" },
{ value: 580, name: "Email" },
{ value: 484, name: "Union Ads" },
{ value: 300, name: "Video Ads" },
],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: "rgba(0, 0, 0, 0.5)",
},
},
},
],
};
export default {
name: "Echarts",
components: {},
props: {},
data() {
return {};
},
mouted() {
this.drawLine();
},
methods: {
drawLine() {
var chartDom = document.getElementById("chart");
var myChart = echarts.init(chartDom);
option && myChart.setOption(option);
},
},
computed: {},
};
</script>
<style scoped>
.myChart {
box-sizing: border-box;
padding: 0.5rem;
float: right;
}
</style>
vue2.x引入echarts的饼图后一片空白,控制台也没有报错
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
3条回答 默认 最新
- CSDN专家-showbo 2021-12-05 16:55关注
事件写错了,mounted,不是mouted,少了n
有帮助麻烦点下【采纳该答案】,谢谢~~本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 1无用
悬赏问题
- ¥15 c#窗体设计器错误如何解决?
- ¥30 征集Python提取PDF文字属性的代码
- ¥15 如何联系真正的开发者而非公司
- ¥15 有偿求苍穹外卖环境配置
- ¥15 代码在keil5里变成了这样怎么办啊,文件图像也变了,
- ¥20 Ue4.26打包win64bit报错,如何解决?(语言-c++)
- ¥15 clousx6整点报时指令怎么写
- ¥30 远程帮我安装软件及库文件
- ¥15 关于#自动化#的问题:如何通过电脑控制多相机同步拍照或摄影(相机或者摄影模组数量大于60),并将所有采集的照片或视频以一定编码规则存放至规定电脑文件夹内
- ¥20 (求远程解决)深信服vpn-2050这台设备如何配置才能成功联网?