代码拉取完成,页面将自动刷新
表单定义(CRUD)
{
label: '上级机构',
prop: 'orgId',
type: 'tree',
search: true,
clearable: false,
// dataType: 'string',
dicUrl: '/api/blade-xxx/xxx/tree',
props: {
label: 'title',
value: 'key'
}
},
数据
[
{
"id": "32",
"parentId": "0",
"children": [
{
"id": "34",
"parentId": "32",
"children": [
{
"id": "42",
"parentId": "34",
"title": "三级公司",
"key": "42",
"value": "42"
}
],
"hasChildren": true,
"title": "二级公司",
"key": "34",
"value": "34"
}
],
"hasChildren": true,
"title": "总公司",
"key": "32",
"value": "32"
}
]
在表单中,如果这个字段没有选择值(为空时,会触发以下错误)
error.js:21 TypeError: Cannot read properties of null (reading 'key')
at $o (index.js:1)
at e.getNode (index.js:1)
at a.getNode (index.js:1)
at a.<anonymous> (avue.min.js:formatted:11295)
at Array.<anonymous> (vue.min.js:6)
at qe (vue.min.js:6)
跟踪代码发现,在使用了tree作为组件时,进入页面会触发 init: function
方法。
方法中,会去取一个默认节点值,但这个时候还没有选择数据,所以触发了该错误。。
AVUE 版本:2.8.18
element-ui版本:2.15.1
我这没复现啊 vue啥版本
刚看了代码,这个标签上层有个group包裹
{
label: '管理分类',
prop: 'managerInfo',
icon: 'el-icon-s-tools',
column: [{
label: '上级机构',
prop: 'orgId',
type: 'tree',
search: true,
clearable: false,
// dataType: 'string',
dicUrl: '/api/blade-xxx/xxx/tree',
props: {
label: 'title',
value: 'key'
}
}]
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
你的数据应该返回null导致,你返回“”试下
登录 后才可以发表评论