index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Vue.js</title>
<script src="https://unpkg.com/vue@2.5.16/dist/vue.js"></script>
<link rel="stylesheet" href="style.css">
</head>
<body>
<!--vue-app是根容器-->
<div id="vue-app">
<p>Name:{{ name }}</p>
<p>Job:{{ job }}</p>
<h1>{{ greet('morning') }}</h1>
<a v-bind:href="website">web</a>
<input type="text" v-bind:value="job">
<p v-html="websiteTag"></p>
</div>
<script src="app.js"></script>
</body>
</html>
app.js
//实例化vue对象
new Vue({
el:"#vue-app",
data:{
name:"siyu",
job:"web开发",
website:"http://www.baidu.com",
websiteTag:"<a href='http://www.baidu.com'>The new step</a>"
},
methods:{
greet:function(time) {
return 'Good ' + time + " " +this.name + "!";
}
}
});
/*
*el:element 元素,html中的根容器元素
*data 用于数据的存储
*methos 用于存储各种方法
*data-binding:给属性绑定对应的值
*/
style.css