123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <template>
- <h2>ref 和 setup的基本使用</h2>
- <h3>{{ count }}</h3>
- <button @click="updateCount">按钮</button>
- </template>
- <script lang="ts">
- import { defineComponent,ref } from 'vue'
- export default defineComponent({
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- setup () {
-
-
-
-
-
-
-
- const count = ref(0)
- function updateCount(){
-
-
- console.log(count)
- count.value ++
- }
- return {
- count,
- updateCount
- }
- }
- })
- </script>
- <style scoped>
- </style>
|