vue element ui下拉多選驗證問題

2022-04-28 03:24:57 字數 760 閱讀 8421

最近做專案時,發現剛開啟彈框就出現了下拉多選的驗證,如下圖:

經過網上搜尋,找到了兩種解決方案

第一種解決辦法:

1

personneldescription: [

2

3 ],

this.ruleformadd = ;
第一種解決方案總結為兩點即:1.在校驗規則裡加type:"array";2.下拉多選框繫結的變數初始值設定為.

下面接著說第二種解決方案:

就是將驗證規則改為自定義的validator驗證,同樣需要設定繫結的變數為

如下:

1personneldescription: [

2

3 //

4 ],

1 const personneldescriptionvalid = function

(rule, value, callback) else

7 }

this.ruleformadd = ;

Select下拉多選

首先,將下面的js 複製到乙個js檔案中 js檔名可以命名為selectmultip哦 並將其引入專案中即可 function reload function id,data,setdata var e document.getelementbyid id e.innerhtml htm rende...

layui下拉多選formSelects使用方法

引入formselects v4樣式 系統使用者 註冊外掛程式 layui.config extend 使用外掛程式,在layui.use中新增formselects layui.use element laydate table layer form laypage upload tree for...

vue元件v select下拉多選框

先看看最終實現效果圖 是vue的乙個元件。用於下拉框多選的情況 var vm new vue 如果是靜態的,則直接把資料寫到options裡面,如果是動態獲取,則請求url後填充資料 渲染角色多選下拉框資料 ajax vm.options.push json console.log vm.optio...