UNPKG

718 BJavaScriptView Raw
1/* @flow */
2
3export function resolveScopedSlots (
4 fns: ScopedSlotsData, // see flow/vnode
5 res?: Object,
6 // the following are added in 2.6
7 hasDynamicKeys?: boolean,
8 contentHashKey?: number
9): { [key: string]: Function, $stable: boolean } {
10 res = res || { $stable: !hasDynamicKeys }
11 for (let i = 0; i < fns.length; i++) {
12 const slot = fns[i]
13 if (Array.isArray(slot)) {
14 resolveScopedSlots(slot, res, hasDynamicKeys)
15 } else if (slot) {
16 // marker for reverse proxying v-slot without scope on this.$slots
17 if (slot.proxy) {
18 slot.fn.proxy = true
19 }
20 res[slot.key] = slot.fn
21 }
22 }
23 if (contentHashKey) {
24 (res: any).$key = contentHashKey
25 }
26 return res
27}