源文件
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<!--
|
||||
省市县三级联动选择 (国标) 返回省市区名称
|
||||
|
||||
直辖市:第一级不包含“市”,比如“北京 北京市 某某区”
|
||||
|
||||
@author terrfly
|
||||
@site https://www.jeequan.com
|
||||
@date 2022/01/17 19:34
|
||||
-->
|
||||
<template>
|
||||
<a-cascader
|
||||
:field-names="{ label: 'label', value: 'label', children: 'children' }"
|
||||
:value="props.value"
|
||||
:options="allList"
|
||||
placeholder="选择省市县"
|
||||
@change="changeFunc"
|
||||
/>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { defineProps } from 'vue'
|
||||
import allList from './areacodeUmhs.json'
|
||||
|
||||
const props = defineProps({
|
||||
value: { type: Array, default: null },
|
||||
})
|
||||
|
||||
// emit 父组件使用: v-model="val" 进行双向绑定。
|
||||
const emit = defineEmits(['update:value'])
|
||||
|
||||
// 当属性发生了变化, 需要通过函数向父组件通信 --》 父组件再通知子组件进行数据的变化。
|
||||
function changeFunc(value){
|
||||
emit('update:value', value)
|
||||
}
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user