computed侦听的值可以在watch和methods中引用并赋值
vue computed依赖的值是可以在watch和methods中引用并赋值的。
我自己的代码是把元素样式用计算属性返回。
类似于
<div :style="styleObj></div>
data() {return {zidingyiWidth: 0,};},
computed: {styleObj() {return this.zidingyiWidth}
}
在watch和methods中可以打印this.styleObj,然后进行赋值。
但是三者执行则有先后顺序。这篇博客有讲vue computed/methods/watch执行顺序。