Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

v-region

TerryZ466MIT3.5.0TypeScript support: included

Provide Chinese administrative division data selection

front-end, web, vue, region, city, town, area, selector

readme

v-region

CircleCI code coverage npm version JavaScript Style Guide npm download

简洁易用的的中国行政区划选择器,可选择 “省/直辖市”、“市”、“区/县”、“乡/镇/街道” 4 级行政区域 A simple region cascade selector for vue, provide 4 levels Chinese administrative division data

行政区划数据源更新日期:2025年10月11日

如果你的项目正在使用 vue 2.x 版本,请使用 v-region 2.x 版本

文档与实例(Documentation and Examples)

更多的文档与实例请浏览(Explorer on)

功能特性(Features)

  • “省/直辖市”、“市”、“区/县”、“乡/镇/街道” 4 级行政区域选择
  • 丰富的使用形式,提供了
    • 下拉列表级联模式 RegionSelects
    • 分组模式 RegionGroup
    • 多列竖排模式 RegionColumns
    • 城市选择器模式 RegionCityPicker
    • 纯文本模式 RegionText
  • 分组 Group 与多列 Columns 模式可直接使用核心模块 RegionGroup 与 RegionColumns,结合其他交互形式可自由组合更多种多样的使用形式,例如结合抽屉 Drawer、气泡 Popover 或对话框 Dialog 使用
  • 部分模式允许使用作用域插槽 Scoped Slots 的方式自定义触发对象,让组件更灵活、方便地整合在业务场景中
  • 除省级以外,其它行政区域级别可通过参数进行切换
  • 支持 “直辖市”、“特别行政区” 、“直筒子市” 和 “省辖县/省辖县级市” 等特殊行政区域的数据和内容处理
  • 3 级与 4 级行政级别(数据量较大)组件独立拆分使用,按需使用

安装插件(Installation)

https://nodei.co/npm/v-region.png?downloads=true&downloadRank=true&stars=true

# npm
npm i v-region
# yarn
yarn add v-region
# pnpm
pnpm add v-region

在项目里全局安装所有功能模块

import { createApp } from 'vue'
import App from './app.vue'
import Region from 'v-region'
// 全局安装以下模块
// RegionGroup
// RegionSelects
// RegionColumns
// RegionCityPicker
// RegionText
createApp(App).use(Region).mount('#app')

自定义全局安装模块

import { RegionSelects } from 'v-region'

const app = createApp(App)
app.component('v-region-selects', RegionSelects)

在页面中使用(Usage)

<template>
  <RegionSelects
    v-model="region"
    @change="change"
  />
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { RegionSelects } from 'v-region'
import type { RegionValues, RegionModel } from 'v-region'

const region = ref<RegionValues>({
  province: '350000',
  city: '350100',
  area: '350104',
  town: '350104008'
})
function change (data: RegionModel): void {
  console.log(data)
}
</script>

数据源(Data Source)

Region data come from repo: mumuy/data_location

原仓库数据说明 省、市、区数据来自于民政局、国务院公告、国家统计局,确保及时更新和权威; 街道(镇、乡)数据由于数据庞大,各地各级之前公函较多,无法保证及时有效(最新数据2016年7月31日); 数据是以行政区为单位的行政区划数据。行政管理区与行政区存在重合,不予收录; (行政管理区通常包含:***经济特区/经济开发区/高新区/新区/工业区;亦有部分行政管理区升为行政区,需加以区分)

Star数趋势(Stargazers over time)

Stargazers over time

Activity

Alt

License

FOSSA Status

changelog

Changelog

Please refer to CHANGELOG-CN for Chinese changelog

3.5.0 (2025-10-11)

Features

  • Upgraded v-dropdown to version v3.5.1
  • Administrative division data updated to 2025-10-09
  • Added autoSelectFirst prop to automatically select the first item for all subordinate administrative levels when selecting a level. This applies to the Selects, Group, and Columns components
  • Automatically select the item when only a single subordinate level is available, such as for municipalities, direct-controlled sub-cities, and provincial counties
  • Added the separator prop to set the separator between level text

Refactor

  • Core Data uses queue processing

3.4.1 (2025-03-09)

Features

  • Upgraded v-dropdown to version v3.3.0

3.4.0 (2025-03-04)

Features

  • Upgraded v-dropdown to version v3.2.0
  • Administrative division data updated to 2025-02-26
  • Added RegionDropdown component to provide dropdown list capabilities for core module components like Group, Columns, and CityPicker
  • Component removals:
    • RegionGroupCore
    • RegionFullGroupCore
    • RegionColumnsCore
    • RegionFullColumnsCore
  • Added names v-model property to RegionSelects, RegionGroup, RegionColumns, and RegionCityPicker components for returning selected administrative division names
  • Removed adjust event from all core module components

3.3.0 (2024-09-26)

Features

  • RegionCityPicker component add remove all button
  • Some components add the function of scrolling and positioning selected items

3.2.1 (2024-09-23)

Features

  • dts adds the description of the output data of scoped slots slots
  • Optimize the style of group clear icon

Bug Fixes

  • There is a probability that the initialization of the selected state at the town level will fail

3.2.0 (2024-09-21)

Features

  • Optimize performance and reduce unnecessary rendering and data loading
  • The original components will be used as level 3 administrative level components, and the new Full series of level 4 administrative level components will be added to use them on demand to avoid the components being too large when level 4 administrative level is not needed
  • Removed reset api. When you need to clear the selection, please set the value of v-model binding to an object with undefined at all levels

3.1.0 (2024-07-10)

Features

  • RegionText adds data change response
  • Update region data source

Bug Fixes

  • RegionSelects Empty list does not display placeholder text

3.0.0 (2023-09-24)

Features

  • Refactor the layout structure and style of RegionCityPicker

3.0.0-beta.4 (2023-09-19)

Features

  • Upgrade v-dropdown to v3.0.0
  • Refactor the RegionCityPicker and RegionSelects structures to make more functions testable

Bug Fixes

  • Update .d.ts document

3.0.0-beta.3 (2023-03-04)

Bug Fixes

  • Fix data loading of town level list in Group mode has a probability error

3.0.0-beta.2 (2023-03-04)

Bug Fixes

  • Increase the judgment of window object to solve the packaging failure in non-browser environment

3.0.0-beta.1 (2023-03-02)

Features

  • Refactor v-region with vue3 composition api
  • Change module bundler library from webpack to vite
  • Change unit test library from mocha to vitest
  • RegionGroupCore and RegionColumnsCore core modules add complete events in response to all available region level selection completion
  • The RegionGroup, RegionColumns and RegionCityPicker modules add visible-change events in response to the open/close state of the dropdown layer
  • Remove the search module from the Group mode