@cloudbase/weda-ui-mp 3.21.1 → 3.21.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -23,6 +23,7 @@ Component({
|
|
|
23
23
|
|
|
24
24
|
data: {
|
|
25
25
|
isUseNewCanvas: false,
|
|
26
|
+
isVisible: false,
|
|
26
27
|
},
|
|
27
28
|
domObserver: null,
|
|
28
29
|
ready: function () {
|
|
@@ -98,7 +99,7 @@ Component({
|
|
|
98
99
|
.boundingClientRect(async (res) => {
|
|
99
100
|
if (typeof callback === 'function') {
|
|
100
101
|
this.chart = callback(canvas, res.width, res.height, canvasDpr);
|
|
101
|
-
} else if (this.data.ec && typeof this.data.ec.onInit === 'function') {
|
|
102
|
+
} else if (this.data.isVisible && this.data.ec && typeof this.data.ec.onInit === 'function') {
|
|
102
103
|
this.chart = await this.data.ec.onInit(canvas, res.width, res.height, canvasDpr);
|
|
103
104
|
} else {
|
|
104
105
|
this.triggerEvent('init', {
|
|
@@ -136,7 +137,8 @@ Component({
|
|
|
136
137
|
|
|
137
138
|
if (typeof callback === 'function') {
|
|
138
139
|
this.chart = callback(canvas, canvasWidth, canvasHeight, canvasDpr);
|
|
139
|
-
} else if (this.data.ec && typeof this.data.ec.onInit === 'function') {
|
|
140
|
+
} else if (this.data.isVisible && this.data.ec && typeof this.data.ec.onInit === 'function') {
|
|
141
|
+
// 节点可见的时候重绘
|
|
140
142
|
this.chart = await this.data.ec.onInit(canvas, canvasWidth, canvasHeight, canvasDpr);
|
|
141
143
|
} else {
|
|
142
144
|
this.triggerEvent('init', {
|
|
@@ -146,8 +148,6 @@ Component({
|
|
|
146
148
|
dpr: canvasDpr,
|
|
147
149
|
});
|
|
148
150
|
}
|
|
149
|
-
|
|
150
|
-
this.domObserver && this.domObserver.disconnect();
|
|
151
151
|
}
|
|
152
152
|
});
|
|
153
153
|
},
|
|
@@ -225,7 +225,10 @@ Component({
|
|
|
225
225
|
this.domObserver.relativeToViewport().observe(`#${this.data.canvasId}`, (res) => {
|
|
226
226
|
// 当页面出现图表时再绘制图表,避免出现白屏
|
|
227
227
|
if (res.intersectionRatio) {
|
|
228
|
+
this.setData({ isVisible: true });
|
|
228
229
|
this.init();
|
|
230
|
+
} else {
|
|
231
|
+
this.setData({ isVisible: false });
|
|
229
232
|
}
|
|
230
233
|
});
|
|
231
234
|
},
|
|
@@ -239,6 +242,7 @@ Component({
|
|
|
239
242
|
},
|
|
240
243
|
detached() {
|
|
241
244
|
this.domObserver && this.domObserver.disconnect();
|
|
245
|
+
this.setData({ isVisible: false });
|
|
242
246
|
},
|
|
243
247
|
},
|
|
244
248
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<wxs module="tools"> function includes(array, item) { return array.map(function (v) { return v.value }).indexOf(item.value) !== -1 } module.exports = { includes: includes } </wxs>
|
|
2
|
-
<view class="weda-ui-custom-picker">
|
|
2
|
+
<view class="weda-ui-custom-picker wd-select-modal">
|
|
3
3
|
<view class="weda-ui-custom-mask" data-clear="false" bindtap="cancelPicker"></view>
|
|
4
4
|
<view class="weda-ui-custom-picker__inner" style="height: {{height}};">
|
|
5
5
|
<view wx:if="{{!focus}}" class="weda-ui-custom-picker__header">
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
</view>
|
|
20
20
|
<scroll-view wx:if="{{status !== -1}}" class="weda-ui-custom-picker__body" scroll-y="true" enhanced="true" bindscrolltolower="bindscrolltolower">
|
|
21
21
|
<view class="weda-ui-custom-picker__columns">
|
|
22
|
-
<view class="weda-ui-custom-picker__column">
|
|
23
|
-
<view wx:for="{{showOption}}" wx:key="i" wx:for-index="i" class="weda-ui-custom-picker__column-item {{multiple?'multiple':''}} {{ tools.includes(selectedCache, item) ? 'is-selected':''}} {{ (item.disabled) ? 'is-disabled':''}}" bindtap="onItemClick" data-value="{{item}}">
|
|
22
|
+
<view class="weda-ui-custom-picker__column wd-select-list">
|
|
23
|
+
<view wx:for="{{showOption}}" wx:key="i" wx:for-index="i" class="weda-ui-custom-picker__column-item wd-select-list-item {{multiple?'multiple':''}} {{ tools.includes(selectedCache, item) ? 'is-selected':''}} {{ (item.disabled) ? 'is-disabled':''}}" bindtap="onItemClick" data-value="{{item}}">
|
|
24
24
|
<text class="weda-ui-custom-picker__column-item-text {{multiple?'multiple':''}}">{{item.label||item.value}}</text>
|
|
25
25
|
</view>
|
|
26
26
|
<view wx:if="{{status === 1}}" class="weda-ui-custom-picker__status weda-ui-custom-picker__status--loading"> <i class="weda-ui-custom-picker__loading-icon"></i>加载中... </view>
|