增加v-model
This commit is contained in:
@@ -50,7 +50,12 @@ import {mapState} from 'vuex'
|
|||||||
export default {
|
export default {
|
||||||
name: 'AiAreaPicker',
|
name: 'AiAreaPicker',
|
||||||
components: {AiCell, AiSearchPopup},
|
components: {AiCell, AiSearchPopup},
|
||||||
|
model: {
|
||||||
|
prop: "value",
|
||||||
|
event: "select"
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
|
value: {default: ""},
|
||||||
areaId: {default: ''},
|
areaId: {default: ''},
|
||||||
name: {default: ''},
|
name: {default: ''},
|
||||||
all: Boolean,
|
all: Boolean,
|
||||||
@@ -96,6 +101,9 @@ export default {
|
|||||||
areaId(v) {
|
areaId(v) {
|
||||||
v && this.getFullArea()
|
v && this.getFullArea()
|
||||||
},
|
},
|
||||||
|
value(v) {
|
||||||
|
v && this.handleInit()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getFullArea() {
|
getFullArea() {
|
||||||
@@ -162,7 +170,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleInit() {
|
handleInit() {
|
||||||
this.index = this.areaId
|
this.index = this.value || this.areaId
|
||||||
this.getFullArea().then(() => {
|
this.getFullArea().then(() => {
|
||||||
if (this.all && !this.currentArea.id) this.getProvinces()
|
if (this.all && !this.currentArea.id) this.getProvinces()
|
||||||
else this.getChildAreas(this.currentArea.id)
|
else this.getChildAreas(this.currentArea.id)
|
||||||
|
|||||||
Reference in New Issue
Block a user