mui ——picker(選擇器)


效果展示:

1.頭部引入css:mui.picker和mui.poppicker 兩個css文件 

 

2.HTML:

<div id='showUserPicker' class="search-item">
   <span class="search-area"></span>
   <span id='userResult' class="search-cont mui-ellipsis">江寧區江寧區江寧區</span>
   <span class="pullDown"><img src="../../../img/icon/pulldown_icon.png"></span>
</div>

3.JS:引入picker.min和mui.poppicker兩個文件

 

(function($, doc) {
                $.init();
                $.ready(function() {
                    //普通示例
                    var userPicker = new $.PopPicker();
                    userPicker.setData([{
                        value: '1',
                        text: '玄武區'
                    }, {
                        value: '2',
                        text: '江寧區'
                    }, {
                        value: '3',
                        text: '浦口區'
                    }, {
                        value: '4',
                        text: '雨花台區'
                    }, {
                        value: '5',
                        text: '浦口區'
                    }]);
                    var showUserPickerButton = doc.getElementById('showUserPicker');
                    var userResult = doc.getElementById('userResult');
                    showUserPickerButton.addEventListener('tap', function(event) {
                        userPicker.show(function(items) {
                            userResult.innerText = items[0].text;
                            //返回 false 可以阻止選擇框的關閉
                            //return false;
                        });
                    }, false);
                });
            })(mui, document);

 


免責聲明!

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



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