Skip to content

Commit 60c01d7

Browse files
committed
📝 update parse function
1 parent af215e2 commit 60c01d7

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/compile-core/src/parse.ts

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const enum TagType {
1111
// children[0]是一个对象 包含type和content属性
1212
export const baseParse = (content) =>{
1313
const context = createParserContext(content)
14+
// 将这些子节点作为根节点的children
1415
return createRoot(parseChildren(context,[]));
1516
}
1617
// 将内容放置在source中
@@ -137,6 +138,9 @@ function parseInterpolation(context) {
137138
end,
138139
sl
139140
);
141+
if (closeIndex < 0) {
142+
console.error('插值缺少结束定界符')
143+
}
140144
// 11 获取到结束括号 }} 开始的位置
141145
// console.log('closeIndex',closeIndex);
142146
// console.log('context',context);

src/runtime-dom/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ const renderer: any = createRenderer({
3939
remove,
4040
setElementText
4141
});
42-
42+
function ensureRenderer() {
43+
return renderer || (renderer = createRenderer)
44+
}
4345
export function createApp(...args) {
4446
return renderer.createApp(...args);
4547
}

0 commit comments

Comments
 (0)