vue.js 的核心是一個,允許采用簡潔的模板語法來聲明式將數(shù)據(jù)渲染進 DOM 的 系統(tǒng)。
<div id = "app">
{ { message } }
</div>
let app = new Vue({
el : ' #app ',
data: {
message : ' Hello Vue! '
}
})
綁定元素的特性
<div id ="app-2">
<span v-bind:title="message">
鼠標懸停幾秒鐘查看此處動態(tài)綁定的提示信息!
</span>
</div>
let app2 = new Vue({
el : '#app-2',
data: {
message: '頁面加載于' + new Date().toLocaleString();
}
})
條件與循環(huán)
<div id = "app-3">
<p v-if = "seen">現(xiàn)在你看到我了</p>
</div>
let app3 = new Vue({
el : '#app-3',
data :{
seen : true
}
})