framework7智能選擇布局應用(smart-select)


一、靜態智能選擇布局:

只需要在<select>上面加<smart-select>類就可以形成智能選擇列表

帶有搜索欄的智能選擇--在App初始化時使用smartSelectsearchbar:true來啟動它

在彈窗窗口打開--在App初始化時使用smartSelectopenIn:"popup"|可以用data-open-in=“popup”打開這個頁面

在選擇器中打開--App初始化時使用smartSelectopenIn:"picker"|可以用data-open-in="picker"

可以用選擇器打開

多重選擇和選擇組:在<select>標簽里添加multiple

多重選擇最長長度:可以在<select>標簽里添加maxlength的屬性來限制選中的項目的數量

二、動態添加選項

在js中添加:

myApp.smartSelectAddOption(select,optionHTML,index)添加選項以在指定索引處選擇

select--html元素或者字符串(必須)

optionHTML-字符串與選項的HTML的補充

添加一個option

myApp.smartSelectAddOption('.smart-select select','<option value="apple">Apple</option>');

添加新的option到第一個組

myApp.smartSelectAddOption('.smart-select select','<option value='apple' selected>Apple</option>'

添加新的option到第二個組

myApp.smartSelectAddOption($$('.smart-select select optigroup').eq(1),'<option value="apple">Apple</option>',0);


免責聲明!

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



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