Skip to content

Conversation

johnsoncodehk
Copy link
Member

@johnsoncodehk johnsoncodehk commented Sep 24, 2020

When using Composition API, there is no need to write .value which will make the code much cleaner.

Transform Sample

For this code:

<template>
  <button @click="inc">{{ count }}</button>
  <p v-if="done">done!</p>
</template>

<script setup>
import { ref, computed } from 'vue'

export const count = ref(0)
export const done = computed(() => count.value > 100)
export const inc = () => count.value++
console.log(done.value)
</script>

When use no-ref, the <script> can replace to

<script setup noref>
export let count = 0 // @ref
export const done = count > 100 // @computed
export const inc = () => count++
console.log(done)
</script>

Rendered: 中文 | English

@johnsoncodehk
Copy link
Member Author

Close because we are looking for a better way.

@alamhubb
Copy link

Hello, in my opinion, this proposal is very good. Why is it closed? Can you help me with this? Thank you very much.

@vuejs vuejs locked as resolved and limited conversation to collaborators Oct 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants