
在vue.js中,什么时候用methods?什么时候用computed?什么时候用watch?感觉watch和computed有些类似呢。
methods是个方法,比如你点击事件要执行一个方法,这时候就用methods, computed是计算属性,实时响应的,比如你要根据data里一个值随时变化做出一些处理,就用computed。 我们可以将同一函数定义为一个 method ...
methods是个方法,比如你点击事件要执行一个方法,这时候就用methods, computed是计算属性,实时响应的,比如你要根据data里一个值随时变化做出一些处理,就用computed。 我们可以将同一函数定义为一个 method ...