<script>import{h}from'vue'//返回一个渲染函数exportdefault{name:"app",setup(){//就是测试一下setup 失去了响应式let name ='11'let age =10functionsayHello(){}}return{//就直接使用插值语法
name,
age,
sayHello
}}<script>
ref 函数
<script>import{h}from'vue'//返回一个渲染函数exportdefault{name:"app",setup(){//就是测试一下setup 失去了响应式let name =ref('11')//引用实现对象let age =ref(10)functionsayHello(){
name.value ='tt'//动态修改}}return{//就直接使用插值语法
name,
age,
sayHello
}}<script>