uniapp使用echart


<template>
    <view class="content">
     <!-- 引入的mpvue-echarts组件 -->
     <uni-echarts class="ec-canvas" id="line-chart" ref="canvas" canvas-id="line-chart" :ec="echart"></uni-echarts>
   </view>
<template>

<script>
//import引入组件 import uniEcharts from '@/components/uni-echarts/uni-echarts'; export default { data() { return { //echart图表参数   echart: {     option: {     ......这里是echart参数     }   } }, methods: { // 重新渲染echart并且赋值 reloadEchart(data){   const option = this.echart.option;   option.series[0].data = data;   if(this.$refs['canvas']){     this.$refs['canvas'].updateOption(option); //赋值option },
//注册组件 components: {   uniEcharts } }
</script>

 

uniEcharts在components文件夹下:

 

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM