Eduardo San Martin Morote
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
16 additions and
2 deletions
-
src/core/vdom/helpers/normalize-scoped-slots.js
-
test/unit/features/component/component-slot.spec.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 |
|
|
|
} |
|
|
|
|
|
@ -986,4 +986,18 @@ describe('Component slot', () => { |
|
|
|
expect(vm.$el.firstChild.innerHTML).toBe('<span><b>2</b></span>') |
|
|
|
}).then(done) |
|
|
|
}) |
|
|
|
|
|
|
|
// #12102
|
|
|
|
it('v-if inside scoped slot', () => { |
|
|
|
const vm = new Vue({ |
|
|
|
template: `<test><template #custom><span v-if="false">a</span><span>b</span></template></test>`, |
|
|
|
components: { |
|
|
|
test: { |
|
|
|
template: `<div><slot name="custom"/></div>` |
|
|
|
} |
|
|
|
} |
|
|
|
}).$mount() |
|
|
|
|
|
|
|
expect(vm.$el.innerHTML).toBe(`<!----><span>b</span>`) |
|
|
|
}) |
|
|
|
}) |
|
|
|