From 69661184d655f97a1684fff0f16712784c84bffd Mon Sep 17 00:00:00 2001 From: Ronnie Villarini <> Date: Sun, 23 Aug 2020 11:45:03 -0500 Subject: [PATCH 1/2] add vue-3 specific doc, add setup syntactic templating sugar. --- vue-3.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 vue-3.md diff --git a/vue-3.md b/vue-3.md new file mode 100644 index 0000000..62b93bb --- /dev/null +++ b/vue-3.md @@ -0,0 +1,32 @@ +# This document is for Vue-3 _specific_ syntax + +### Setup Template Attribute Syntax + +⚠️ This feature is still a WIP, and is an active RFC. [Follow the conversation](https://github.com/vuejs/rfcs/pull/182) to stay up to date with the lifecycle. + +This provides a better DX when using the setup function in Vue SFCs. +Type inference still works, and you don't need to use `defineComponent`.. +It's important to note that this is just **syntactic sugar**, and still get's compiled down to a component +using `defineComponent` and the `setup` function. + +```vue + +``` + +`props` and the `context` object work as well. +For TS inference, declare them using TS syntax. + +```vue + + ``` -In Vue 2.x you need to define components with `Vue.component` or `Vue.extend`: +In Vue 2.x you need to define components with `Vue.component` or `Vue.extend`: ```js