vue3初体验代码
作者:互联网
t<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
[v-cloak]{
display:none;
}
</style>
</head>
<body>
<div id="app" >
<p v-model="name">{{name}}</p>
<my></my>
<div @click.self="calc1">
<a @click="calc">xxx
<a @click="calc2"></a>
</a>
</div>
<select name="" id="select1" v-model="cs">
<option value="+">+</option>
<option value="-">-</option>
<option value="*">*</option>
<option value="/">/</option>
</select>
</div>
</body>
<script src="https://unpkg.com/vue@next"></script>
<script>
const vm=Vue.createApp({
data(){
return {count:4,
name:"aaa",
gogogo:"color:red;",
cs:'+'
}
},
created(){
console.log("xxxx");
},
beforeCreate(){
},
methods:{
calc(){
console.log("111");
console.log(this.cs);
},
calc1(){
console.log("222");
},
calc2(){
console.log("333");
}
},
components:{
my:{
template:'<h2>xxxxx</h2>'
}
}
}).mount("#app");
</script>
</html>
标签:初体验,console,log,代码,beforeCreate,vue3,cs,name 来源: https://blog.csdn.net/weixin_47039303/article/details/121521318