<template>
  <CityComponent
    :value="props.value"
    :disabled="props.disabled"
    :readonly="props.readonly"
    :record="props.record"
    :placeholder="props.placeholder"
    @onChange="onChange"
    @onBlur="dataValueBlur"
    @onClick="dataValueClick"
    @onFocus="dataValueFocus"
    @update:value="updateValue"
  ></CityComponent>
</template>

<script setup name="FormCity">
const props = defineProps({
  value: {
    type: String,
    default: ''
  },
  //是否禁用
  disabled: {
    type: Boolean,
    default: false
  },
  // 当前行数据
  record: {
    type: Object,
    default: {}
  },
  placeholder: {
    type: String,
    default: '请选择'
  },
  // 是否只读
  readonly: {
    type: Boolean,
    default: false
  }
});

const emits = defineEmits(['update:value', 'onChange', 'onClick', 'onBlur', 'onFocus']);

const onChange = record => {
  emits('onChange', record);
};

const updateValue = value => {
  emits('update:value', value);
};

const dataValueClick = () => {
  emits('onClick', props.record);
};

const dataValueBlur = () => {
  emits('onBlur', props.record);
};

const dataValueFocus = () => {
  emits('onFocus', props.record);
};
</script>

<style></style>
