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

自定义字段问题 #28

Open
TangStudio opened this issue Apr 1, 2021 · 4 comments
Open

自定义字段问题 #28

TangStudio opened this issue Apr 1, 2021 · 4 comments

Comments

@TangStudio
Copy link

myProps: {
label: 'recordName',
value: 'id',
children: 'children',
children: [{
label: 'recordName',
value: 'id',
}]
}
请问children里边的字段如果要自定义,是怎样写呢?或者能加作者QQ吗,这样描述清楚一些,谢谢

@TangStudio
Copy link
Author

{
"id":15451,
"code":"20",
"recordName":"君珏B区",
"pid":0,
"dictionaryIndex":null,
"typeId":4,
"children":[
{
"id":538604,
"code":"2091",
"recordName":"3,4过道",
"pid":15451,
"dictionaryIndex":"91",
"typeId":4,
"children":null
},

主要是要把这种2层嵌套的数据放进去,如果改成自定义像如下这样:
myProps: {
label: 'recordName',
value: 'id',
children: 'children',
}
滚轮里边的数据显示倒是没问题了,但是无法赋值this.value2 = e.item.map(m => m.label).join('-'),最后这个value2 显示出来的值只有一个 -

@liub1934
Copy link
Owner

liub1934 commented Apr 1, 2021

myProps: {
  label: 'recordName',
  value: 'id',
  children: 'children'
}
this.value2 = e.item.map(m => m.recordName).join('-')

@TangStudio
Copy link
Author

myProps: {
label: 'recordName',
value: 'id',
}
单选自定义字段后,怎么获取这个id呢?
this.value2 = e.item.map(m => m.id) 这样貌似不行

@liub1934
Copy link
Owner

liub1934 commented Apr 2, 2021

打印下看看就知道了console.log(e.item),多选e.item是个数组,单选是个对象,插件文档有说明。单选取id直接e.item.id获取

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