
批改狀態(tài):合格
老師批語:完成的不錯, 繼續(xù)加油
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>1117作業(yè)</title>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<!-- 實例演示vue中常用的術(shù)語與使用方式-->
</head>
<body>
<!--1. 掛載點-->
<div id="app">
{{ name }}
<button @click="obj($event)">點擊顯示方法</button>
</div>
<script>
// 2. 應用實例
const app = Vue.createApp({
// 3. 根組件配置項
data() {
return{
name:'李世民',
hello:'hello,你好VUE!',
}
},
// 方法
methods :{
obj (v) {
console.log(this.hello);
}
},
})
// 4.根組件實例: 應用實例與掛載點進行綁定
let vm = app.mount('#app')
// 5. 響應式 :沒有進行DOM操作,選擇內(nèi)容,也沒有進行事件綁定,就可以更新內(nèi)容,全靠vue
vm.name = '趙云';
vm.hello ='hello,響應式 VUE'
</script>
</body>
</html>
Copyright 2014-2025 http://ipnx.cn/ All Rights Reserved | php.cn | 湘ICP備2023035733號