前言

平时没怎么见过的写法:

<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

至于其他的暂时用不到,没有去了解。