PluginProbe
The Innovative Form Builder – IvyForms / 0.2
The Innovative Form Builder – IvyForms v0.2
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / frontend / src / views / public / fields / PhoneFormField.vue

PhoneFormField.vue in The Innovative Form Builder – IvyForms 0.2, at frontend/src/views/public/fields/PhoneFormField.vue

61 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <template>
2 <div :class="['ivyforms-field', 'ivyforms-field__phone', 'ivyforms-field__phone_' + field.id]">
3 <IvyFormItem
4 :label="field.label"
5 :required="field.required"
6 :error="error"
7 :prop="field.type + '_' + field.fieldIndex"
8 >
9 <IvyPhoneInput
10 :id="fieldID"
11 v-model="localModelValue"
12 class="ivyforms-field__phone-input"
13 :placeholder="field.placeholder"
14 :disabled="disabled"
15 :required="field.required"
16 />
17 </IvyFormItem>
18 </div>
19 </template>
20
21 <script setup lang="ts">
22 import { computed } from 'vue'
23
24 interface Field {
25 id: number
26 formId: number
27 fieldIndex: number
28 type: string
29 label: string
30 placeholder?: string
31 required?: boolean
32 }
33 interface FieldProps {
34 modelValue: string | number | null | undefined
35 field: Field
36 disabled?: boolean
37 error?: string
38 }
39
40 const props = withDefaults(defineProps<FieldProps>(), {
41 modelValue: '',
42 disabled: false,
43 error: '',
44 })
45
46 const emit = defineEmits(['update:modelValue'])
47
48 const localModelValue = computed({
49 get() {
50 return props.modelValue != null ? String(props.modelValue) : ''
51 },
52 set(value) {
53 emit('update:modelValue', value)
54 },
55 })
56 // Generate unique field ID as a string
57 const fieldID = computed(() => {
58 return `ivyforms-field__phone-input_${props.field.formId || ''}_${props.field.fieldIndex || ''}`
59 })
60 </script>
61