2023年3月29日 加入方法形式

This commit is contained in:
bai 2023-03-29 10:43:46 +08:00
parent 2f9f179e07
commit 5808eba02c
1 changed files with 22 additions and 8 deletions

View File

@ -1,15 +1,29 @@
<template> <template>
<div> <a-card>
{{ state }} <div>
<a-button type="error" @click="() => state.count++">点击+1</a-button> <h1>首页</h1>
<a-button type="error" @click="() => i++">点击+1</a-button> </div>
<div>
<RouterLink to="/site/index2">跳转到子页</RouterLink> {{ state }}
</div> <a-button type="primary" @click="() => state.count++">点击+1</a-button>
</div>
<div>
{{ i }}
<a-button type="primary" @click="changeClick">点击+1</a-button>
</div>
<div>
<RouterLink to="/site/index2">跳转到子页</RouterLink>
</div>
</a-card>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue'; import { ref } from 'vue';
// reactive
const state = ref({ count: 0 }); const state = ref({ count: 0 });
const i = ref(1); let i = ref(1);
function changeClick() {
i.value++;
}
</script> </script>