From 5925ad3bd2781a05484dde5bf7a22604ad66ebf5 Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 10 Oct 2016 21:23:49 -0400 Subject: [PATCH] tweak select IE fix to reduce duplicate call --- src/platforms/web/runtime/directives/model.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/platforms/web/runtime/directives/model.js b/src/platforms/web/runtime/directives/model.js index 2842ee02..e15e97a5 100644 --- a/src/platforms/web/runtime/directives/model.js +++ b/src/platforms/web/runtime/directives/model.js @@ -20,7 +20,7 @@ if (isIE9) { } export default { - bind (el, binding, vnode) { + inserted (el, binding, vnode) { if (process.env.NODE_ENV !== 'production') { if (!modelableTagRE.test(vnode.tag)) { warn( @@ -32,13 +32,12 @@ export default { } } if (vnode.tag === 'select') { - setSelected(el, binding, vnode.context) + const cb = () => { + setSelected(el, binding, vnode.context) + } + cb() /* istanbul ignore if */ if (isIE || isEdge) { - const cb = () => { - setSelected(el, binding, vnode.context) - } - nextTick(cb) setTimeout(cb, 0) } } else if (vnode.tag === 'textarea' || el.type === 'text') {