element [Bug Report] 在el-table组件的template slot-scope="scope"作用域内使用el-cascader的getCheckedNodes失败

k0pti3hp  于 4个月前  发布在  其他
关注(0)|答案(3)|浏览(94)

Element UI version

2.13.2

OS/Browsers version

windows10

Vue version

2.6.10

#19489 (comment)

Steps to reproduce

在el-table组件的template slot-scope="scope"作用域内使用el-cascader的getCheckedNodes失败,
ref如果是动态命名时,返回的内容是空数组。
将ref写死固定后,首次返回空数组,之后每次都返回node值

为了排除,将el-cascader写在el-table外,调用一切正常。但是放入el-table内部,就会出现问题

vue-----------------------------------------------------------

{{scope.row.title}}

{{scope.row.orgIdName}}

<el-cascader filterable :placeholder="scope.row.orgIdName" style="width:100%" size="mini"
:options="orgIdOptions" @change="updateCasChange(scope.row, scope.$index, 2)" :show-all-levels="false" :props="orgIdprops"
:ref="'orgIdindex2' scope.$index" v-model="scope.row.orgId">

{{scope.row.region}}

{{scope.row.takeTime}}

<el-button @click="editPerson(scope.row, scope.$index, 2)" type="text" size="small" v-if="scope.row.noedit==true">编辑
<el-button @click="saveOrg(scope.row, scope.$index, 2)" type="text" v-else size="small">保存
<el-button @click="deleteperson(scope.row, 'url', 2)" type="text" style="color:#F56C6C" size="small">删除

js------------------------------------------------------------------------------------------------

updateCasChange(val, index, num) {
let nodeObj = this.$refs['orgIdindex' num index].getCheckedNodes();
console.log(val.orgId, "222-updateType")
console.log(index, "333-updateType")
console.log(num, "444-updateType")
console.log(nodeObj, "nodeObj")
},

What is Expected?

Please tell me the solution

What is actually happening?

Please tell me the solution

h7appiyu

h7appiyu1#

{{scope.row.title}}{{scope.row.orgIdName}}{{scope.row.region}}{{scope.row.takeTime}} 编辑 保存 删除 js------------------------------------------------------------------------------------------------

updateCasChange(val, index, num) {
let nodeObj = this.$refs['orgIdindex' num index].getCheckedNodes();
console.log(val.orgId, "222-updateType")
console.log(index, "333-updateType")
console.log(num, "444-updateType")
console.log(nodeObj, "nodeObj")
},

kxkpmulp

kxkpmulp3#

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

相关问题