weui的下拉框的赋值与取值(转)

weui的下拉框的赋值与取值

2018年08月07日 10:35:32 夏天wx:a1024271896 阅读数:700 标签: weui下拉框 更多

个人分类: 技术类文章

版权声明:著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。 https://blog.csdn.net/a1024271896/article/details/81476768

weui相关问题

页面代码:

 

  •  

    样式:

     
    1. .dly_select{

    2. width:calc(80% - 0.5% );

    3. height:2rem;

    4. border:1px solid #1AAD19;

    5. margin:0.65rem auto;

    6. padding-left:10px;

    7. box-sizing:border-box;

    8. font-size:0.8rem;

    9. border-radius:5px;

    10. color:#666;

    11. line-height:2rem;

    12. }

    13.  
    14. .dly_select{

    15. background: transparent;

    16. background: url(${pageContext.request.contextPath}/resources/hit/images/app/kscx/icon_xiala.png) no-repeat;

    17. background-position: 95% center;

    18. background-size:0.8rem 0.5rem;

    19. line-height:2rem;

    20. color:#666;

    21. }

    给下拉框赋值的方法:

     

    //weui的身份类别下拉框赋值

     
    1. $.ajax({

    2. url : "${pageContext.request.contextPath}/fwdt/dengluye/listSflb",

    3. type : "GET",

    4. contentType : "application/json",

    5. success: function(result){

    6. result = JSON.parse(result).module;

    7. // console.log(result)

    8. var v_arry = [];

    9. var arryszqx = [];

    10. arryszqx.push(result[0].lbdm);

    11. $("#all_sflb").text(result[0].lbmc);

    12. $("#all_sflb").attr("data-action",result[0].lbdm);

    13. for(var i=0;i

    14. var v_data = {

    15. label : result[i].lbmc,

    16. value : result[i].lbdm

    17. }

    18. v_arry.push(v_data);

    19. $("#search_xq").click(function(){

    20. weui.picker(v_arry, {

    21. defaultValue: arryszqx,

    22. onChange: function (result) {

    23. $("#all_sflb").text(result[0].label);

    24. $("#all_sflb").attr("data-action",result[0].value);

    25. },

    26. onConfirm: function (result) {

    27. $("#all_sflb").text(result[0].label);

    28. $("#all_sflb").attr("data-action",result[0].value);

    29. },

    30. id: 'search_xqpicker'

    31.  
    32. });

    33. });

    34. }

    35. },

    36. });

    取出weui下拉列表的值的方法:

    //获取下拉列表中的身份类别的id

    var lbdm = $("#all_sflb").attr("data-action");

     

    页面:

     

    转自https://blog.csdn.net/a1024271896/article/details/81476768

    你可能感兴趣的:(weui)