<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="../js/vue.js"></script>
</head>
<body>
<div id="app">
<h1>{{message}}</h1>
<h1>{{tags}}</h1>
<ul>
<li v-for="tag in tags">{{tag}}</li>
</ul>
<h1>{{log}}</h1>
<button v-on:click="bt1">bt1</button>
<button @click="log='271'">bt2</button>
</div>
<script>
//全局配置
const HelloApp = {
data() { //定义数据
return {
message: 'hello door',
tags: ["mid","top","left"],
log: ''
}
},
methods: {
bt1() {
this.log='ppts'
}
}
}
//实例对象
const app = Vue.createApp(HelloApp).mount('#app')
</script>
</body>
</html>