fix: use parser from runtime-dom

This commit is contained in:
三咲智子 Kevin Deng 2023-11-27 14:13:09 +08:00
parent 0867ca0139
commit 339a658cef
No known key found for this signature in database
GPG Key ID: 69992F2250DFD93E
2 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,7 @@ import {
type CodegenResult, type CodegenResult,
type CompilerOptions, type CompilerOptions,
type RootNode, type RootNode,
baseParse, parse,
} from '@vue/compiler-dom' } from '@vue/compiler-dom'
import { isString } from '@vue/shared' import { isString } from '@vue/shared'
import { transform } from './transform' import { transform } from './transform'
@ -13,7 +13,7 @@ export function compile(
template: string | RootNode, template: string | RootNode,
options: CompilerOptions = {}, options: CompilerOptions = {},
): CodegenResult { ): CodegenResult {
const ast = isString(template) ? baseParse(template, options) : template const ast = isString(template) ? parse(template, options) : template
const ir = transform(ast, options) const ir = transform(ast, options)
return generate(ir, options) return generate(ir, options)
} }

View File

@ -282,7 +282,7 @@ function transformElement(ctx: TransformContext<ElementNode>) {
if (children.length) transformChildren(ctx) if (children.length) transformChildren(ctx)
// TODO remove unnecessary close tag, e.g. if it's the last element of the template // TODO remove unnecessary close tag, e.g. if it's the last element of the template
if (!node.isSelfClosing || !isVoidTag(tag)) { if (!isVoidTag(tag)) {
ctx.template += `</${tag}>` ctx.template += `</${tag}>`
} }
} }