webveuje/vuenew/vue1.html
2021-03-23 10:58:10 +08:00

53 lines
1.5 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>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
{{ message }}
<a v-bind:href="link" :title="dabai"> 大白</a> <!-- 绑定属性 -->
<div>
当前的时间是:{{nowtime}}
</div>
<button v-on:click="greet('asd')"> asd</button>
<button @click="tap">con</button>
<p v-if="ifshow">闪耀暖暖</p>
<p v-else>我是欧皇</p>
<button @click="ou">我要做欧皇</button>
</div>
<script>
var app = new Vue({
el: '#app', //绑定html元素的标志
data: {
message: 'Hello world!',
link:"www.kangdabai.com",
dabai:"lalala",
ifshow:1,
nowtime:new Date().getFullYear()+'/'+parseInt(new Date().getMonth()+1)+'/'+new Date().getDate()
},
methods:{
greet:function (e){
alert("哦哈呦,"+e)
},
tap:function(){
console.log("conn")
},
ou:function(){
this.ifshow==1?this.ifshow=0:this.ifshow=1
}
}
})
</script>
</body>
</html>