1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- 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 width = 100 / nodes.length;
- nodes.forEach(item => {
- item.setData({
- 'width': width + '%'
- });
- });
- }
- },
- ready () {
- this.setGridItemWidth();
- }
- });
|