This repository was archived by the owner on Jul 26, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " vue-bootstrap-typeahead" ,
3
- "version" : " 0.2.0 " ,
3
+ "version" : " 0.2.1 " ,
4
4
"private" : false ,
5
5
"description" : " A typeahead/autocomplete component for Vue 2 using Bootstrap 4" ,
6
6
"keywords" : [
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div >
3
3
<div :class =" sizeClasses" >
4
- <div v-if =" $slots.prepend || prepend" class =" input-group-prepend" >
4
+ <div ref = " prependDiv " v-if =" $slots.prepend || prepend" class =" input-group-prepend" >
5
5
<slot name =" prepend" >
6
6
<span class =" input-group-text" >{{ prepend }}</span >
7
7
</slot >
@@ -116,8 +116,17 @@ export default {
116
116
methods: {
117
117
resizeList (el ) {
118
118
const rect = el .getBoundingClientRect ()
119
- // this.$refs.list.$el.style.top = rect.height + 5 + 'px'
120
- this .$refs .list .$el .style .width = rect .width + ' px'
119
+ const listStyle = this .$refs .list .$el .style
120
+
121
+ // Set the width of the list on resize
122
+ listStyle .width = rect .width + ' px'
123
+
124
+ // Set the margin when the prepend prop or slot is populated
125
+ // (setting the "left" CSS property doesn't work)
126
+ if (this .$refs .prependDiv ) {
127
+ const prependRect = this .$refs .prependDiv .getBoundingClientRect ()
128
+ listStyle .marginLeft = prependRect .width + ' px'
129
+ }
121
130
},
122
131
123
132
handleHit (evt ) {
You can’t perform that action at this time.
0 commit comments