npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

element-ui-area

v1.0.6

Published

An area component bases on Vue and ElementUI

Downloads

6

Readme

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, {})

配置项

| 属性 | 类型 | 说明 | 默认值 | | :------ | :------ | :------ | --- | | dataSource | Object | 数据源 | - |

使用

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

| 属性 | 类型 | 说明 | 默认值 | | :------ | :------ | :------ | --- | | value | String | 绑定值 | [ ] | | level | Number | 层级,由于数据原因,目前最多只支持三级 | 3 | | disabled | Boolean | 是否禁用 | false | | size | String | 尺寸 | small | | noMatchText | String | 无匹配项时展现的文字 | 无匹配数据 | | noDataText | String | 无数据时展现的文字 | 无数据 | | clearable | Boolean | 是否支持清空 | true | | placeholder | String | 占位符 | 请选择地区 | | immediate | Boolean | 是否立即触发change事件 | true | | dataSource | Object | 数据源 | 6位短编码行政区划 |

area-select

| 属性 | 类型 | 说明 | 默认值 | | :------ | :------ | :------ | --- | | value | String | 绑定值 | [ ] | | level | Number | 层级,由于数据原因,目前最多只支持三级 | 3 | | disabled | Boolean | 是否禁用 | false | | size | String | 尺寸 | small | | gutter | number | 间距 | 10 | | noMatchText | String | 无匹配项时展现的文字 | 无匹配数据 | | noDataText | String | 无数据时展现的文字 | 无数据 | | clearable | Boolean | 是否支持清空 | true | | placeholder | Array | 占位符 | ['请选择省', '请选择市', '请选择区县', '请选择街道'] | |filterable | Boolean | 是否支持搜索 | false | | immediate | Boolean | 是否立即触发change事件 | true | | dataSource | Object | 数据源 | 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": "延庆区"
    }
}