1、問題
回顯的value和選項(xiàng)value類型不同
form中v-model="form.userId"是字符串類型
option中:value=“item.userId” 選項(xiàng)id是數(shù)字類型文章來源:http://www.zghlxwxcb.cn/news/detail-660262.html
2、辦法
:value=“item.userId” 改為 :value=“item.iduserId+‘’”(轉(zhuǎn)換成字符串)文章來源地址http://www.zghlxwxcb.cn/news/detail-660262.html
<el-form-item label="領(lǐng)導(dǎo)姓名" prop="createrId">
<el-select v-model="form.createrId" placeholder="請(qǐng)選擇領(lǐng)導(dǎo)姓名" clearable style="width:300px" filterable
@change="handleUserChange">
<el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId+''">
<span style="float: left">{{ item.nickName }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.dept.deptName }}</span>
</el-option>
</el-select>
</el-form-item>
到了這里,關(guān)于解決el-select回顯異常 顯示option選項(xiàng)的value 而不是顯示label的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!