|
|
@@ -1,6 +1,5 @@
|
|
|
/* @flow */
|
|
|
|
|
|
-import { hasOwn } from 'shared/util'
|
|
|
import { def } from 'core/util/lang'
|
|
|
import { normalizeChildren } from 'core/vdom/helpers/normalize-children'
|
|
|
|
|
|
@@ -17,7 +16,7 @@ export function normalizeScopedSlots (
|
|
|
res = {}
|
|
|
for (const key in slots) {
|
|
|
if (slots[key] && key[0] !== '$') {
|
|
|
- res[key] = normalizeScopedSlot(normalSlots, key, slots[key])
|
|
|
+ res[key] = normalizeScopedSlot(slots[key])
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -32,20 +31,13 @@ export function normalizeScopedSlots (
|
|
|
return res
|
|
|
}
|
|
|
|
|
|
-function normalizeScopedSlot(normalSlots, key, fn) {
|
|
|
- const normalized = (scope = {}) => {
|
|
|
+function normalizeScopedSlot(fn: Function): Function {
|
|
|
+ return scope => {
|
|
|
const res = fn(scope)
|
|
|
return res && typeof res === 'object' && !Array.isArray(res)
|
|
|
? [res] // single vnode
|
|
|
: normalizeChildren(res)
|
|
|
}
|
|
|
- // proxy scoped slots on normal $slots
|
|
|
- if (!hasOwn(normalSlots, key)) {
|
|
|
- Object.defineProperty(normalSlots, key, {
|
|
|
- get: normalized
|
|
|
- })
|
|
|
- }
|
|
|
- return normalized
|
|
|
}
|
|
|
|
|
|
function proxyNormalSlot(slots, key) {
|