setupSFC not working with ref #624
-
Working with same env like in #429.
Can't use a ref() or I get this error:
const myName = ref<string>('Vue Macros')
export default () => (
<div>
<h1 class="text-3xl font-bold underline">
Hello {myName}
<button onClick={() => myName = 'Nuxt Macros'}>Change Name</button>
</h1>
</div>
) |
Beta Was this translation helpful? Give feedback.
Answered by
angelhdzmultimedia
Feb 4, 2024
Replies: 1 comment 1 reply
-
Solved?Oooh right, it's not auto unwrapping the ref, so I have to use
const myName = ref<string>('Vue Macros')
export default () => (
<div>
<h1 class="text-3xl font-bold underline">
Hello {myName.value}
<button onClick={() => myName.value = 'Nuxt Macros'}>Change Name</button>
</h1>
</div>
) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
sxzz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Solved?
Oooh right, it's not auto unwrapping the ref, so I have to use
.value
. Wondering why...~/pages/index.setup.tsx