5
5
6
6
import { isTextInputType } from 'web/util/element'
7
7
import { looseEqual , looseIndexOf } from 'shared/util'
8
- import { warn , isAndroid , isIE9 , isIE , isEdge } from 'core/util/index'
9
8
import { mergeVNodeHook } from 'core/vdom/helpers/index'
10
- import { emptyNode } from 'core/vdom/patch '
9
+ import { warn , isAndroid , isIE9 , isIE , isEdge } from 'core/util/index '
11
10
12
11
/* istanbul ignore if */
13
12
if ( isIE9 ) {
@@ -24,7 +23,7 @@ const directive = {
24
23
inserted ( el , binding , vnode , oldVnode ) {
25
24
if ( vnode . tag === 'select' ) {
26
25
// #6903
27
- if ( oldVnode !== emptyNode && ! hasDirective ( oldVnode , 'model' ) ) {
26
+ if ( oldVnode . elm && ! oldVnode . elm . _vOptions ) {
28
27
mergeVNodeHook ( vnode . data . hook || ( vnode . data . hook = { } ) , 'postpatch' , ( ) => {
29
28
directive . componentUpdated ( el , binding , vnode )
30
29
} )
@@ -51,6 +50,7 @@ const directive = {
51
50
}
52
51
}
53
52
} ,
53
+
54
54
componentUpdated ( el , binding , vnode ) {
55
55
if ( vnode . tag === 'select' ) {
56
56
setSelected ( el , binding , vnode . context )
@@ -146,10 +146,4 @@ function trigger (el, type) {
146
146
el . dispatchEvent ( e )
147
147
}
148
148
149
- function hasDirective ( vnode , dirname ) {
150
- return vnode . data &&
151
- vnode . data . directives &&
152
- vnode . data . directives . some ( dir => dir . name === dirname )
153
- }
154
-
155
149
export default directive
0 commit comments