Skip to content

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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
sfc Single File Components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant