AmAddressFormField.vue
5 days ago
AmAttachmentFormField.vue
5 days ago
AmCheckboxFormField.vue
5 days ago
AmContentFormField.vue
5 days ago
AmDatePickerFormField.vue
5 days ago
AmInputFormField.vue
5 days ago
AmPhoneFormField.vue
5 days ago
AmRadioFormField.vue
5 days ago
AmSelectFormField.vue
5 days ago
AmSocialButton.vue
5 days ago
AmAddressFormField.vue
85 lines
| 1 | <template> |
| 2 | <el-form-item |
| 3 | :id="props.id" |
| 4 | ref="formFieldRef" |
| 5 | class="am-ff__item" |
| 6 | :prop="props.itemName" |
| 7 | :label-position="props.labelPosition" |
| 8 | > |
| 9 | <template #label> |
| 10 | <span class="am-ff__item-label" v-html="props.label" /> |
| 11 | </template> |
| 12 | <!-- Address Field --> |
| 13 | <AmAddressInput |
| 14 | :id="props.itemName" |
| 15 | v-model="model" |
| 16 | @address-selected="(address) => emits('address-selected', address)" |
| 17 | /> |
| 18 | <!-- /Address Field --> |
| 19 | </el-form-item> |
| 20 | </template> |
| 21 | |
| 22 | <script setup> |
| 23 | // * Components |
| 24 | import AmAddressInput from '../../_components/address-input/AmAddressInput.vue' |
| 25 | |
| 26 | // * Import from Vue |
| 27 | import { computed, ref, toRefs } from 'vue' |
| 28 | |
| 29 | // * Form Item Props |
| 30 | let props = defineProps({ |
| 31 | modelValue: { |
| 32 | type: [String, Array, Object, Number], |
| 33 | required: true, |
| 34 | }, |
| 35 | id: { |
| 36 | type: [String, Number], |
| 37 | }, |
| 38 | itemName: { |
| 39 | type: String, |
| 40 | required: true, |
| 41 | }, |
| 42 | label: { |
| 43 | type: String, |
| 44 | }, |
| 45 | labelPosition: { |
| 46 | type: String, |
| 47 | default: 'top', |
| 48 | }, |
| 49 | options: { |
| 50 | type: Array, |
| 51 | }, |
| 52 | }) |
| 53 | |
| 54 | // * Define Emits |
| 55 | const emits = defineEmits(['update:modelValue', 'address-selected']) |
| 56 | |
| 57 | // * Component model |
| 58 | let { modelValue } = toRefs(props) |
| 59 | let model = computed({ |
| 60 | get: () => modelValue.value, |
| 61 | set: (val) => { |
| 62 | emits('update:modelValue', val) |
| 63 | }, |
| 64 | }) |
| 65 | |
| 66 | // * Form Item Reference |
| 67 | let formFieldRef = ref(null) |
| 68 | |
| 69 | defineExpose({ |
| 70 | formFieldRef, |
| 71 | }) |
| 72 | </script> |
| 73 | |
| 74 | <script> |
| 75 | export default { |
| 76 | name: 'AddressFormField', |
| 77 | } |
| 78 | </script> |
| 79 | |
| 80 | <style lang="scss"> |
| 81 | .pac-container { |
| 82 | z-index: 9999999999 !important; |
| 83 | } |
| 84 | </style> |
| 85 |