修改 地图
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<el-cascader v-bind='$attrs' :options='options' :props='cascaderProps' />
|
||||
<el-cascader ref="cascader" v-bind="$attrs" :options="options" :props="cascaderProps" @change="change" />
|
||||
</template>
|
||||
|
||||
<script lang='ts' setup>
|
||||
import { defineComponent } from 'vue'
|
||||
<script lang="ts" setup>
|
||||
import { defineComponent, ref } from 'vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'Area'
|
||||
@@ -16,11 +16,19 @@ const cascaderProps = {
|
||||
checkStrictly: true,
|
||||
emitPath: false
|
||||
}
|
||||
const cascader = ref()
|
||||
const dictData = useDictData()
|
||||
const options = dictData.state.area
|
||||
const areaName = ref(dictData.state.area[0].name)
|
||||
const change = (e: any) => {
|
||||
if (cascader.value.getCheckedNodes()[0].pathLabels.length == 1) {
|
||||
areaName.value = cascader.value.getCheckedNodes()[0].pathLabels[0]
|
||||
} else if (cascader.value.getCheckedNodes()[0].pathLabels.length >= 2) {
|
||||
areaName.value = cascader.value.getCheckedNodes()[0].pathLabels[1]
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({ areaName })
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
<style scoped></style>
|
||||
|
||||
Reference in New Issue
Block a user