@@ -32,10 +32,25 @@ export function setCurrentRenderingInstance(
|
||||
* Set scope id when creating hoisted vnodes.
|
||||
* @private compiler helper
|
||||
*/
|
||||
export function setScopeId(id: string | null) {
|
||||
export function pushScopeId(id: string | null) {
|
||||
currentScopeId = id
|
||||
}
|
||||
|
||||
/**
|
||||
* Technically we no longer need this after 3.0.8 but we need to keep the same
|
||||
* API for backwards compat w/ code generated by compilers.
|
||||
* @private
|
||||
*/
|
||||
export function popScopeId() {
|
||||
currentScopeId = null
|
||||
}
|
||||
|
||||
/**
|
||||
* Only for backwards compat
|
||||
* @private
|
||||
*/
|
||||
export const withScopeId = (_id: string) => withCtx
|
||||
|
||||
/**
|
||||
* Wrap a slot function to memoize current rendering instance
|
||||
* @private compiler helper
|
||||
|
||||
@@ -26,7 +26,7 @@ export function renderSlot(
|
||||
// this is not a user-facing function, so the fallback is always generated by
|
||||
// the compiler and guaranteed to be a function returning an array
|
||||
fallback?: () => VNodeArrayChildren,
|
||||
hasSlotted?: boolean
|
||||
noSlotted?: boolean
|
||||
): VNode {
|
||||
let slot = slots[name]
|
||||
|
||||
@@ -54,7 +54,7 @@ export function renderSlot(
|
||||
? PatchFlags.STABLE_FRAGMENT
|
||||
: PatchFlags.BAIL
|
||||
)
|
||||
if (hasSlotted && rendered.scopeId) {
|
||||
if (!noSlotted && rendered.scopeId) {
|
||||
rendered.slotScopeIds = [rendered.scopeId + '-s']
|
||||
}
|
||||
isRenderingCompiledSlot--
|
||||
|
||||
@@ -226,8 +226,13 @@ export { HMRRuntime } from './hmr'
|
||||
// user code should avoid relying on them.
|
||||
|
||||
// For compiler generated code
|
||||
// should sync with '@vue/compiler-core/src/runtimeConstants.ts'
|
||||
export { withCtx, setScopeId } from './componentRenderContext'
|
||||
// should sync with '@vue/compiler-core/src/runtimeHelpers.ts'
|
||||
export {
|
||||
withCtx,
|
||||
pushScopeId,
|
||||
popScopeId,
|
||||
withScopeId
|
||||
} from './componentRenderContext'
|
||||
export { renderList } from './helpers/renderList'
|
||||
export { toHandlers } from './helpers/toHandlers'
|
||||
export { renderSlot } from './helpers/renderSlot'
|
||||
|
||||
Reference in New Issue
Block a user