File tree Expand file tree Collapse file tree 1 file changed +31
-43
lines changed
resources/assets/js/components/common/form Expand file tree Collapse file tree 1 file changed +31
-43
lines changed Original file line number Diff line number Diff line change 1
1
<script setup>
2
- import { useField } from ' vee-validate' ;
3
-
2
+ import { Field as RenderlessSelect } from ' vee-validate' ;
4
3
import ErrorText from ' ./ErrorText' ;
5
4
6
- const props = defineProps ({
5
+ defineProps ({
7
6
label: {
8
7
type: String ,
9
8
required: true ,
21
20
22
21
placeholder: {
23
22
type: String ,
24
- required : true ,
23
+ default : null ,
25
24
},
26
25
27
26
rules: {
34
33
default: null ,
35
34
},
36
35
});
37
-
38
- const {
39
- value ,
40
- errorMessage ,
41
- } = useField (props .name , props .rules , {
42
- label: props .validationName || props .label ,
43
- });
44
36
</script >
45
37
46
38
<template >
51
43
/>
52
44
53
45
<div class =" flex relative" >
54
- <select
46
+ <renderless- select
55
47
:id =" name"
56
- v-model = " value "
48
+ v-slot = " { field, errorMessage } "
57
49
v-bind =" $attrs"
58
- :class =" [
59
- 'pr-12 border appearance-none',
60
- { 'border-red': errorMessage },
61
- ]"
50
+ :name =" name"
51
+ :label =" validationName || label"
52
+ :rules =" rules"
62
53
>
63
- <option
64
- value = " "
65
- disabled
66
- hidden
67
- v-html = " placeholder "
68
- />
69
-
70
- <option
71
- v-for = " (option, index) in options "
72
- :key = " index "
73
- :value = " option.value "
74
- v-html = " option.label "
75
- />
76
- </ select >
54
+ <select
55
+ :class = " [
56
+ 'pr-12 border appearance-none',
57
+ { 'border-red': errorMessage },
58
+ ] "
59
+ v-bind = " field "
60
+ >
61
+ <option
62
+ v-if = " placeholder "
63
+ value = " "
64
+ selected
65
+ disabled
66
+ v-html = " placeholder "
67
+ / >
77
68
78
- < span
79
- v-if = " placeholder && !value "
80
- :class = " [
81
- 'absolute inset-0 right-12',
82
- 'truncate text-grey-400 pointer-events-none',
83
- ] "
84
- v-text = " placeholder "
85
- / >
69
+ < option
70
+ v-for = " (option, index) in options "
71
+ :key = " index "
72
+ :value = " option.value "
73
+ v-html = " option.label "
74
+ />
75
+ </ select >
76
+ </ renderless-select >
86
77
87
78
<e-icon
88
79
name =" chevron-right"
95
86
/>
96
87
</div >
97
88
98
- <error-text
99
- v-if =" errorMessage"
100
- :message =" errorMessage"
101
- />
89
+ <error-text :name =" name" />
102
90
</div >
103
91
</template >
You can’t perform that action at this time.
0 commit comments