vue
inject provide 传值 后代组件使用
assign 静态修改对象属性 不会改变原对象(不会监听到字段变化时使用)
inheritAttrs :false 子组件跟标签不展示未使用的传值
递归处理tree数据
formatterTreeData(data) {
const filter = (arr, item) => {
const children = item.children
if (size(children)) {
const childData = children.reduce(filter, [])
// 下级全部禁用后当前级也禁用
if (childData.every(it => it.disabled)) {
item.current.disabled = true
}
arr.push({ ...item.current, children: childData })
} else {
// 最下级添加禁用字段
if (
this.shuJuYChecked.findIndex(
ele => item.current.xiangMuID === ele
) != -1
) {
item.current.disabled = true
}
arr.push({ ...item.current, children: [] })
}
return arr
}
return data.reduce(filter, [])
}
CSS
表单两行布局宽度未占满问题解决
& ::v-deep .HISZK-base-form--inline .HISZK-base-form-item {
display: flex;
}
& ::v-deep .HISZK-base-form-item__content {
flex: 1;
display: flex;
}