Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Ref sugar (take 2) #368

Closed
wants to merge 6 commits into from
Closed

Ref sugar (take 2) #368

wants to merge 6 commits into from

Conversation

yyx990803
Copy link
Member

@yyx990803 yyx990803 commented Aug 4, 2021

Summary

Introduce a compiler-based syntax sugar for using refs without .value:

<script setup>
  // declaring a variable that compiles to a ref
  let count = $ref(1)

  console.log(count) // 1

  function inc() {
    // the variable can be used like a plain value
    count++
  }
</script>

<template>
  <button @click="inc">{{ count }}</button>
</template>

@yyx990803 yyx990803 added the sfc Single File Components label Aug 4, 2021
@vuejs vuejs locked and limited conversation to collaborators Aug 4, 2021
@yyx990803
Copy link
Member Author

The original proposal has been updated and merged with props destructure. The discussion is still in #369

@yyx990803 yyx990803 closed this Dec 12, 2021
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
sfc Single File Components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant