This commit is contained in:
梁灏 2017-08-24 15:06:54 +08:00
parent b9541c05ca
commit 9eec7f1660
3 changed files with 31 additions and 14 deletions

View file

@ -4,6 +4,7 @@
</div>
</template>
<script>
import { findComponentUpward } from '../../utils/assist';
const prefixCls = 'ivu-col';
export default {
@ -70,7 +71,10 @@
},
methods: {
updateGutter () {
this.$parent.updateGutter(this.$parent.gutter);
const Row = findComponentUpward(this, 'Row');
if (Row) {
Row.updateGutter(Row.gutter);
}
}
},
mounted () {

View file

@ -4,7 +4,7 @@
</div>
</template>
<script>
import { oneOf } from '../../utils/assist';
import { oneOf, findComponentsDownward } from '../../utils/assist';
const prefixCls = 'ivu-row';
@ -58,11 +58,14 @@
},
methods: {
updateGutter (val) {
this.$children.forEach((child) => {
if (val !== 0) {
child.gutter = val;
}
});
const Cols = findComponentsDownward(this, 'iCol');
if (Cols.length) {
Cols.forEach((child) => {
if (val !== 0) {
child.gutter = val;
}
});
}
}
},
watch: {