Vue页面使用Vue3语法
HelloWorld.vue
<template>
<h1>{{ msg }}</h1>
<h1>醒醒,不能犯困!</h1>
<div>
<h1>次数:{{count}}</h1>
<button @click="dj">点击我,看看什么效果</button>
</div>
</template>
<!--Vue3的写法-->
<script setup>
//2.导入 Vue3中对象
import { ref } from 'vue'
//3.自定义属性
defineProps({
msg: String,
})
//4.定义变量
const count = ref(0)
//5.定义函数
const dj = () => {
count.value++;
alert("你目前点击:"+count.value);
}
</script>
<style scoped>
.read-the-docs {
color: #888;
}
</style>