Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

New <script setup> and ref sugar implementation #2532

Merged
merged 13 commits into from
Nov 17, 2020
Merged

New <script setup> and ref sugar implementation #2532

merged 13 commits into from
Nov 17, 2020

Conversation

yyx990803
Copy link
Member

@yyx990803 yyx990803 commented Oct 30, 2020

Related RFC: vuejs/rfcs#222

@github-actions
Copy link

github-actions bot commented Oct 30, 2020

Size report

Path Size
vue.global.prod.js 40.15 KB (-0.35% 🔽)
runtime-dom.global.prod.js 26.44 KB (0%)
size-check.global.prod.js 15.95 KB (0%)

@yyx990803
Copy link
Member Author

@knightly-bot build this

@knightly-bot
Copy link

Nightly Build

🌒 Knightly build enabled, release every night at 00:00 UTC (skip if no change)

📦 npm package

@dajpes
Copy link

dajpes commented Nov 4, 2020

How Can I use this new syntax in a new vue project?

@antfu
Copy link
Member

antfu commented Nov 6, 2020

Build with Vite is not working (Dev OK). Repro: https://github.com/antfu/vite-starter-ref-sugar

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

ref: count = 0
ref: doubled = computed(() => count * 2)

const inc = () => count++
const dec = () => count -= 1
</script>

<template>
  <div>{{ count }} * 2 = {{ doubled }}</div>
  <button @click="dec">Dec</button>
  <button @click="inc">Inc</button>
</template>

Dev

image

Build

image

Error: ReferenceError: count is not defined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants