From b6657ccfbdfa864fdf72070284edf2e14a476e44 Mon Sep 17 00:00:00 2001 From: aixianling Date: Thu, 30 Dec 2021 17:36:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0v-model?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AiAreaPicker.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/AiAreaPicker.vue b/src/components/AiAreaPicker.vue index ab4ba0a4..77c25890 100644 --- a/src/components/AiAreaPicker.vue +++ b/src/components/AiAreaPicker.vue @@ -50,7 +50,12 @@ import {mapState} from 'vuex' export default { name: 'AiAreaPicker', components: {AiCell, AiSearchPopup}, + model: { + prop: "value", + event: "select" + }, props: { + value: {default: ""}, areaId: {default: ''}, name: {default: ''}, all: Boolean, @@ -96,6 +101,9 @@ export default { areaId(v) { v && this.getFullArea() }, + value(v) { + v && this.handleInit() + } }, methods: { getFullArea() { @@ -162,7 +170,7 @@ export default { } }, handleInit() { - this.index = this.areaId + this.index = this.value || this.areaId this.getFullArea().then(() => { if (this.all && !this.currentArea.id) this.getProvinces() else this.getChildAreas(this.currentArea.id)