實(shí)例生命周期-created
Vue實(shí)例創(chuàng)建時(shí)有一系列初始化過程霞赫,如建立數(shù)據(jù)觀察、編譯模板肥矢、創(chuàng)建必要的數(shù)據(jù)綁定端衰。
created: function() {}
// 生命周期鉤子,給自定義邏輯提供運(yùn)行機(jī)會(huì)
計(jì)算屬性-computed
computed: {
// 計(jì)算屬性
b: function() {
return this.a + 1
}
}
Class與Style綁定
<div v-bind:class="[classA, {isB ? classB : " "}]"></div>
<div v-bind-style="styleObject"></div>
data: {
styleObject: {
color: 'red',
fontSize: '14px'
}
}