下拉框附带搜索框
<html>
<head>
<title>下拉框附带搜索框</title>
<link href="${rc.contextPath}/statics/js/jquery-select2/3.4/select2.min.css" rel="stylesheet">
<script src="${rc.contextPath}/statics/js/jquery-select2/3.4/select2.min.js" type="text/javascript"></script>
</head>
<body>
<form>
<div>项目名称</div>
<div>
<select id="names" class="projSelect" v-model="...">
<option value="">请选择项目名称</option>
<option v-for="(item,i) in projList" :value="item.id">{{item.name}}</option>
</select>
</div>
</div>
<script>
$(function () {
$('.projSelect').select2();
})
</script>
</form>
</body>
</html>
主要就是红色标注的代码,当然相对路径不一样,直接复制需要修改路径。
jquery-select2.zip

浙公网安备 33010602011771号