vue下使用select2,繫結資料問題

2021-08-11 15:19:53 字數 698 閱讀 6445

在select元素上應用v-model繫結資料,本來沒啥問題,後來應用了select2優化樣式,發現v-model不管用了。

html部分:

id="devicetypeadd"

name="devicetypeadd"

v-model="devicetypeadd"

type="text"

class="span3">

value="-1">請選擇報廢裝置型別option>

v-for="(key, value) in devicetype"

value="}">}option>

select>

select元素應用select2:

$('select').select2();

在瀏覽器看了下select2把元素渲染了成這樣,怪不得繫結不了

//選擇的值繫結到全域性變數

$("#devicetypeadd").on('change', function

(e) );

//select選定某個預設值

watch:

}

select2 使用筆記

1.把頁面中 可能不在同乙個頁面,一般都是在列表頁介面 的tabindex刪掉 tabindex 1 role dialog aria labelledby mymodallabel aria hidden true 2.重寫enforcefocus方法 fn.modal.constructor.p...

select2的簡單使用

修改 type template.html 引入js stylesheet href plugins select2 select2.css stylesheet href plugins select2 select2 bootstrap.css stylesheet href plugins a...

前端外掛程式之Select2使用

工欲善其事,必先利其器 select2是一款基於jquery的下拉列表外掛程式,主要用來優化select,支援單選和多選,同時也支援分組顯示 列表檢索 遠端獲取資料等眾多好用的功能 需要用到的js和css檔案位於專案 下的dist目錄中,需要將這個目錄中的對應檔案放入你的專案裡,這一步不贅述 引入c...