Home >Web Front-end >Vue.js >Vue 3.2 is released, stand up and continue learning!
Vue framework founder You Yuxi announced the Vue 3.2 version on the official blog and commented on his personal social account:
Then some users complained below that they couldn’t learn anymore!
Haha, a group of lovely programmers~
As for the user’s question, “If you don’t want to expose all variables or methods, can you just give up the setup syntax sugar? ", You Yuxi reminded: "Understand the difference between exposing to the template and exposing to the outside!"
Let's take a look at what to expect from the new version. A long-awaited new feature!
Vue 3.2 includes many important new features and performance improvements. Shortly after the new version was released, another Vue 3.2.1 update was added to the official CHANGELOG, with only a bug fix.
Two new members of SFC have successfully graduated from experimental status to stable status
Two new features of single file components (SFCs, aka .vue files) Status, they are:
: New compilation syntax sugar, in short, script setup is equivalent to putting the code in when compiling and running Run in the setup function, and then define the exported variables into the context and include them in the returned object; <style> v-bind</style>
: That is, in SFC's <style></style>
Some CSS inline styles can be bound to the tag. The following is a case component that uses these two function codes together:
<script>import { ref } from 'vue'const color = ref('red')</script><template> <button> Color is: {{ color }} </button></template><style>button { color: v-bind(color);}</style>
Interested students can try it in the SFC Playground, or read the official documentation:
https://v3.vuejs.org/api/sfc-script-setup.html
https://v3.vuejs.org/ api/sfc-style.html#state-driven-dynamic-css
In addition, Vue officially built a new RFC based on <script setup></script>
, Aimed at improving the ref experience through the compiler, experience feedback address: https://github.com/vuejs/rfcs/discussions/369
Vue 3.2 introduces a newdefineCustomElement
method, you can use the Vue component API to easily create native custom elements:
import { defineCustomElement } from 'vue'const MyVueElement = defineCustomElement({ // normal Vue component options here})// Register the custom element.// After registration, all `<my-vue-element>` tags// on the page will be upgraded.customElements.define('my-vue-element', MyVueElement)</my-vue-element>
This API allows developers to create Vue-driven UI component libraries, which can be used alone or in conjunction with other frameworks For specific instructions on how to use it, please refer to the official documentation: https://v3.vuejs.org/guide/web-components.html
@vue/server-renderer package provides an ES module build that can be decoupled from the Node.js built-in module. This allows @vue/server-renderer to be bundled and used in non-Node.js runtimes such as CloudFlare Workers or Service Workers.
@vue/server-renderer documentation for more details: https://github.com/vuejs/vue-next/tree/master/packages/server-renderer#streaming-api
This is a low-level API for library authors. Interested students can check the official RFC for more detailed internal principles and cases.
Related links:
Recommended learning: "javascript basic tutorial", "The latest 5 vue.js video tutorial selections"
The above is the detailed content of Vue 3.2 is released, stand up and continue learning!. For more information, please follow other related articles on the PHP Chinese website!