Socket
Book a DemoInstallSign in
Socket

element-ui-area

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

element-ui-area

An area component bases on Vue and ElementUI

1.0.6
latest
npmnpm
Version published
Weekly downloads
7
600%
Maintainers
1
Weekly downloads
 
Created
Source

element-ui-area

基于Vue和ElementUI的中国行政区划选择器

安装

npm install element-ui-area -S

使用方式

项目依赖于Element-UI,您需要先进行引入

引入

import AreaComponent from 'element-ui-area'
Vue.use(AreaComponent, {})

// or
import {Cascader, Select} from 'element-ui-area'
Vue.use(Cascader, {})
Vue.use(Select, {})

配置项

属性类型说明默认值
dataSourceObject数据源-

使用

Cascader

<template>
    <area-cascader v-model="value" :level="3" @change="onChange"/>
</template>
<script>
export default {
    data () {
        return {
            value: []
        }
    },
    methods: {
        onChange (val, text) {
            console.log(val)
            console.log(text) // 地区中文
        }
    }
}
</script>

Select

<template>
    <div style="width:600px;margin:10px auto;">
      <area-select v-model="value" :level="1"/>
      <area-select v-model="value1" :level="2"/>
      <area-select v-model="value2" :level="3"/>
    </div>
</template>
<script>
export default {
    data () {
        return {
            value: [],
            value1: [],
            value2: []
        }
    }
}
</script>

配置项

area-cascader

属性类型说明默认值
valueString绑定值[ ]
levelNumber层级,由于数据原因,目前最多只支持三级3
disabledBoolean是否禁用false
sizeString尺寸small
noMatchTextString无匹配项时展现的文字无匹配数据
noDataTextString无数据时展现的文字无数据
clearableBoolean是否支持清空true
placeholderString占位符请选择地区
immediateBoolean是否立即触发change事件true
dataSourceObject数据源6位短编码行政区划

area-select

属性类型说明默认值
valueString绑定值[ ]
levelNumber层级,由于数据原因,目前最多只支持三级3
disabledBoolean是否禁用false
sizeString尺寸small
gutternumber间距10
noMatchTextString无匹配项时展现的文字无匹配数据
noDataTextString无数据时展现的文字无数据
clearableBoolean是否支持清空true
placeholderArray占位符['请选择省', '请选择市', '请选择区县', '请选择街道']
filterableBoolean是否支持搜索false
immediateBoolean是否立即触发change事件true
dataSourceObject数据源6位短编码行政区划

事件

名称说明参数
change选中值改变事件,初始化时会触发一次改变后的值, 中文名称
blur失去焦点事件对象
focus聚焦事件对象

数据源格式范例

{
	"86": {
		"110000": "北京市",
	},
	"110000": {
		"110100": "市辖区"
	},
	"110100": {
		"110101": "东城区",
		"110102": "西城区",
		"110105": "朝阳区",
		"110106": "丰台区",
		"110107": "石景山区",
		"110108": "海淀区",
		"110109": "门头沟区",
		"110111": "房山区",
		"110112": "通州区",
		"110113": "顺义区",
		"110114": "昌平区",
		"110115": "大兴区",
		"110116": "怀柔区",
		"110117": "平谷区",
		"110118": "密云区",
		"110119": "延庆区"
    }
}

FAQs

Package last updated on 09 Jul 2020

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.