Socket
Socket
Sign inDemoInstall

regional-selection

Package Overview
Dependencies
10
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    regional-selection

Vue城市选择组件。


Version published
Weekly downloads
1
Maintainers
1
Install size
3.20 MB
Created
Weekly downloads
 

Readme

Source

pc端Vue城市地区选择组件。

基本功能:

  1. 支持全选、反选以及全部清空。
  2. 支持按拼音筛选。
  3. 勾选省份将会勾选省份下所有城市。
  4. 传入数据,返回数据可灵活处理。
  5. 可根据自己实际业务扩展。

Image text

安装插件方式

npm install regional-selection --save
# 或者
yarn add regional-selection

用法

组件引入:


// import包
import regionalSelection from 'regional-selection'

// use
Vue.use(regionalSelection)

使用:

<regional-selection
  v-model="pickCity"
  @on-pick-city="pickedCity = $event"
>
</regional-selection>

<!-- 省略代码 -->
data () {
  return {
    pickCity: []
  }
}

选择返回的数据:

[{
  "cityIndex": 37,
  "id": "210200",
  "name": "大连市",
  "pinYin": "dalian",
  "shortName": "大连"
}, {
  "cityIndex": 41,
  "id": "210600",
  "name": "丹东市",
  "pinYin": "dadong",
  "shortName": "丹东"
}]

属性

参数说明类型默认值
placeholder-String选择城市
showCloseBtn是否显示input框清空按钮Booleantrue
clickModal是否点击遮罩关闭弹层Booleantrue
inputClass替换预设的输入框样式Stringnull
widthinput框宽度Number200

事件

事件说明参数
on-pick-city城市选择的回调事件勾选的城市

本地运行

安装:npm install
运行:npm run dev

如果项目npm安装完毕后无法运行,找到index.html文件里面这段注释即可。

<script src="https://cdn.bootcss.com/vue/2.5.18-beta.0/vue.min.js"></script>

Keywords

FAQs

Last updated on 03 Sep 2019

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc