city-picker icon indicating copy to clipboard operation
city-picker copied to clipboard

请问一下, 有不有根据code能直接取出对应的值?

Open ghost opened this issue 8 years ago • 1 comments

请问一下, 有不有根据code能直接取出对应的值?

ghost avatar Sep 25 '16 01:09 ghost

修改city-picker.js 找到getCode这一行,大概在358行左右, 在下面添加方法: getValue: function (count) { var text = ''; this.$dropdown.find('.city-select') .each(function () { if($(this).hasClass(count)){ var item = $(this).data('item'); text = item.address; return text; } }); return text; },

调用: 省:$("#prov").val($("#city-picker").data("citypicker").getValue("province")); 市:$("#city").val($("#city-picker").data("citypicker").getValue("city")); 县:$("#county").val($("#city-picker").data("citypicker").getValue("district"));

lovedreamland avatar Sep 26 '16 10:09 lovedreamland