本文主要是介绍【踩坑记录】ant design of vue cascader 搜索show-search,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
cascader 搜索踩坑记录
[Vue warn]: Error in render: “TypeError: Cannot read properties of undefined (reading ‘toLowerCase’)”
TypeError: Cannot read properties of undefined (reading ‘toLowerCase’)
报这个错误,解决问题的关键点在这里,官网用的是
但是我用了这个 :fieldNames="{ label: ‘text’, value: ‘id’, children: ‘children’ }",所以label应该换成
text,完美解决!
实现效果:
部分正确代码:
<a-form-item label="所属部门" :label-col="{ span: 3 }" :wrapper-col="{ span: 21 }"><a-cascader:fieldNames="{ label: 'text', value: 'id', children: 'children' }"v-decorator="['Dept']"placeholder="请选择所属部门":options="deptTreeData"change-on-select:show-search="{filter}":getPopupContainer="(triggerNode) => triggerNode.parentNode"/></a-form-item>
//所属部门搜索filter(inputValue, path) {console.log(path)return path.some(option => option.text.toLowerCase().indexOf(inputValue.toLowerCase()) > -1)},
这篇关于【踩坑记录】ant design of vue cascader 搜索show-search的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!