diff --git a/src/core/vdom/modules/ref.js b/src/core/vdom/modules/ref.js index 00bb5f52709..aa9bdcfcfba 100644 --- a/src/core/vdom/modules/ref.js +++ b/src/core/vdom/modules/ref.js @@ -1,6 +1,6 @@ /* @flow */ -import { remove } from 'shared/util' +import { remove, isDef } from 'shared/util' export default { create (_: any, vnode: VNodeWithData) { @@ -19,7 +19,7 @@ export default { export function registerRef (vnode: VNodeWithData, isRemoval: ?boolean) { const key = vnode.data.ref - if (!key) return + if (!isDef(key)) return const vm = vnode.context const ref = vnode.componentInstance || vnode.elm diff --git a/test/unit/features/ref.spec.js b/test/unit/features/ref.spec.js index 05efc4d5244..971c8fbe678 100644 --- a/test/unit/features/ref.spec.js +++ b/test/unit/features/ref.spec.js @@ -9,6 +9,10 @@ describe('ref', () => { test2: { id: 'test2', template: '