Skip to content

witCity City Selection Component

witCity is a city selection component based on Element Plus, supports two modes: by province and by city, provides convenient city selection functionality. The component has built-in national city data, supports quick city location by letter.

Usage Example

vue
<template>
  <div>
    <witCity v-model="selectedCity" />
    <p>Selected city code: {{ selectedCity }}</p>
  </div>
</template>

<script lang="ts" setup>
import { ref } from 'vue'

const selectedCity = ref('110000') // Default selection Beijing
</script>

API

Property NameTypeDefault ValueDescription
modelValue[String]undefinedCity code, for two-way binding, e.g.: '110000' (Beijing)

Events

Event NameDescriptionParameters
update:modelValueTriggered when city selection changesSelected city code

TIP

The component has built-in national city data, including provinces and cities. Supports two selection modes:

  1. By province: First select province initial letter, then select specific province and city
  2. By city: Directly locate and select city by initial letter

湘ICP备2024070110号