Vue Area Linkage Picker

5.1.0 · active · verified Tue Apr 21

vue-area-linkage is a Vue.js 2 component library providing province, city, and district linkage selection pickers. It offers both `AreaSelect` (dropdowns) and `AreaCascader` (cascading menu) components for geographical area selection within China. The current stable version is 5.1.0, and releases appear to be driven by feature enhancements, bug fixes, and updates to its underlying `area-data` dependency, without a fixed cadence. A key differentiator since v5.0.0 is that it no longer bundles area data internally, requiring users to explicitly pass `area-data` through the `data` prop, which significantly reduces bundle size and allows for more flexible, on-demand data loading. Earlier versions (pre-v4) supported street-level selection, which has since been removed.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to register and use both `AreaSelect` and `AreaCascader` components with explicitly imported geographical data (`pca` and `pcaa`) as required by v5+ of the library. It shows basic province-city and province-city-area selection, along with a more advanced `AreaSelect` configuration.

import Vue from 'vue';
import { pca, pcaa } from 'area-data';
import 'vue-area-linkage/dist/index.css';
import VueAreaLinkage from 'vue-area-linkage';

Vue.use(VueAreaLinkage);

export default {
  data() {
    return {
      selectedProvinceCity: [],
      selectedProvinceCityArea: []
    };
  },
  methods: {
    handleSelectChange(value) {
      console.log('AreaSelect value changed:', value);
    },
    handleCascaderChange(value) {
      console.log('AreaCascader value changed:', value);
    }
  },
  template: `
    <div>
      <h2>Province-City Selection</h2>
      <area-select v-model="selectedProvinceCity" :data="pca" @change="handleSelectChange"></area-select>
      <p>Selected: {{ selectedProvinceCity }}</p>

      <h2>Province-City-Area Selection</h2>
      <area-cascader v-model="selectedProvinceCityArea" :data="pcaa" @change="handleCascaderChange"></area-cascader>
      <p>Selected: {{ selectedProvinceCityArea }}</p>

      <h2>Advanced AreaSelect (Level 2, All type)</h2>
      <area-select type='all' :level='2' v-model="selectedProvinceCityArea" :data="pcaa"></area-select>
      <p>Selected (Advanced): {{ selectedProvinceCityArea }}</p>
    </div>
  `
};

view raw JSON →