dev
xiaowen 3 years ago
parent ffaf72c111
commit 316f673989

@ -38,7 +38,7 @@ Component({
detached(e) { // 组件移除 detached(e) { // 组件移除
this[this.data.chartId] = null this[this.data.chartId] = null
this[this.data.canvasId] = null this[this.data.canvasId] = null
this[this.data.showChart]=false this[this.data.showChart] = false
}, },
}, },
/** /**
@ -48,9 +48,9 @@ Component({
initChart() { initChart() {
this[this.data.chartId]?.init((canvas, width, height, dpr) => { this[this.data.chartId]?.init((canvas, width, height, dpr) => {
const chart = echarts.init(canvas, null, { // 配置图表的配置项 const chart = echarts.init(canvas, null, { // 配置图表的配置项
width:width, // 宽度 width: width, // 宽度
height: height, // 高度 height: height, // 高度
devicePixelRatio:dpr// 像素 devicePixelRatio: dpr// 像素
}) })
chart.setOption(this.getOption()) chart.setOption(this.getOption())
return chart return chart

@ -1,4 +1,4 @@
<!--pages/components/custom-echarts/index.wxml--> <!--pages/components/custom-echarts/index.wxml-->
<view style="height: {{ height }};width:100%"> <view style="height: {{ height }}; width:100%;">
<ec-canvas force-use-old-canvas="{{true}}" wx:if="{{showChart}}" id="{{ chartId }}" canvas-id="eventBar" ec="{{ec}}" options="{{chartOption}}"></ec-canvas> <ec-canvas force-use-old-canvas="{{true}}" wx:if="{{showChart}}" id="{{ chartId }}" canvas-id="eventBar" ec="{{ec}}" options="{{chartOption}}"></ec-canvas>
</view> </view>

@ -59,18 +59,20 @@ Component({
icon: 'rectangle',//data图标样式 icon: 'rectangle',//data图标样式
itemWidth: 10,//data图标大小 itemWidth: 10,//data图标大小
itemHeight: 10, itemHeight: 10,
left: 7,
textStyle: { textStyle: {
fontSize: 9 fontSize: 10,
fontWeight: 400
}, },
data: ['微博', '其他','短视频', '微信','APP', '论坛', '新闻'], data: ['微博', '其他','短视频', '微信','APP', '论坛', '新闻'],
// color:['#FF4852','#FF6E25','#FFBF00','#20CC62','#00D6D6','#00AAFF','#7257FF'], // color:['#FF4852','#FF6E25','#FFBF00','#20CC62','#00D6D6','#00AAFF','#7257FF'],
}, },
//图表位置 //图表位置
grid: { grid: {
left: 20, left: 7,
right: 20, right: 7,
bottom: 15, bottom: 7,
top: 40, top: 36,
containLabel: true containLabel: true
}, },
yAxis: [ yAxis: [
@ -222,16 +224,32 @@ Component({
} }
] ]
} }
}, },
onShow() { lifetimes: {
this.getTabBar().init(); created() {
wx.removeStorageSync('currTemplateType');
},
attached() {
setTimeout(() => {
},1000)
},
detached(e) {
console.log(2222)
this.setData({
showChart: false
})
},
}, },
methods: { methods: {
priceSel(e){ priceSel(e){
this.setData({ this.setData({
intervalSel: e.currentTarget.dataset.index intervalSel: e.currentTarget.dataset.index
}) })
},
changeTab(val) {
console.log(val)
} }
} }

@ -50,5 +50,10 @@ Page({
onLoad: function (options) { onLoad: function (options) {
}, },
changeTab(val) {
let n = val.detail.index;
this.setData({
active: n
})
}
}) })

@ -1,12 +1,12 @@
<!--index.wxml--> <!--index.wxml-->
<view class="container"> <view class="container">
<van-tabs class="menu-tabs" active="{{ active }}" ellipsis="{{false}}" animated="{{true}}"> <van-tabs class="menu-tabs" active="{{ active }}" ellipsis="{{false}}" animated="{{true}}" bind:change="changeTab">
<van-tab wx:for="{{navData}}" title="{{item.text}}" wx:key="index"> <van-tab wx:for="{{navData}}" title="{{item.text}}" wx:key="index">
<data-child wx:if="{{item.component === 'data-child'}}"></data-child> <data-child wx:if="{{item.component === 'data-child' && active === 0}}"></data-child>
<event-child wx:if="{{item.component === 'event-child'}}"></event-child> <event-child wx:if="{{item.component === 'event-child' && active === 1}}"></event-child>
<media-child wx:if="{{item.component === 'media-child'}}"></media-child> <media-child wx:if="{{item.component === 'media-child' && active === 2}}"></media-child>
<sound-child wx:if="{{item.component === 'sound-child'}}"></sound-child> <sound-child wx:if="{{item.component === 'sound-child' && active === 3}}"></sound-child>
<barometer-child wx:if="{{item.component === 'barometer-child'}}"></barometer-child> <barometer-child wx:if="{{item.component === 'barometer-child' && active === 4}}"></barometer-child>
</van-tab> </van-tab>
</van-tabs> </van-tabs>
<tabbar /> <tabbar />

@ -6,5 +6,5 @@
"urlCheck": false "urlCheck": false
}, },
"condition": {}, "condition": {},
"libVersion": "2.14.1" "libVersion": "2.23.4"
} }
Loading…
Cancel
Save