<view class="echarts-wrap">
<my-echarts id="mychart-dom-bar" canvas-id="mychart-bar" :echarts="echarts" :onInit="initChart"></my-echarts>
</view>
import * as echarts from '@/common/echarts.min.js';
import myEcharts from '@/components/src/echarts.vue';
export default {
components:{myEcharts},
data() {
return {echarts}
},
methods: {
initChart(canvas, width, height) {
let chart = null
chart = echarts.init(canvas, null, {
width: width,
height: height
});
var option = {...}
chart.setOption(option);
return chart;
}
}
}
.echarts-wrap{
width: 100%;
height:500px;
}
this.ctx = wx.createCanvasContext(canvasId,this);
const query = wx.createSelectorQuery().in(this);
function Pe(t, e, n, i) {
if(isDomLevel2){
t.addEventListener(e, n, i)
}else{
t.attachEvent('on' + e, n)
}
}
function Le(t, e, n, i) {
if(isDomLevel2){
t.removeEventListener(e, n, i)
}else{
t.detachEvent('on' + e, n)
}
}
8.全文搜索 preventDefault() 修改当前的方法函数增加判断(函数名可能不叫 t_,不影响)
t_ = function(t) {
if(isDomLevel2 ){
t.preventDefault(), t.stopPropagation(), t.cancelBubble = !0
}else{
t.returnValue = false
t.cancelBubble = !0
}
}