mirror of https://github.com/vuejs/core.git
fix(compiler-sfc): fix defineExpose() codegen regression from #7949
This commit is contained in:
parent
ffe679c490
commit
a94072dd2c
|
@ -645,7 +645,7 @@ exports[`SFC compile <script setup> > defineExpose() 1`] = `
|
|||
"export default {
|
||||
setup(__props, { expose: __expose }) {
|
||||
|
||||
expose({ foo: 123 })
|
||||
__expose({ foo: 123 })
|
||||
|
||||
return { }
|
||||
}
|
||||
|
@ -1319,7 +1319,7 @@ exports[`SFC compile <script setup> > inlineTemplate mode > with defineExpose()
|
|||
setup(__props, { expose: __expose }) {
|
||||
|
||||
const count = ref(0)
|
||||
expose({ count })
|
||||
__expose({ count })
|
||||
|
||||
return () => {}
|
||||
}
|
||||
|
|
|
@ -276,7 +276,7 @@ defineExpose({ foo: 123 })
|
|||
// should generate correct setup signature
|
||||
expect(content).toMatch(`setup(__props, { expose: __expose }) {`)
|
||||
// should replace callee
|
||||
expect(content).toMatch(/\bexpose\(\{ foo: 123 \}\)/)
|
||||
expect(content).toMatch(/\b__expose\(\{ foo: 123 \}\)/)
|
||||
})
|
||||
|
||||
test('<script> after <script setup> the script content not end with `\\n`', () => {
|
||||
|
|
|
@ -1252,7 +1252,7 @@ export function compileScript(
|
|||
s.overwrite(
|
||||
callee.start! + startOffset,
|
||||
callee.end! + startOffset,
|
||||
'expose'
|
||||
'__expose'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue