增加v-model
This commit is contained in:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user