diff --git a/src/core/vdom/helpers/normalize-scoped-slots.js b/src/core/vdom/helpers/normalize-scoped-slots.js
index 15ab396d..13df231f 100644
--- a/src/core/vdom/helpers/normalize-scoped-slots.js
+++ b/src/core/vdom/helpers/normalize-scoped-slots.js
@@ -61,10 +61,10 @@ function normalizeScopedSlot(normalSlots, key, fn) {
res = res && typeof res === 'object' && !Array.isArray(res)
? [res] // single vnode
: normalizeChildren(res)
- let vnode: VNode = res && res[0]
+ let vnode: ?VNode = res && res[0]
return res && (
!vnode ||
- (vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
+ (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
) ? undefined
: res
}
diff --git a/test/unit/features/component/component-slot.spec.js b/test/unit/features/component/component-slot.spec.js
index c6e20e49..4412a1f0 100644
--- a/test/unit/features/component/component-slot.spec.js
+++ b/test/unit/features/component/component-slot.spec.js
@@ -986,4 +986,18 @@ describe('Component slot', () => {
expect(vm.$el.firstChild.innerHTML).toBe('2')
}).then(done)
})
+
+ // #12102
+ it('v-if inside scoped slot', () => {
+ const vm = new Vue({
+ template: `