Skip to content

Commit 40140af

Browse files
dpp0507007insummer
authored andcommitted
fix:修复切换gird-item的name时未正确显示内容 (#636)
1 parent 36be108 commit 40140af

File tree

3 files changed

+39
-3
lines changed

3 files changed

+39
-3
lines changed

dist/grid-item/index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ Component({
1818
attached() {
1919

2020
},
21+
observers: {
22+
'key': function() {
23+
const parent = this.getRelationNodes('../grid/index')[0];
24+
if (parent) {
25+
parent.setData({
26+
gridItems: [],
27+
childNum: 0
28+
});
29+
parent.initGrids();
30+
}
31+
}
32+
},
2133

2234
lifetimes: {
2335
show() {
@@ -31,4 +43,4 @@ Component({
3143
}, { bubbles: true, composed: true });
3244
},
3345
}
34-
});
46+
});

examples/dist/grid-item/index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ Component({
1818
attached() {
1919

2020
},
21+
observers: {
22+
'key': function() {
23+
const parent = this.getRelationNodes('../grid/index')[0];
24+
if (parent) {
25+
parent.setData({
26+
gridItems: [],
27+
childNum: 0
28+
});
29+
parent.initGrids();
30+
}
31+
}
32+
},
2133

2234
lifetimes: {
2335
show() {
@@ -31,4 +43,4 @@ Component({
3143
}, { bubbles: true, composed: true });
3244
},
3345
}
34-
});
46+
});

src/grid-item/index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ Component({
1818
attached() {
1919

2020
},
21+
observers: {
22+
'key': function() {
23+
const parent = this.getRelationNodes('../grid/index')[0];
24+
if (parent) {
25+
parent.setData({
26+
gridItems: [],
27+
childNum: 0
28+
});
29+
parent.initGrids();
30+
}
31+
}
32+
},
2133

2234
lifetimes: {
2335
show() {
@@ -31,4 +43,4 @@ Component({
3143
}, { bubbles: true, composed: true });
3244
},
3345
}
34-
});
46+
});

0 commit comments

Comments
 (0)