mui 地区弹框 获取数据和设置

var province_id, province_name, city_id, city_name, area_id, area_name

        var _getParam = function (obj, param) {
            return obj[param] || '';
        };

        provincecityarea();
        var cityPicker3 = new mui.PopPicker({
            layer: 3
        });
        function provincecityarea() {
            $.ajax({
                type: "get",
                dataType: "json",
                url: '/signup/signup/getprovincecityarea',
                data: {},
                cache: false,
                async: true,
                timeout: 0,
                beforeSend: function (xhr) {
                },
                success: function (result) {
                    cityPicker3.setData(result.data);
                },
                error: function (xhr, type, errorThrown) {
                },
                complete: function (xhr, status) {
                }
            });
        }

        // var provinceID, provinceName, cityID, cityName, areaID, areaName;
        var jxPicker = document.getElementById("showCityPicker3");
        jxPicker.addEventListener('tap', function () {
            cityPicker3.show(function (items) {
                province_id = _getParam(items[0], 'value')
                province_name = _getParam(items[0], 'text')
                city_id = _getParam(items[1], 'value')
                city_name = _getParam(items[1], 'text')
                area_id = _getParam(items[2], 'value')
                area_name = _getParam(items[2], 'text')
                jxPicker.innerText = province_name + " " + city_name + " " + area_name;
                jxPicker.style.color = "#000";
                jxPicker.style.fontSize = "14px";
            });
        });

你可能感兴趣的:(mui 地区弹框 获取数据和设置)