模拟城市-不自动选择第一项/无搜索/四级城市

code
var selector1 = $('#city-picker-selector1').cityPicker({
					dataJson: cityData,
					renderMode: true,
					search: false,
					autoSelected: false,
					code: 'cityCode',
					level: 4,
					onChoiceEnd: function() {
						console.log(this.values)
					}
				});

				// 设置城市
				selector1.setCityVal('广东省, 广州市, 天河区, 天园街道');

				// 省份选择的回调
				$('#city-picker-selector1').on('choose-province.citypicker', function(event, tagert, values) {
					console.log(values);
				});
	
				// 城市选择的回调
				$('#city-picker-selector1').on('choose-city.citypicker', function(event, tagert, values) {
					console.log(values);
				});
	
				// 区县选择的回调
				$('#city-picker-selector1').on('choose-district.citypicker', function(event, tagert, values) {
					console.log(values);
				});

				// 街道选择的回调
				$('#city-picker-selector1').on('choose-street.citypicker', function(event, tagert, values) {
					console.log(values);
				});

模拟城市-自动选择第一项/无搜索/三级城市

code
var selector2 = $('#city-picker-selector2').cityPicker({
					dataJson: cityData,
					renderMode: true,
					search: false,
					autoSelected: true,
					code: 'cityCode',
					level: 3,
					onChoiceEnd: function() {
						console.log(this.values)
					}
				});
	
				// 设置城市
				selector2.setCityVal('广东省, 广州市, 天河区');

模拟城市-联动/搜索/键盘操作/二级城市

code
var selector3 = $('#city-picker-search').cityPicker({
					dataJson: cityData,
					renderMode: true,
					search: true,
					autoSelected: true,
					keyboard: true,
					level: 2,
					onChoiceEnd: function() {
						console.log(this.values)
					}
				});

模拟城市-联动/搜索/键盘操作/一级城市

code
var selector4 = $('#city-picker-search2').cityPicker({
					dataJson: cityData,
					renderMode: true,
					search: true,
					autoSelected: true,
					keyboard: true,
					level: 1,
					onChoiceEnd: function() {
						console.log(this.values)
					}
				});

原生城市-联动

code
var select = $('.city-picker-select').cityPicker({
					dataJson: cityData,
					renderMode: false,
					autoSelected: true,
					level: 4,
					onChoiceEnd: function() {
						console.log(this.values)
					}
				});
	
				// 设置城市
				select.setCityVal('山西省, 太原市, 小店区, 坞城街道');