( vm: ComponentInstance, slotsProxy: InternalSlots )
| 160 | } |
| 161 | |
| 162 | export function resolveScopedSlots( |
| 163 | vm: ComponentInstance, |
| 164 | slotsProxy: InternalSlots |
| 165 | ): void { |
| 166 | const parentVNode = (vm.$options as any)._parentVnode |
| 167 | if (!parentVNode) return |
| 168 | |
| 169 | const prevSlots = vmStateManager.get(vm, 'slots') || [] |
| 170 | const curSlots = resolveSlots(parentVNode.data.scopedSlots, vm.$slots) |
| 171 | // remove staled slots |
| 172 | for (let index = 0; index < prevSlots.length; index++) { |
| 173 | const key = prevSlots[index] |
| 174 | if (!curSlots[key]) { |
| 175 | delete slotsProxy[key] |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | // proxy fresh slots |
| 180 | const slotNames = Object.keys(curSlots) |
| 181 | for (let index = 0; index < slotNames.length; index++) { |
| 182 | const key = slotNames[index] |
| 183 | if (!slotsProxy[key]) { |
| 184 | slotsProxy[key] = createSlotProxy(vm, key) |
| 185 | } |
| 186 | } |
| 187 | vmStateManager.set(vm, 'slots', slotNames) |
| 188 | } |
| 189 | |
| 190 | export function activateCurrentInstance( |
| 191 | instance: ComponentInternalInstance, |
no test coverage detected
searching dependent graphs…