<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="js/vue.js"></script>
</head>
<body>
<div id="app">
<a v-bind:href="blog">个人博客</a>
<input type="text" :value="name" :[attr]="name">
<p :id="true?'yes':'no'" v-on:click.once="cl">这个id为yes</p>
</div>
<script>
/*
指令:带有v-前缀的特殊属性
v-for v-if
并不是所有的指令都能添加参数,能添加参数的只有三个指令:v-bind v-on v-slot
只有三条指令可以缩写:v-bind v-on v-slot
可以添加修饰符的指令有:v-bind v-on v-model
*/
new Vue({
el: "#app",
data: {
name: '陈学辉',
age: 18,
blog: 'http://www.chenxuehui.com',
attr:'class', //要绑定的属性是什么
},
methods:{
cl(){
console.log('只会打印一次')
}
}
})
</script>
</body>
</html>