下拉框附帶搜索框


<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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM