为什么在cube的设计的时候inputValue写在了data而不是计算属性里面
来源:1-1 导学
李行知
2018-08-07
在cube的设计中有
inputValue: this.data() {
return {
inputValue: this.value,,
value(newValue) {
this.inputValue = newValue
},
inputValue(newValue) {
this.$emit(EVENT_INPUT, newValue)
},这样的设计
包括element跟vux也是这种类型的设计
这种类型的设计比起
computed: {
currentValue: {
get () {
return this.value ? this.value : ''
},
set (v) {
this.$emit('input', v)
},
},
},这种放入到computed的设计有什么好处呢?
写回答
1回答
-
通常我们很少设置计算属性的 setter 吧
022018-08-08
相似问题