您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

vuejs怎么加载echarts

2024/3/5 21:07:42发布27次查看
方法:1、使用“npm install echarts vue-echarts”语句安装vue-echarts;2、在“main.js”文件中引入vue-echarts模块;3、在需要的界面中,根据需要添加echarts代码即可。
本教程操作环境:windows7系统、vue2.9.6版,dell g3电脑。
vuejs加载echarts
先npm安装vue-echartsnpm install echarts vue-echarts
开发:main.js
import echarts from 'vue-echarts'import 'echarts/lib/chart/line'vue.component('chart', echarts)
helloworld.vue
<template>  <p class="hello">    <chart ref="chart1" :options="orgoptions" :auto-resize="true"></chart>  </p></template><script>export default {  name: 'helloworld',  data () {    return {      orgoptions: {},    }  },  mounted() {    this.orgoptions = {        xaxis: {            type: 'category',            data: ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']        },        yaxis: {            type: 'value'        },        series: [{            data: [820, 932, 901, 934, 1290, 1330, 1320],            type: 'line',            smooth: true        }]    }  }}    </script>
到这里就结束了。试过打包了,没报错~
相关推荐:《vue.js教程》
以上就是vuejs怎么加载echarts的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product