美文网首页
Vuejs.org笔记

Vuejs.org笔记

作者: 翌子涵 | 来源:发表于2017-03-05 16:00 被阅读36次

实例生命周期-created

Vue实例创建时有一系列初始化过程,如建立数据观察、编译模板、创建必要的数据绑定。

created: function() {}
// 生命周期钩子,给自定义逻辑提供运行机会

计算属性-computed

computed: {
// 计算属性
  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'
  }
}

相关文章

网友评论

      本文标题:Vuejs.org笔记

      本文链接:https://www.haomeiwen.com/subject/ugcegttx.html