File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ const showOptions = ref(false)
6969const listboxRef = ref <HTMLDivElement | null >(null )
7070const top = ref (0 )
7171const left = ref (0 )
72+ const width = ref (0 )
7273const buttonRef = ref <InstanceType <typeof Listbox > | null >(null )
7374
7475const inputValidStyle =
@@ -137,6 +138,7 @@ watch(
137138function calculatePosition() {
138139 top .value = buttonRef .value ?.$el .getBoundingClientRect ().bottom + window .scrollY
139140 left .value = buttonRef .value ?.$el .getBoundingClientRect ().left - window .scrollX
141+ width .value = buttonRef .value ?.$el .getBoundingClientRect ().width || 0
140142}
141143
142144function onClickOutsideListbox() {
@@ -246,7 +248,7 @@ onClickOutside(listboxRef, () => onClickOutsideListbox())
246248 <ListboxOptions
247249 static
248250 :class =" `absolute z-10 mt-1 max-h-60 overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-gray-500/5 focus:outline-hidden sm:text-sm dark:bg-gray-950 ${optionsPanelStyle}`"
249- :style =" [{ top: top + 'px' }, { left: left + 'px' }]"
251+ :style =" [{ top: top + 'px' }, { left: left + 'px' }, { 'min-width': width + 'px' } ]"
250252 >
251253 <ListboxOption
252254 v-for =" option in allOptions"
You can’t perform that action at this time.
0 commit comments