Commit d1c4cc93 by luyt

feat:添加gltablebutton中attrs的属性为函数的情况,传入该项和配置

1 parent ebe9c475
...@@ -22,8 +22,7 @@ export default { ...@@ -22,8 +22,7 @@ export default {
} }
}, },
data() { data() {
return { return {}
}
}, },
render() { render() {
/** /**
...@@ -86,11 +85,17 @@ export default { ...@@ -86,11 +85,17 @@ export default {
// //1.筛选过滤条件 // //1.筛选过滤条件
const componentList = this.buttonList const componentList = this.buttonList
.map(item => { .map(item => {
//处理disabled情况(函数或者boolean) //处理attrs中属性为函数情况
item = deepcopy(item) item = deepcopy(item)
if(objectType(item.attrs.disabled) === 'Function'){ let attrKeys = item.attrs ? Object.keys(item.attrs) : 0
item.attrs.disabled = item.attrs.disabled(this.buttonItem, item) if (attrKeys.length > 0) {
for (let key of attrKeys) {
if (objectType(item.attrs[key]) === 'Function') {
item.attrs[key] = item.attrs[key](this.buttonItem, item)
}
} }
}
//不传条件,默认显示 //不传条件,默认显示
if (!item.condition) { if (!item.condition) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!