小程序源码

This commit is contained in:
mindskip
2020-09-02 08:44:41 +08:00
parent 30b54a23ff
commit 593017f562
277 changed files with 5497 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
Component({
externalClasses: ['i-class'],
relations: {
'../grid-item/index': {
type: 'child',
linked () {
this.setGridItemWidth();
},
linkChanged () {
this.setGridItemWidth();
},
unlinked () {
this.setGridItemWidth();
}
}
},
methods: {
setGridItemWidth () {
const nodes = this.getRelationNodes('../grid-item/index');
// const len = nodes.length;
// if (len < 3) {
// nodes.forEach(item => {
// item.setData({
// 'width': '33.33%'
// });
// });
// } else {
// const width = 100 / nodes.length;
// nodes.forEach(item => {
// item.setData({
// 'width': width + '%'
// });
// });
// }
const width = 100 / nodes.length;
nodes.forEach(item => {
item.setData({
'width': width + '%'
});
});
}
},
ready () {
this.setGridItemWidth();
}
});

View File

@@ -0,0 +1,3 @@
{
"component": true
}

View File

@@ -0,0 +1 @@
<view class="i-class i-grid"><slot></slot></view>

View File

@@ -0,0 +1 @@
.i-grid{border-top:1rpx solid #e9eaec;border-left:1rpx solid #e9eaec;overflow:hidden}