computed和methods

123 阅读1分钟

computed里面的函数和methods里面的区别? computed里面数据会缓存,多次调用只执行一次,methods会执行多次。 只有当再次数据改变时才会再次调用computed里面的函数

    watcher.dirty = true 时会执行computed,每次页面数据变化,update中都会把其变为true