mirror of https://github.com/vuejs/core.git
parent
f793faaeb7
commit
15e889afaf
|
@ -48,8 +48,9 @@ export const transformModel: DirectiveTransform = (dir, node, context) => {
|
||||||
const maybeRef =
|
const maybeRef =
|
||||||
!__BROWSER__ &&
|
!__BROWSER__ &&
|
||||||
context.inline &&
|
context.inline &&
|
||||||
bindingType &&
|
(bindingType === BindingTypes.SETUP_LET ||
|
||||||
bindingType !== BindingTypes.SETUP_CONST
|
bindingType === BindingTypes.SETUP_REF ||
|
||||||
|
bindingType === BindingTypes.SETUP_MAYBE_REF)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!expString.trim() ||
|
!expString.trim() ||
|
||||||
|
|
|
@ -673,6 +673,26 @@ defineExpose({ foo: 123 })
|
||||||
assertCode(content)
|
assertCode(content)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('v-model should not generate ref assignment code for non-setup bindings', () => {
|
||||||
|
const { content } = compile(
|
||||||
|
`<script setup>
|
||||||
|
import { ref } from 'vue'
|
||||||
|
const count = ref(0)
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() { return { foo: 123 } }
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<input v-model="foo">
|
||||||
|
</template>
|
||||||
|
`,
|
||||||
|
{ inlineTemplate: true }
|
||||||
|
)
|
||||||
|
expect(content).not.toMatch(`_isRef(foo)`)
|
||||||
|
})
|
||||||
|
|
||||||
test('template assignment expression codegen', () => {
|
test('template assignment expression codegen', () => {
|
||||||
const { content } = compile(
|
const { content } = compile(
|
||||||
`<script setup>
|
`<script setup>
|
||||||
|
|
Loading…
Reference in New Issue