mirror of https://github.com/vuejs/core.git
fix(compiler-sfc): fix prefixIdentifier default value
This commit is contained in:
parent
fe008152c0
commit
3d6f01571b
|
@ -234,3 +234,19 @@ test('namespace / dot component usage', () => {
|
|||
expect(content).toMatch('return { get Foo() { return Foo } }')
|
||||
assertCode(content)
|
||||
})
|
||||
|
||||
test('check when has explicit parse options', () => {
|
||||
const { content } = compile(
|
||||
`
|
||||
<script setup lang="ts">
|
||||
import { x } from './x'
|
||||
</script>
|
||||
<template>
|
||||
{{ x }}
|
||||
</template>
|
||||
`,
|
||||
undefined,
|
||||
{ templateParseOptions: {} },
|
||||
)
|
||||
expect(content).toMatch('return { get x() { return x } }')
|
||||
})
|
||||
|
|
|
@ -133,7 +133,7 @@ export function parse(
|
|||
pad = false,
|
||||
ignoreEmpty = true,
|
||||
compiler = CompilerDOM,
|
||||
templateParseOptions = { prefixIdentifiers: true },
|
||||
templateParseOptions = {},
|
||||
} = options
|
||||
|
||||
const descriptor: SFCDescriptor = {
|
||||
|
@ -152,6 +152,7 @@ export function parse(
|
|||
const errors: (CompilerError | SyntaxError)[] = []
|
||||
const ast = compiler.parse(source, {
|
||||
parseMode: 'sfc',
|
||||
prefixIdentifiers: true,
|
||||
...templateParseOptions,
|
||||
onError: e => {
|
||||
errors.push(e)
|
||||
|
|
Loading…
Reference in New Issue