mirror of https://github.com/vuejs/core.git
fix(compiler-sfc): fix import usage check for kebab-case same name shorthand binding
fix #11745 close #11754
This commit is contained in:
parent
d86fe0ec00
commit
0f7c0e5dc0
|
@ -250,3 +250,18 @@ test('check when has explicit parse options', () => {
|
||||||
)
|
)
|
||||||
expect(content).toMatch('return { get x() { return x } }')
|
expect(content).toMatch('return { get x() { return x } }')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// #11745
|
||||||
|
test('shorthand binding w/ kebab-case', () => {
|
||||||
|
const { content } = compile(
|
||||||
|
`
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { fooBar } from "./foo.ts"
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<div :foo-bar></div>
|
||||||
|
</template>
|
||||||
|
`,
|
||||||
|
)
|
||||||
|
expect(content).toMatch('return { get fooBar() { return fooBar }')
|
||||||
|
})
|
||||||
|
|
|
@ -62,7 +62,7 @@ function resolveTemplateUsedIdentifiers(sfc: SFCDescriptor): Set<string> {
|
||||||
extractIdentifiers(ids, prop.exp)
|
extractIdentifiers(ids, prop.exp)
|
||||||
} else if (prop.name === 'bind' && !prop.exp) {
|
} else if (prop.name === 'bind' && !prop.exp) {
|
||||||
// v-bind shorthand name as identifier
|
// v-bind shorthand name as identifier
|
||||||
ids.add((prop.arg as SimpleExpressionNode).content)
|
ids.add(camelize((prop.arg as SimpleExpressionNode).content))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
|
|
Loading…
Reference in New Issue