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.
npm install vue-area-linkageVerified import paths — ran on the pinned version, not inferred.
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.
Install `area-data` (`npm i area-data`) and modify your component usage: `<area-select :data="pca"></area-select>`. Also, update your imports: `import { pca, pcaa } from 'area-data';`Review existing usage that might have relied on street-level selection and adjust the `level` prop to 0, 1, or 2 as appropriate. If street data is still required, consider an older version or an alternative library.
Replace `isLinkage` with `disableLinkage` in your `area-select` component definitions. Note that the logic of the property might also be inverted (e.g., `isLinkage="false"` becomes `disableLinkage="true"`).
Always include `import 'vue-area-linkage/dist/index.css';` in your main entry file or component that uses `vue-area-linkage`.
Ensure `element-ui` is explicitly installed and configured if your project still needs it. No direct fix needed for `vue-area-linkage` usage itself, but be aware of style changes.
Install `area-data` (`npm i area-data`) and ensure it's imported and bound to the `:data` prop, e.g., `<area-select :data="pca"></area-select>`.
Globally: `import VueAreaLinkage from 'vue-area-linkage'; Vue.use(VueAreaLinkage);`. Locally: `import { AreaSelect } from 'vue-area-linkage'; components: { AreaSelect }`.Add `import 'vue-area-linkage/dist/index.css';` to your main JavaScript entry file or an appropriate global stylesheet.
This library is for Vue 2 applications only. For Vue 3, you will need to find a different area linkage component or migrate your project to Vue 2 if this component is critical.