這篇文章主要介紹vuejs如何加載echarts,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!
方法:1、使用“npm install echarts vue-echarts”語句安裝vue-echarts;2、在“main.js”文件中引入vue-echarts模塊;3、在需要的界面中,根據需要添加echarts代碼即可。
本教程操作環境:windows7系統、vue2.9.6版,DELL G3電腦。
vuejs加載echarts
npm 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>以上是“vuejs如何加載echarts”這篇文章的所有內容,感謝各位的閱讀!希望分享的內容對大家有幫助,更多相關知識,歡迎關注億速云行業資訊頻道!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。