MUI框架封装一个原生选择器,还挺好用的,效果如下:
利用这个首先要导入两个js和两个css
mui.picker.js mui.poppicker.js mui.picker.css mui.poppicker.css
这四个文件是封装好的样式以及js。
picker是选择列表插件,poppicker是弹出列表插件
具体使用如下:
//客户渠道选择 var xxxxx = document.getElementById("xxxxx"); xxxxxx.addEventListener("tap", function() { var roadPick = new mui.PopPicker();//获取弹出列表组建,假如是二联则在括号里面加入{layer:2} roadPick.setData([{//设置弹出列表的信息,假如是二联,还需要一个children属性 value: "1", text: "直销" }, { value: "2", text: "传统寿销养" }]); roadPick.show(function(item) {//弹出列表并在里面写业务代码 }); });