|
@@ -5,9 +5,8 @@
|
|
|
|
|
|
|
|
import { isTextInputType } from 'web/util/element'
|
|
import { isTextInputType } from 'web/util/element'
|
|
|
import { looseEqual, looseIndexOf } from 'shared/util'
|
|
import { looseEqual, looseIndexOf } from 'shared/util'
|
|
|
-import { warn, isAndroid, isIE9, isIE, isEdge } from 'core/util/index'
|
|
|
|
|
import { mergeVNodeHook } from 'core/vdom/helpers/index'
|
|
import { mergeVNodeHook } from 'core/vdom/helpers/index'
|
|
|
-import { emptyNode } from 'core/vdom/patch'
|
|
|
|
|
|
|
+import { warn, isAndroid, isIE9, isIE, isEdge } from 'core/util/index'
|
|
|
|
|
|
|
|
/* istanbul ignore if */
|
|
/* istanbul ignore if */
|
|
|
if (isIE9) {
|
|
if (isIE9) {
|
|
@@ -24,7 +23,7 @@ const directive = {
|
|
|
inserted (el, binding, vnode, oldVnode) {
|
|
inserted (el, binding, vnode, oldVnode) {
|
|
|
if (vnode.tag === 'select') {
|
|
if (vnode.tag === 'select') {
|
|
|
// #6903
|
|
// #6903
|
|
|
- if (oldVnode !== emptyNode && !hasDirective(oldVnode, 'model')) {
|
|
|
|
|
|
|
+ if (oldVnode.elm && !oldVnode.elm._vOptions) {
|
|
|
mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'postpatch', () => {
|
|
mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'postpatch', () => {
|
|
|
directive.componentUpdated(el, binding, vnode)
|
|
directive.componentUpdated(el, binding, vnode)
|
|
|
})
|
|
})
|
|
@@ -51,6 +50,7 @@ const directive = {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+
|
|
|
componentUpdated (el, binding, vnode) {
|
|
componentUpdated (el, binding, vnode) {
|
|
|
if (vnode.tag === 'select') {
|
|
if (vnode.tag === 'select') {
|
|
|
setSelected(el, binding, vnode.context)
|
|
setSelected(el, binding, vnode.context)
|
|
@@ -146,10 +146,4 @@ function trigger (el, type) {
|
|
|
el.dispatchEvent(e)
|
|
el.dispatchEvent(e)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function hasDirective (vnode, dirname) {
|
|
|
|
|
- return vnode.data &&
|
|
|
|
|
- vnode.data.directives &&
|
|
|
|
|
- vnode.data.directives.some(dir => dir.name === dirname)
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
export default directive
|
|
export default directive
|