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

大神你好,用到ajax请求数据来初始化地址的问题,求指导

Open jiusannian opened this issue 7 years ago • 1 comments

我请求完数据将省市填上去,但是在页面加载的时候dom已被初始化,导致city-picker.js里面

if (!data) { if (/destroy/.test(option)) { return; } options = $.extend({}, $this.data(), $.isPlainObject(option) && option); $this.data(NAMESPACE, (data = new CityPicker(this, options))); }

data已经有对象,所以不执行设置。 异步请求如下:

api.post("account", "single", { key: "123" }, function (result) { $("#city-picker").citypicker({ province: result.returnValue.province, city: result.returnValue.city }); });

jiusannian avatar Jul 25 '17 07:07 jiusannian

我把input中的data-toggle="city-picker"去掉就解决了,没有这个就不会被初始化

jiusannian avatar Jul 25 '17 07:07 jiusannian