🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

wx-city-picker

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wx-city-picker

小程序城市选择器, 省市区三级联动

latest
Source
npmnpm
Version
0.0.6
Version published
Weekly downloads
12
1100%
Maintainers
1
Weekly downloads
 
Created
Source

wx-city-picker

小程序城市选择器, 省市区三级联动

小程序城市选择器

配置

参数

选项名类型是否必填默认值描述
modeNumberfalse1选择器类型:1-省市区选择,2-省市选择
codesArrayfalse[0, 0, 0]省市(区)的编码数组,如:[110000, 110100, 110101]
dataArraytrue省市区数据,省市区数据示例:pca.js ,省市数据示例:pc.js
childkeyStringfalse'children'数据中子数组键名
idkeyStringfalse'id'省市区编码键名
namekeyStringfalse'name'省市区名称键名

事件

选项名类型是否必填描述
selectFunctiontrue返回选中省市(区)信息

使用

引入

  • npm 引入
npm i -S wx-city-picker
{
  "usingComponents": {
    "city-picker": "/components/wx-city-picker/index"
  }
}
  • 手工下载至项目/components 目录
{
  "usingComponents": {
    "city-picker": "/components/wx-city-picker/index"
  }
}

wxml

<city-picker codes="{{codes}}" data="{{citylist}}"  bind:select="onSelect">
  <view class="input-picker">
    {{city}}
  </view>
</city-picker>

js

import {CityList} from './pca.js';
Page({
  data: {
    codes: [],
    city: '',
    citylist: CityList
  },
  onSelect(e) {
    this.setData({
      codes: e.detail.code,
      city: e.detail.value
    })
  }

})

其他小程序插件

FAQs

Package last updated on 22 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts