fixed #3596
This commit is contained in:
parent
679b2a2b8e
commit
ce7b39c204
2 changed files with 7 additions and 4 deletions
|
@ -4,7 +4,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { oneOf, findComponentsDownward } from '../../utils/assist';
|
import { oneOf, findComponentDownward, findBrothersComponents } from '../../utils/assist';
|
||||||
|
|
||||||
const prefixCls = 'ivu-row';
|
const prefixCls = 'ivu-row';
|
||||||
|
|
||||||
|
@ -58,7 +58,10 @@
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
updateGutter (val) {
|
updateGutter (val) {
|
||||||
const Cols = findComponentsDownward(this, 'iCol');
|
// 这里会嵌套寻找,把 Col 里的 Row 里的 Col 也找到,所以用 兄弟找
|
||||||
|
// const Cols = findComponentsDownward(this, 'iCol');
|
||||||
|
const Col = findComponentDownward(this, 'iCol');
|
||||||
|
const Cols = findBrothersComponents(Col, 'iCol', false);
|
||||||
if (Cols.length) {
|
if (Cols.length) {
|
||||||
Cols.forEach((child) => {
|
Cols.forEach((child) => {
|
||||||
if (val !== 0) {
|
if (val !== 0) {
|
||||||
|
|
|
@ -230,12 +230,12 @@ export function findComponentsUpward (context, componentName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find brothers components
|
// Find brothers components
|
||||||
export function findBrothersComponents (context, componentName) {
|
export function findBrothersComponents (context, componentName, exceptMe = true) {
|
||||||
let res = context.$parent.$children.filter(item => {
|
let res = context.$parent.$children.filter(item => {
|
||||||
return item.$options.name === componentName;
|
return item.$options.name === componentName;
|
||||||
});
|
});
|
||||||
let index = res.indexOf(context);
|
let index = res.indexOf(context);
|
||||||
res.splice(index, 1);
|
if (exceptMe) res.splice(index, 1);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue