
批改狀態(tài):合格
老師批語:
<template>
<router-view></router-view>
<router-link to="/">首頁 </router-link>
<router-link to="about"> 關于我們</router-link>
<router-link to="php"> PHP頁面</router-link>
<router-link to="user"> 用戶頁面</router-link>
<div>
變量:{{name}}
<hr>
方法:<button @click="fun()"> 點擊</button>
<hr>
點擊計數(shù):<button @click="fun2()">{{num}}</button>
</div>
<hr>
<h4>引入組件,組件包含小組件</h4>
<phpxiaojimu></phpxiaojimu>
</template>
<!--組合式Api-->
<script setup>
// reactive,ref 把數(shù)據(jù)轉為響應式
import {reactive,ref} from "vue";
// 引入組件
import phpxiaojimu from './components/php.vue'
let name = '隔壁老王';
const fun =()=>{
alert('點擊了方法!')
};
let num = ref(0)
// 點擊進行累加2方法
const fun2 = ()=>{
console.log(num)
num.value += 2;
}
// 使用組件:components
components :{
phpxiaojimu
}
</script>
<style >
.red {
color: red;
}
</style>
Copyright 2014-2025 http://ipnx.cn/ All Rights Reserved | php.cn | 湘ICP備2023035733號