mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-03 20:48:07 +00:00 
			
		
		
		
	fix: emits for FormSelect and PhoneInput component (#10226)
This commit is contained in:
		@@ -8,7 +8,7 @@ import {
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  props: {
 | 
			
		||||
    value: {
 | 
			
		||||
    modelValue: {
 | 
			
		||||
      type: [String, Number],
 | 
			
		||||
      default: '',
 | 
			
		||||
    },
 | 
			
		||||
@@ -29,7 +29,7 @@ export default {
 | 
			
		||||
      default: false,
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  emits: ['blur', 'input', 'setCode'],
 | 
			
		||||
  emits: ['blur', 'setCode', 'update:modelValue'],
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      selectedIndex: -1,
 | 
			
		||||
@@ -37,7 +37,7 @@ export default {
 | 
			
		||||
      searchCountry: '',
 | 
			
		||||
      activeCountryCode: getActiveCountryCode(),
 | 
			
		||||
      activeDialCode: getActiveDialCode(),
 | 
			
		||||
      phoneNumber: this.value,
 | 
			
		||||
      phoneNumber: this.modelValue,
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  computed: {
 | 
			
		||||
@@ -76,12 +76,12 @@ export default {
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  watch: {
 | 
			
		||||
    value() {
 | 
			
		||||
      const number = parsePhoneNumber(this.value);
 | 
			
		||||
    modelValue() {
 | 
			
		||||
      const number = parsePhoneNumber(this.modelValue);
 | 
			
		||||
      if (number) {
 | 
			
		||||
        this.activeCountryCode = number.country;
 | 
			
		||||
        this.activeDialCode = `+${number.countryCallingCode}`;
 | 
			
		||||
        this.phoneNumber = this.value.replace(
 | 
			
		||||
        this.phoneNumber = this.modelValue.replace(
 | 
			
		||||
          `+${number.countryCallingCode}`,
 | 
			
		||||
          ''
 | 
			
		||||
        );
 | 
			
		||||
@@ -103,7 +103,8 @@ export default {
 | 
			
		||||
    },
 | 
			
		||||
    onChange(e) {
 | 
			
		||||
      this.phoneNumber = e.target.value;
 | 
			
		||||
      this.$emit('input', e.target.value, this.activeDialCode);
 | 
			
		||||
      this.$emit('update:modelValue', e.target.value);
 | 
			
		||||
      this.$emit('setCode', this.activeDialCode);
 | 
			
		||||
    },
 | 
			
		||||
    onBlur(e) {
 | 
			
		||||
      this.$emit('blur', e.target.value);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user