一、setup函数
1.setup函数是反人类的,使用麻烦
需要先声明setup函数,再将响应式数据和方法返回,setup函数会很臃肿
2.script setup标签
(1)不用声明setup函数
(2)定义好数据和方法后,可以直接使用,不用再返回
3.vue3 script setup模板
打开file -> preference ->user snippets ->new snippets
输入模板配置jason
{
"Print to console": {
"prefix": "vue-setup",
"body": [
"<template>",
" <div></div>",
"</template>",
"<script setup></script>",
"<style lang='scss' scoped>",
"</style>"
],
"description": "vue setup template"
}
}