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

@cloud-ui/u-region-select.vue

v0.9.0

Published

地区选择器,该组件从 UCascadeSelect 继承,仅填充了中国的行政区数据,其他功能与 UCascadeSelect 相同。

Downloads

12

Readme

URegionSelect 地区选择

UI 组件, 表单控件, 块级展示

该组件从 UCascadeSelect 继承,仅填充了中国的行政区数据,其他功能与 UCascadeSelect 相同。

示例

基本用法

<u-linear-layout direction="vertical">
    <u-region-select></u-region-select>
    <u-region-select value="浙江,杭州,滨江区"></u-region-select>
</u-linear-layout>

双向绑定

使用v-model进行双向绑定。

<template>
    <u-region-select v-model="address"></u-region-select>
</template>
<script>
export default {
    data() {
        return {
            address: '',
        };
    },
};
</script>

Placeholder

<u-region-select :categories="[
    { label: '省', placeholder: '请选择省份' },
    { label: '市', placeholder: '请选择城市' },
    { label: '区', placeholder: '请选择县区' },
]"></u-region-select>

隐藏空列表

<u-region-select hide-empty :categories="[
    { label: '省', placeholder: '请选择省份' },
    { label: '市', placeholder: '请选择城市' },
    { label: '区', placeholder: '请选择县区' },
]"></u-region-select>

API

Props/Attrs

| Prop/Attr | Type | Options | Default | Description | | --------- | ---- | ------- | ------- | ----------- | | data | Array<{ text, value }> | | '数据' | 数据列表 | | value.sync, v-model | any | | | 当前选择的值 | | categories | Array<{ label, key, placeholder }> | | '数据' | 多级分类 | | hide-empty | boolean | | false | 是否隐藏空列表 | | converter | string, object | | 'join' | value 与 values 的转换器。可选值:'join'表示将 values 数组 join 之后变成 value,'join.number'join类似,只是会考虑它为数字的情况。也可以用:修改分隔符,类似 Vue 的指令参数,'last-value'表示以最后一项的值作为 value。也可以传入一个包含 { get, set } 的一个对象 | | field | string | | 'value' | 显示文本字段 | | readonly | boolean | | false | 是否只读 | | disabled | boolean | | false | 是否禁用 |

Events

@input

选择某一项时触发

| Param | Type | Description | | ----- | ---- | ----------- | | $event | any | 选择项的值 | | senderVM | URegionSelect | 发送事件实例 |

@select

选择某一项时触发

| Param | Type | Description | | ----- | ---- | ----------- | | $event.level | number | 选择的层级 | | $event.value | any | 改变后的值 | | $event.values | Array | 改变后每项值的数组 | | $event.item | object | 选择项相关对象 | | $event.itemVM | ListViewItem | 选择项子组件 | | senderVM | URegionSelect | 发送事件实例 |

@change

选择值改变时触发

| Param | Type | Description | | ----- | ---- | ----------- | | $event.value | any | 改变后的值 | | $event.oldValue | any | 旧的值 | | $event.values | Array | 改变后每项值的数组 | | $event.oldValues | Array | 旧的每项值的数组 | | senderVM | URegionSelect | 发送事件实例 |