Applet region selector

Recently, I spent two weeks in a hurry to launch a small program, "CP vs. collision". After the launch, the data is OK. I feel that the small program has a good trial and error effect. It's just a slow day today, so sort out what you've written in this period.
The background is that you can't click and select after using the region selection tool on the official API. The error is that the region value is not pushed in, and not all machines have problems.

Official documents in Here
The usage is like this

 <view class="section__title">Province city selector</view>
 <picker mode="region" bindchange="bindRegionChange" value="{{region}}" custom-item="{{customItem}}">
   <view class="picker">
     //Current selection:{{region[0]}}{{region[1]}}{{region[2]}}
   </view>
 </picker>
Page({
    data: {
        region: ['Guangdong Province', 'Guangzhou City', 'Haizhu District'],
        customItem: 'whole'
    },
    bindRegionChange: function (e) {
      console.log('picker Send selection change, carrying value is', e.detail.value)
      this.setData({
        region: e.detail.value
      })
    }
    ...
})

Because we only need provinces and cities, and finally I solve it like this:
1. Change area selector to multiple selector
2. I collated the data of provinces and cities:

var citys = {
  'Beijing': ['Municipal District'],
  'Tianjin': ['Municipal District'],
  'Hebei Province': ['Shijiazhuang City ', 'Tangshan City', 'Qinhuangdao City', 'Handan City', 'Xingtai City', 'Baoding City', 'Zhangjiakou City', 'Chengde City', 'Cangzhou City', 'Langfang City', 'Hengshui City', 'Administrative divisions of provinces and counties directly under the central government'],
  'Shanxi Province': ['Taiyuan City', 'Datong City', 'Yangquan City', 'Changzhi City', 'Jincheng City', 'Shuozhou City', 'Jinzhong ', 'Yuncheng City', 'xinzhou ', 'Linfen City', 'Luliang City'],
  'Inner Mongolia Autonomous Region': ['Hohhot City', 'Baotou City', 'Wuhai City', 'Chifeng City', 'Tongliao City', 'ordos city ', 'Hulun Buir', 'Bayannur City', 'Ulanqab City', 'Xing'an League', 'Xilingol League', 'alxa league '],
  'Liaoning Province': ['Shenyang', 'Dalian ', 'Anshan City', 'Fushun City', 'Benxi City', 'Dandong City', 'Jinzhou City', 'Yingkou City', 'Fuxin City', 'Liaoyang City', 'Panjin City', 'Tieling City', 'Chaoyang City', 'Huludao City'],
  'Jilin Province': ['Changchun City', 'Jilin City', 'Siping City', 'Liaoyuan City', 'Tonghua City', 'Baishan City', 'Songyuan City', 'Baicheng City', 'Yanbian Korean Autonomous Prefecture'],
  'Heilongjiang Province': ['Harbin City', 'Qiqihar City', 'Jixi City', 'Hegang City', 'Shuangyashan City', 'Daqing City', 'Yichun City', 'Jiamusi City', 'Qitaihe City', 'Mudanjiang City', 'Heihe City', 'Suihua City', 'Daxinganling area'],
  'Shanghai': ['Municipal District'],
  'Jiangsu Province': ['Nanjing City', 'Wuxi City', 'Xuzhou City', 'Changzhou City', 'Suzhou', 'Nantong City', 'Lianyungang City ', 'Huai'an City', 'yancheng ', 'Yangzhou City', 'Zhenjiang City', 'Taizhou City', 'Suqian City'],
  'Zhejiang Province': ['Hangzhou', 'Ningbo City', 'Wenzhou City', 'Jiaxing City', 'Huzhou City', 'Shaoxing City', 'Jinhua City', 'Quzhou City', 'Zhoushan City', 'Taizhou City', 'Lishui City'],
  'Anhui Province': ['Hefei City', 'Wuhu City', 'Bengbu City', 'Huainan City', 'Ma'anshan City', 'Huaibei City', 'tongling ', 'Anqing City', 'Huangshan City', 'Chuzhou City', 'Fuyang City', 'Suzhou City', 'Lu'an City', 'Bozhou City', 'chizhou ', 'Xuancheng City'],
  'Fujian Province': ['Fuzhou City', 'Xiamen', 'Putian City', 'Sanming City', 'Quanzhou City', 'Zhangzhou City', 'Nanping City', 'Longyan City', 'Ningde City'],
  'Jiangxi Province': ['Nanchang City', 'Jingdezhen City', 'Pingxiang City', 'Jiujiang City', 'Xinyu City', 'Yingtan City', 'Ganzhou City', 'Ji'an City', 'Yichun City', 'Fuzhou City', 'Shangrao City'],
  'Shandong Province': ['Ji'nan', 'Qingdao', 'Zibo City', 'Zaozhuang City', 'Dongying City', 'Yantai City', 'Weifang City', 'Jining City', 'Taian City', 'Weihai City', 'Rizhao City', 'Laiwu ', 'Linyi City', 'Dezhou City', 'LiaoCheng ', 'Binzhou City', 'HeZe '],
  'Henan Province': ['Zhengzhou City', 'Kaifeng City', 'Luoyang City', 'Pingdingshan City', 'Anyang City', 'Hebi City', 'Xinxiang City', 'Jiaozuo City', 'Puyang City', 'Xuchang City', 'Luohe City', 'Sanmenxia City', 'Nanyang City', 'Shangqiu City', 'Xinyang City', 'Zhoukou ', 'Zhumadian City', 'Administrative divisions of provinces and counties directly under the central government'],
  'Hubei province': ['Wuhan', 'Huangshi City', 'Shiyan City', 'Yichang City', 'Xiangyang ', 'Ezhou City', 'Jingmen City', 'Xiaogan City', 'jingzhou ', 'Huanggang City', 'Xianning ', 'suizhou ', 'Enshi Tujia and Miao Autonomous Prefecture ', 'Administrative divisions of provinces and counties directly under the central government'],
  'Hunan Province': ['Changsha City', 'Zhuzhou City', 'Xiangtan City', 'Hengyang City', 'Shaoyang City', 'Yueyang City', 'Changde City', 'Zhangjiajie City', 'Yiyang City', 'Chenzhou City', 'Yongzhou City', 'huaihua ', 'Loudi City', 'Xiangxi Tujia and Miao Autonomous Prefecture'],
  'Guangdong Province': ['Guangzhou City', 'Shaoguan City', 'Shenzhen City', 'Zhuhai City', 'Shantou City', 'Foshan City', 'Jiangmen City', 'Zhanjiang City', 'Maoming City', 'Zhaoqing City', 'Huizhou City', 'Meizhou City', 'Shanwei City', 'Heyuan City', 'Yangjiang City', 'Qingyuan City', 'Dongguan City', 'zhongshan ', 'Chaozhou City', 'Jieyang City', 'Yunfu City'],
  'Guangxi Zhuang Autonomous Region': ['Nanning City', 'Liuzhou City', 'Guilin', 'Wuzhou City', 'Beihai City', 'Fangchenggang City', 'Qinzhou City', 'Guigang City', 'Yulin City', 'Baise City', 'Hezhou ', 'Hechi City', 'Laibin City', 'Chongzuo City'],
  'Hainan ': ['Haikou City', 'The city of Sanya', 'Sansha ', 'Danzhou City', 'Administrative divisions of provinces and counties directly under the central government'],
  'Chongqing City': ['Municipal District', 'county'],
  'Sichuan Province': ['Chengdu', 'Zigong City', 'Panzhihua City', 'Luzhou City', 'deyang ', 'Mianyang City', 'Guangyuan City', 'Suining City', 'Neijiang City', 'Leshan City', 'Nanchong City', 'Meishan City', 'Yibin City', 'Guang'an City', 'Dazhou City', 'Ya'an City', 'Bazhong City', 'Ziyang City', 'Aba Tibetan and Qiang Autonomous Prefecture', 'Ganzi Tibetan Autonomous Prefecture', 'Liangshan Yi Autonomous Prefecture'],
  'Guizhou Province': ['Guiyang City', 'liupanshui city ', 'Zunyi City', 'Anshun City', 'Bijie City', 'Tongren ', 'Qianxinan Buyei and Miao Autonomous Prefecture ', 'Qiandongnan Miao and Dong Autonomous Prefecture', 'Qiannan Buyi and Miao Autonomous Prefecture'],
  'Yunnan Province': ['Kunming', 'Qujing ', 'YuXi ', 'baoshan ', 'zhaotong ', 'lijiang ', 'Pu'er City', 'Lincang City', 'Chuxiong Yi Autonomous Prefecture', 'Honghe Hani and Yi Autonomous Prefecture', 'Wenshan Zhuang and Miao Autonomous Prefecture', 'Xishuangbanna Dai Autonomous Prefecture', 'Dali Bai Autonomous Prefecture', 'Dehong Dai Jingpo Autonomous Prefecture', 'Nujiang Lisu Autonomous Prefecture', 'Diqing Tibetan Autonomous Prefecture'],
  'Tibet Autonomous Region': ['Lhasa', 'Shigatse City', 'Changdu', 'Linzhi City', 'Shannan City', 'Naqu District', 'Ali Region'],
  'Shaanxi Province': ['Xi'an', 'Tongchuan City', 'Baoji City', 'Xianyang City', 'Weinan City', 'Yan'an City', 'Hanzhong City', 'Yulin City', 'Ankang City', 'shangluo '],
  'Gansu Province': ['Lanzhou City', 'Jiayuguan City', 'Jinchang ', 'Silver market', 'Tianshui City', 'Wuwei City', 'Zhangye City', 'Pingliang ', 'jiuquan ', 'qingyang ', 'dingxi ', 'Longnan City', 'Linxia Hui Autonomous Prefecture', 'Gannan Tibetan Autonomous Prefecture'],
  'Qinghai Province': ['Xining City', 'Haidong City', 'Haibei Tibetan Autonomous Prefecture', 'Huangnan Tibetan Autonomous Prefecture', 'Hainan Tibetan Autonomous Prefecture', 'Golog Tibetan Autonomous Prefecture', 'Yushu Tibetan Autonomous Prefecture', 'Haixi Mongol and Tibetan Autonomous Prefecture '],
  'Ningxia Hui Autonomous Region': ['Yinchuan City', 'Shizuishan City', 'Wuzhong City', 'Guyuan City', 'Zhongwei City'],
  'Xinjiang Uygur Autonomous Region': ['Urumqi', 'Karamay City', 'Turpan City', 'Hami City', 'Changji Hui Autonomous Prefecture', 'Bortala Mongolian Autonomous Prefecture', 'Bayingolin Mongolian Autonomous Prefecture', 'Aksu Region', 'Kizilsu Kirgiz Autonomous Prefecture', 'Kashi Region', 'Hotan District', 'Ili Kazak Autonomous Prefecture', 'Tacheng District', 'Altay Region', 'Administrative divisions of autonomous regions directly under the central government at the county level'],
  'Taiwan Province': ['Taiwan'],
  'Hong Kong Special Administrative Region': ['Hong Kong'],
  'Macao SAR': ['Macao']
}

module.exports = citys;

Posted on Sun, 03 May 2020 07:58:04 -0400 by Dr Evil