Skip to content

Commit 01dcbb7

Browse files
muronggjuzi214032
authored andcommitted
fix(ImagePicker): 修复 urls 属性更新以后,图片不显示
close #1075
1 parent 01e4f51 commit 01dcbb7

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/image-picker/index.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,26 +78,37 @@ Component({
7878
attached: function () {
7979
// 在组件实例进入页面节点树时执行
8080
let newOrOld = this.judgeNewOrOld();
81-
8281
// 对 cells 的兼容处理
8382
if (this.data.cells !== null) {
8483
newOrOld = 'new';
8584
this.setData({
86-
newOrOld,
8785
urls: this.data.cells
8886
});
89-
} else {
87+
}
88+
this.setData({
89+
newOrOld
90+
});
91+
},
92+
},
93+
94+
observers: {
95+
// fix #1075 urls属性更新以后,图片不显示
96+
// solution urls 更新时重新判断
97+
urls() {
98+
if (this.data.cells === null) {
99+
let newOrOld = this.judgeNewOrOld();
90100
this.setData({
91101
newOrOld
92102
});
93103
}
94-
},
104+
}
95105
},
96106

97107
/**
98108
* 组件的方法列表
99109
*/
100110
methods: {
111+
101112
handleClear() {
102113
let urls = this.data.urls;
103114
this.setData({

0 commit comments

Comments
 (0)