大神,我在用vue.js做移动端的三级联动运用了你的插件,可是我添加动态数据的时候,显示不了,想问下怎么解决啊,
var selector = $('#city-picker-selector').cityPicker({ dataJson: cityData, renderMode: true, search: false, autoSelected: false, code: 'cityCode' }); new Vue({ el: '#saveAddress', data: { //判断编辑还是新建问题 name: '', tell: '', sheng: '', address: '', userProvinceId: '', userCityId: '', userDistrictId: '' }, mounted: function mounted() { this.bianji(); }, methods: { bianji: function() { _this = this var id = $_GET['editid']; $.ajax({ type: "POST", data: { addressid: id }, url: "../api/weixin/addressbj", dataType: "json", timeout: 7000, success: function(slute) { _this.name = slute.lxren; _this.tell = slute.tel; a = slute.s1; b = slute.s2; c = slute.s3; _this.address = slute.address; selector.setCityVal('\'' + a.replace("“", "") + ',' + b.replace("“", "") + ',' + c.replace("“", "") + '\''); } }); },
大神,怎么把从后台获取的值,设置上去,设置val没用啊
大神,怎么把citycode取出来
我
select.setCityVal([{ 'id': "110000", 'name': "北京市" }, { 'id': "110000", 'name': "北京市" }, { 'id': "110101", 'name': "东城区" }]);
不管用用啊
发现了一个问题默认初始值第一个不管用
大神你好,请问一下v1.1.4增加getCityVal() 怎么获得值啊?我怎么获取不到啊,可不可以举个列子在评论上,谢谢了
var select = $('.city-picker-select').cityPicker({ dataJson: cityData, renderMode: false, autoSelected: true }); //设置城市 select.setCityVal([{ 'id': '140000', 'name': '山西省' }, { 'id': '140100', 'name': '太原市' }, { 'id': '140105', 'name': '小店区' }]); console.log(select.getCityVal())
var city = $('#city-picker-search').cityPicker({ dataJson: cityData, renderMode: true, search: false, autoSelected: false, keyboard: false }); // 省份选择的回调 $('#city-picker-search').on('choose-province.citypicker', function(event, target, values) { localStorage.setItem("p", event, target, values); }); var p = localStorage.getItem("p"); console.log(p); // 城市选择的回调 $('#city-picker-search').on('choose-city.citypicker', function(event, target, values) { localStorage.setItem("c", event, target, values); }); var c = localStorage.getItem("p"); console.log(c);
怎么设置默认值呢