-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: fix implementation of SFC :slotted id handling
fix #2892
- Loading branch information
Showing
36 changed files
with
723 additions
and
457 deletions.
There are no files selected for viewing
51 changes: 19 additions & 32 deletions
51
packages/compiler-core/__tests__/__snapshots__/scopeId.spec.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,78 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`scopeId compiler support should push scopeId for hoisted nodes 1`] = ` | ||
"import { createVNode as _createVNode, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, openBlock as _openBlock, createBlock as _createBlock, withScopeId as _withScopeId, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \\"vue\\" | ||
const _withId = /*#__PURE__*/_withScopeId(\\"test\\") | ||
"import { createVNode as _createVNode, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, openBlock as _openBlock, createBlock as _createBlock, setScopeId as _setScopeId } from \\"vue\\" | ||
_pushScopeId(\\"test\\") | ||
_setScopeId(\\"test\\") | ||
const _hoisted_1 = /*#__PURE__*/_createVNode(\\"div\\", null, \\"hello\\", -1 /* HOISTED */) | ||
const _hoisted_2 = /*#__PURE__*/_createVNode(\\"div\\", null, \\"world\\", -1 /* HOISTED */) | ||
_popScopeId() | ||
_setScopeId(null) | ||
export const render = /*#__PURE__*/_withId((_ctx, _cache) => { | ||
export function render(_ctx, _cache) { | ||
return (_openBlock(), _createBlock(\\"div\\", null, [ | ||
_hoisted_1, | ||
_createTextVNode(_toDisplayString(_ctx.foo), 1 /* TEXT */), | ||
_hoisted_2 | ||
])) | ||
})" | ||
}" | ||
`; | ||
|
||
exports[`scopeId compiler support should wrap default slot 1`] = ` | ||
"import { createVNode as _createVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock, withScopeId as _withScopeId } from \\"vue\\" | ||
const _withId = /*#__PURE__*/_withScopeId(\\"test\\") | ||
"import { createVNode as _createVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock } from \\"vue\\" | ||
export const render = /*#__PURE__*/_withId((_ctx, _cache) => { | ||
export function render(_ctx, _cache) { | ||
const _component_Child = _resolveComponent(\\"Child\\") | ||
return (_openBlock(), _createBlock(_component_Child, null, { | ||
default: _withId(() => [ | ||
default: _withCtx(() => [ | ||
_createVNode(\\"div\\") | ||
]), | ||
_: 1 /* STABLE */ | ||
})) | ||
})" | ||
}" | ||
`; | ||
|
||
exports[`scopeId compiler support should wrap dynamic slots 1`] = ` | ||
"import { createVNode as _createVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, renderList as _renderList, createSlots as _createSlots, openBlock as _openBlock, createBlock as _createBlock, withScopeId as _withScopeId } from \\"vue\\" | ||
const _withId = /*#__PURE__*/_withScopeId(\\"test\\") | ||
"import { createVNode as _createVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, renderList as _renderList, createSlots as _createSlots, openBlock as _openBlock, createBlock as _createBlock } from \\"vue\\" | ||
export const render = /*#__PURE__*/_withId((_ctx, _cache) => { | ||
export function render(_ctx, _cache) { | ||
const _component_Child = _resolveComponent(\\"Child\\") | ||
return (_openBlock(), _createBlock(_component_Child, null, _createSlots({ _: 2 /* DYNAMIC */ }, [ | ||
(_ctx.ok) | ||
? { | ||
name: \\"foo\\", | ||
fn: _withId(() => [ | ||
fn: _withCtx(() => [ | ||
_createVNode(\\"div\\") | ||
]) | ||
} | ||
: undefined, | ||
_renderList(_ctx.list, (i) => { | ||
return { | ||
name: i, | ||
fn: _withId(() => [ | ||
fn: _withCtx(() => [ | ||
_createVNode(\\"div\\") | ||
]) | ||
} | ||
}) | ||
]), 1024 /* DYNAMIC_SLOTS */)) | ||
})" | ||
}" | ||
`; | ||
|
||
exports[`scopeId compiler support should wrap named slots 1`] = ` | ||
"import { toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, createVNode as _createVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock, withScopeId as _withScopeId } from \\"vue\\" | ||
const _withId = /*#__PURE__*/_withScopeId(\\"test\\") | ||
"import { toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, createVNode as _createVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock } from \\"vue\\" | ||
export const render = /*#__PURE__*/_withId((_ctx, _cache) => { | ||
export function render(_ctx, _cache) { | ||
const _component_Child = _resolveComponent(\\"Child\\") | ||
return (_openBlock(), _createBlock(_component_Child, null, { | ||
foo: _withId(({ msg }) => [ | ||
foo: _withCtx(({ msg }) => [ | ||
_createTextVNode(_toDisplayString(msg), 1 /* TEXT */) | ||
]), | ||
bar: _withId(() => [ | ||
bar: _withCtx(() => [ | ||
_createVNode(\\"div\\") | ||
]), | ||
_: 1 /* STABLE */ | ||
})) | ||
})" | ||
`; | ||
|
||
exports[`scopeId compiler support should wrap render function 1`] = ` | ||
"import { createVNode as _createVNode, openBlock as _openBlock, createBlock as _createBlock, withScopeId as _withScopeId } from \\"vue\\" | ||
const _withId = /*#__PURE__*/_withScopeId(\\"test\\") | ||
export const render = /*#__PURE__*/_withId((_ctx, _cache) => { | ||
return (_openBlock(), _createBlock(\\"div\\")) | ||
})" | ||
}" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.