File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed
components-implementation Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,12 @@ const props = {
26
26
type : Boolean ,
27
27
default : false
28
28
} ,
29
+ // the name of the ref to obtain the input (if its a child of component in the slot)
30
+ childRefName : {
31
+ required : false ,
32
+ type : String ,
33
+ default : 'input'
34
+ } ,
29
35
options : {
30
36
type : Object
31
37
}
@@ -34,6 +40,14 @@ const props = {
34
40
export default {
35
41
mounted ( ) {
36
42
this . $gmapApiPromiseLazy ( ) . then ( ( ) => {
43
+ var scopedInput = null
44
+ if ( this . $scopedSlots . input ) {
45
+ scopedInput = this . $scopedSlots . input ( ) [ 0 ] . context . $refs . input
46
+ if ( scopedInput && scopedInput . $refs ) {
47
+ scopedInput = scopedInput . $refs [ this . childRefName || 'input' ]
48
+ }
49
+ if ( scopedInput ) { this . $refs . input = scopedInput }
50
+ }
37
51
if ( this . selectFirstOnEnter ) {
38
52
downArrowSimulator ( this . $refs . input )
39
53
}
Original file line number Diff line number Diff line change 1
1
<template >
2
- <input
3
- ref =" input"
4
- v-bind =" $attrs"
5
- v-on =" $listeners"
6
- />
2
+ <span v-if =" $scopedSlots['input']" >
3
+ <slot name =" input" v-bind:attrs =" $attrs" v-bind:listeners =" $listeners" :ref =" input" ></slot >
4
+ </span >
5
+ <input v-else-if =" !$scopedSlots['input']" ref =" input" v-bind =" $attrs" v-on =" $listeners" />
7
6
</template >
8
7
9
8
<script >
You can’t perform that action at this time.
0 commit comments