mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-05-21 13:59:15 +08:00
修复使用全局变量,导致部分cell边框不出现的问题 (#237)
This commit is contained in:
parent
6d771e7338
commit
026813e4ae
@ -2,7 +2,8 @@ var Zan = require('../../dist/index');
|
||||
|
||||
Page(Object.assign({}, Zan.Switch, {
|
||||
data: {
|
||||
checked: false
|
||||
checked: false,
|
||||
show: true
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
|
@ -31,10 +31,12 @@
|
||||
<zan-cell title="只显示箭头" is-link></zan-cell>
|
||||
<zan-cell title="跳转到首页" is-link url="/pages/dashboard/index"></zan-cell>
|
||||
<zan-cell title="只有 footer 点击有效" is-link url="/pages/dashboard/index" only-tap-footer></zan-cell>
|
||||
<zan-cell title="单行列表" label="附加描述" value="详细信息"></zan-cell>
|
||||
<zan-cell title="表单">
|
||||
<input slot="footer" type="digit" placeholder="带小数点的数字键盘"/>
|
||||
</zan-cell>
|
||||
<block wx:if="{{ show }}">
|
||||
<zan-cell title="单行列表" label="附加描述" value="详细信息"></zan-cell>
|
||||
<zan-cell title="表单">
|
||||
<input slot="footer" type="digit" placeholder="带小数点的数字键盘"/>
|
||||
</zan-cell>
|
||||
</block>
|
||||
<zan-cell title="开关">
|
||||
<switch slot="footer" checked/>
|
||||
</zan-cell>
|
||||
|
@ -1,5 +1,3 @@
|
||||
let cellUpdateTimeout = 0;
|
||||
|
||||
Component({
|
||||
relations: {
|
||||
'../cell/index': {
|
||||
@ -16,15 +14,19 @@ Component({
|
||||
}
|
||||
},
|
||||
|
||||
data: {
|
||||
cellUpdateTimeout: 0
|
||||
},
|
||||
|
||||
methods: {
|
||||
_updateIsLastCell() {
|
||||
// 用 setTimeout 减少计算次数
|
||||
if (cellUpdateTimeout > 0) {
|
||||
if (this.data.cellUpdateTimeout > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
cellUpdateTimeout = setTimeout(() => {
|
||||
cellUpdateTimeout = 0;
|
||||
const cellUpdateTimeout = setTimeout(() => {
|
||||
this.setData({ cellUpdateTimeout: 0 });
|
||||
let cells = this.getRelationNodes('../cell/index');
|
||||
|
||||
if (cells.length > 0) {
|
||||
@ -35,6 +37,8 @@ Component({
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.setData({ cellUpdateTimeout });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user