P24. vue3 组合式api语法糖
文章目录

- App.vue
<script setup>
import Content from "./components/Content.vue";
</script>
<template>
<div>
<Content />
</div>
</template>



定义相应式变量还是需要vue引入
<script setup>
import Content from "./components/Content.vue";
import { ref } from "vue";
const b=ref(100000)
const a=20;
console.log(a);
</script>
<template>
<div>
<h2>{{a}}</h2>
<h2>{{b}}</h2>
<Content />
</div>
</template>



评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论