Home >Web Front-end >JS Tutorial >Some things to note when developing with vue.js_Others

Some things to note when developing with vue.js_Others

WBOY
WBOYOriginal
2016-05-16 15:03:282216browse

About responsiveness

Vue’s two-way binding is based on responsiveness, that is, adding getter and setter methods to the properties of a Vue object, and processing two-way binding in these methods. But this method will cause the following pitfalls

Object responsive

If the properties in Vue are Objects, or arrays, and there are Objects in the array, then it is best to define all the properties that need to be used for these Objects at the beginning. If you add properties again during operation, this property If it is not responsive, it will not implement two-way binding, for example:

const vm = new Vue({
  data: {
    a: {
      text: 'aaa'
    }
  }
})
vm.a.b = 'ccc'

In this case, the b attribute of a is not responsive, so it will not be bound in both directions

Date object

Operations on Date objects are not responsive

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn