乐趣区

关于vue.js: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>


退出移动版