省市县乡四级联动

前言

image

关键代码

/**
 * @description 省市县乡四级联动
 * @author jingwang36
 * @date 2022/12/12 21:16:49
 */
<template>
  <div class="m-4">
    <p>Child options expand when hovered</p>
    <el-cascader size="large" separator="" style="width:400px" v-model="value" :options="addressData"  @change="handleChange" />
  </div>
</template>
 
<script setup lang="ts">
import { ref } from 'vue'
import addressData from './addressData4.json'
type Area = {
  value:string,
  label:string,
  children:[]
}
// 默认值
const value = ['22','2224','222401','222401003'];
//  次级菜单的展开方式 不配置则为点击时展开
const props = {
  expandTrigger: 'hover',
}

const handleChange = (value:Area) => {
  console.log(value)
}

</script>
 
<style scoped>

</style>
posted @ 2022-12-12 22:24  his365  阅读(32)  评论(0编辑  收藏  举报