JSPM

wx-picker-region-addcode

1.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q8805F
  • License ISC

微信小程序中的地址选择器,结果市一个省市区的数组,在实际业务用,区划代码市和后台交互的识别码,需要省市区的区划编号,这个小模块,输入微信选择的结果,返回一个包含区划代码的对象

Package Exports

  • wx-picker-region-addcode

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (wx-picker-region-addcode) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

wx-picker-region-addcode

功能:微信小程序picker组件 地区选择后的数据添加上中国的行政区划代码。

微信小程序 picker-region 返回的地址是一个数组,如['陕西省','西安市','雁塔区'],这个数据太简单,和后台交互,需要省市区的区划代码。 包的作用是 =>[] => {} 输入微信小程序选择的地址数组,得到一个地址的详情信息对象,行政区划的数据参考这个:中华人民共和国行政区划代码

使用

# 使用
 npm install wx-picker-region-addcode -S
 const addCode = require('wx-picker-region-addcode');

# test
 const mock =  ['陕西省', '西安市', '雁塔区'];
 const result = addCode(mock);
# result => { province: '陕西省',
#   province_id: '610000',
#   city: '西安市',
#   city_id: '610100',
#   district: '雁塔区',
#   district_id: '610113',
#   address: '陕西省西安市雁塔区' }