Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

级联对象显示 #43

Closed
hujunhain opened this issue Nov 13, 2017 · 5 comments
Closed

级联对象显示 #43

hujunhain opened this issue Nov 13, 2017 · 5 comments

Comments

@hujunhain
Copy link

你好,可否实现 级联对象显示 如: {field: 'aa.bb.cc',.....}

@huangshuwei
Copy link
Collaborator

你好,可否实现 级联对象显示 如: {field: 'aa.bb.cc',.....}

可以啊,只不过不能放到 data(){return{}} 里,因为这里无法获取到上下文。
猜测你的业务场景是需要动态创建columns信息,那么你可以把拼接columns对象的逻辑放到 methods

@hujunhain
Copy link
Author

不是动态columns,只是数据单元格对象里面还包含对象。只是觉得放到methods中,有编辑就要两次拼接,稍显麻烦。

@huangshuwei
Copy link
Collaborator

放到data 里不行的,这是vuejs 的限制

@hujunhain
Copy link
Author

好的

@hujunhain
Copy link
Author

在获取值的时候由:item[colField] 改为如下方法可以应付我目前的状况
getItemValue(item,colField){
let value = item
let colArr=colField.split(".");
for(let i=0;i<colArr.length;i++){
value = value[colArr[i]]
if(!value) return;
}
return value
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants