el-select的change事件中传参
如果我们想在el-select的change事件中拿到一些特定的参数,就可以用到(…arr)=>checkManager(field.name,…arr)的方式传参。
·
如果我们想在el-select的change事件中拿到一些特定的参数,就可以用到(…arr) => checkManager(field.name, …arr)的方式传参,下面是我在项目中截取的部分代码,仅供参考。
// html
<el-select
v-model="projectInfo[field.name]"
filterable
remote
:remote-method="getManagerList"
@change="(...arr) => checkManager(field.name, ...arr)"
>
<el-option
v-for="option in managerList"
:key="option.account"
:label="option.dspName + '(' + (option.deptName || '') + ')'"
:value="option.account"
/>
</el-select>
// js
// 接口请求获取managerList
getManagerList(val) {},
checkManager(name, val) {
const current = this.managerList.find((e) => e.account === val);
let obj = {};
if (name === 'creditManagerAAccount') {
obj = {
creditManagerAName: current.dspName,
creditManagerADeptNo: current.deptCode,
creditManagerADeptName: current.deptName,
};
} else if (name === 'creditManagerBAccount') {
obj = {
creditManagerBName: current.dspName,
creditManagerBDeptNo: current.deptCode,
creditManagerBDeptName: current.deptName,
};
} else if (name === 'legalManagerAccount') {
obj = {
legalManagerName: current.dspName,
legalManagerDeptNo: current.deptCode,
legalManagerDeptName: current.deptName,
};
}
this.projectInfo = { ...this.projectInfo, ...obj };
}
更多推荐
已为社区贡献2条内容
所有评论(0)