setup 语法糖
前言
平时没怎么见过的写法:
<script setup>
</script>
但用起来相当爽,减少了很多代码量。
Ref
<script setup>
import { ref } from 'vue';
const testData = ref('')
// 使用方法
testData.value = 'Hello'
</script>
<template>
<div>{{testData}}</div>
</template>
Props
const props = defineProps({
myData: String
});
// 使用方法
const test = props.myData
至于其他的暂时用不到,没有去了解。
- 感谢你赐予我前进的力量
赞赏者名单
因为你们的支持让我意识到写文章的价值🙏
本文是原创文章,采用 CC BY-NC-ND 4.0 协议,完整转载请注明来自 LinJHS
评论
匿名评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果

