56 lines
1.2 KiB
HTML
56 lines
1.2 KiB
HTML
<!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>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="app">
|
|
<h2 ref="test">{{ test }}</h2>
|
|
</div>
|
|
</body>
|
|
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14"></script>
|
|
<script>
|
|
var vm = new Vue({
|
|
el: '.app',
|
|
data: {
|
|
test:'你好'
|
|
},
|
|
created() {
|
|
console.log(this.$refs.test);
|
|
},
|
|
mounted() {
|
|
this.getTest
|
|
console.log(this.getHello);
|
|
console.log(this.$refs.test);
|
|
},
|
|
updated(){
|
|
console.log("数据更新了");
|
|
},
|
|
methods:{
|
|
gttTest(){
|
|
console.log("gttTest");
|
|
}
|
|
},
|
|
computed:{
|
|
getHellow(){
|
|
console.log("getHellow");
|
|
return 1
|
|
}
|
|
},
|
|
watch:{
|
|
test(newVal, oldVal){
|
|
console.log("newVal: ", newVal);
|
|
console.log("oldVal: ", oldVal);
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
</script>
|
|
|
|
</html> |