File tree Expand file tree Collapse file tree 2 files changed +17
-17
lines changed Expand file tree Collapse file tree 2 files changed +17
-17
lines changed Original file line number Diff line number Diff line change 7
7
:md-offset-x =" offset.x"
8
8
:md-offset-y =" offset.y"
9
9
:md-dense =" mdDense"
10
- @md-opened =" onOpen"
11
10
@md-closed =" onClose" >
12
11
<md-input
13
12
class =" md-input md-select-value"
33
32
class =" md-select-menu"
34
33
:md-content-class =" mdClass"
35
34
:style =" menuStyles"
36
- :id = " uniqueId " >
35
+ @enter = " onMenuEnter " >
37
36
<slot />
38
37
</md-menu-content >
39
38
</keep-alive >
45
44
46
45
<script >
47
46
import raf from ' raf'
48
- import MdUuid from ' core/utils/MdUuid'
49
47
import MdComponent from ' core/MdComponent'
50
48
import MdDropDownIcon from ' core/icons/MdDropDownIcon'
51
49
import MdMenu from ' components/MdMenu/MdMenu'
77
75
inject: [' MdField' ],
78
76
data () {
79
77
return {
80
- uniqueId: ' md-select-menu-' + MdUuid (),
81
78
menuStyles: {},
82
79
offset: {
83
80
x: defaultOffset .x ,
139
136
menu .scrollTop = top - ((menuHeight - elHeight) / 2 )
140
137
},
141
138
async setOffsets (target ) {
142
- await this .$nextTick ()
143
-
144
139
if (! this .$isServer ) {
145
- const menu = document . getElementById ( this .uniqueId )
140
+ const menu = this .$refs . menu . $refs . container
146
141
147
142
if (menu) {
148
143
const selected = target || menu .querySelector (' .md-selected' )
160
155
}
161
156
}
162
157
},
163
- onOpen () {
164
- this .$emit (' md-opened' )
165
- if (this .didMount ) {
166
- this .setOffsets ()
167
- window .setTimeout (() => {
168
- this .MdField .focused = true
169
- }, 10 )
158
+ onMenuEnter () {
159
+ if (! this .didMount ) {
160
+ return
170
161
}
162
+
163
+ this .setOffsets ()
164
+ this .MdField .focused = true
165
+ this .$emit (' md-opened' )
171
166
},
172
167
applyHighlight () {
173
168
this .MdField .focused = false
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<md-popover :md-settings =" popperSettings" :md-active =" shouldRender" >
3
- <transition name =" md-menu-content" :css =" didMount" v-if =" shouldRender" >
3
+ <transition name =" md-menu-content" :css =" didMount" v-if =" shouldRender" v-on = " $listeners " >
4
4
<div
5
5
:class =" [menuClasses, mdContentClass, $mdActiveTheme]"
6
6
:style =" menuStyles"
9
9
@keydown.space.prevent =" setSelection"
10
10
@keydown.enter.prevent =" setSelection"
11
11
ref =" menu" >
12
- <div class =" md-menu-content-container md-scrollbar" :class =" $mdActiveTheme" >
13
- <md-list :class =" listClasses" v-bind =" $attrs " @keydown.esc =" onEsc" >
12
+ <div class =" md-menu-content-container md-scrollbar" :class =" $mdActiveTheme" ref = " container " >
13
+ <md-list :class =" listClasses" v-bind =" filteredAttrs " @keydown.esc =" onEsc" >
14
14
<slot />
15
15
</md-list >
16
16
</div >
48
48
menuStyles: ' '
49
49
}),
50
50
computed: {
51
+ filteredAttrs () {
52
+ const attrs = this .$attrs
53
+ delete attrs .id
54
+ return attrs
55
+ },
51
56
highlightedItem () {
52
57
return this .highlightItems [this .highlightIndex ]
53
58
},
You can’t perform that action at this time.
0 commit comments