<template>
<!-- 响应式数据变量是双项绑定 -->
<view>{{num}}</view>
<view>{{string}}</view>
<view>{{arry[2]}}</view>
<view>{{obj.name}}</view>
</template>
<script setup>
// 使用ref定义响应式数据变量,必须导入ref
import {ref} from "vue";
let num = ref(5);
setInterval(()=>{
num.value++;
}, 1000)
let string = ref("Hello World");
let arry = ref([1,2,3,4,5,6,7,8]);
let obj = ref({name:"王五", age:18});
</script>
<style lang="scss">
</style>