日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

Element-UI中selet下拉框無法回顯問題

作者:weixin_42180332 更新時間: 2022-06-08 編程語言

使用elementUI時,在修改頁面,下拉框回顯數據有問題

這里客戶ID需要默認選中id為8的客戶。并且顯示客戶名稱?

<el-form-item label="客戶" prop="customerId">
        <el-select v-model="form.customerId" placeholder="請選擇">
          <el-option 
             v-for="item in customerList" 
             :value="item.customerId"             
            :label="item.customerName">
          </el-option>
        </el-select>
 </el-form-item>

原因:<el-option>中 :value的值與<el-select>的 v-model值不匹配,我這里form.customerId的值為字符串,而item.customerId的值為數字類型,所以導致回顯數據無法自動選中

解決:將form.customerId和item.customerId轉換為同一類型 ,并檢查數據是否相同

?

原文鏈接:https://blog.csdn.net/weixin_42180332/article/details/106944853

欄目分類
最近更新