Skip to content

setupSFC not working with ref #624

Closed Answered by angelhdzmultimedia
angelhdzmultimedia asked this question in Q&A
Discussion options

You must be logged in to vote

Solved?

Oooh right, it's not auto unwrapping the ref, so I have to use .value. Wondering why...

~/pages/index.setup.tsx

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>
)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@sxzz
Comment options

Answer selected by sxzz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants