File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 88 </template >
99 <template v-else >{{ field.placeholder || 'Select an option' }}</template >
1010 <span class =" vfg-fi vfg-fi-right" >
11+ <!-- X-Mark Icon from https://heroicons.com -->
12+ <span v-if =" hasValue" @click.prevent =" resetSelection" >
13+ <svg
14+ xmlns =" http://www.w3.org/2000/svg" fill =" none" viewBox =" 0 0 24 24"
15+ stroke-width =" 1.5"
16+ stroke =" currentColor"
17+ >
18+ <path stroke-linecap =" round" stroke-linejoin =" round" d =" M6 18 18 6M6 6l12 12" />
19+ </svg >
20+ </span >
1121 <!-- ChevronDown from https://heroicons.com -->
1222 <svg
1323 xmlns =" http://www.w3.org/2000/svg" fill =" none" viewBox =" 0 0 24 24"
@@ -67,6 +77,9 @@ export default {
6777 } else {
6878 return [ this .field .options .find (o => o .value === this .currentModelValue ).name ]
6979 }
80+ },
81+ hasValue () {
82+ return this .field .multiple ? this .currentModelValue .length : this .currentModelValue
7083 }
7184 },
7285 methods: {
@@ -77,6 +90,9 @@ export default {
7790 }
7891 this .isOpened = true
7992 },
93+ resetSelection () {
94+ this .$emit (' onInput' , this .field .multiple ? [] : ' ' )
95+ },
8096 isSelected (option ) {
8197 return this .currentModelValue ? .includes (option .value ) ?? false
8298 },
You can’t perform that action at this time.
0 commit comments