添加新的计算值,我在VUEVUE计算:从创建生命周期挂钩
我试图推动与名称的计算数据初学者,这个名字来自vuex其中谈到创建实例后
如何将新的计算属性推到created()钩子中的实例?
下面是代码
computed: {
// 3 - i want to extract the object properties here computed
// that is easy bu using spread operator ...
// Problem : vue intialize computed before the created() hook
// so the spreed work befor passing the filling the object
...this.mapGettersObj
},
created(){
// 1- i can access only this line after creating the object
this.stocks = this.$store.state
let arr=[]
for (let stock in this.stocks){
arr.push(stock+'Getter')
}
// 2 - mapGetters returns an object
this.mapGettersObj=mapGetters(arr)
}
如果我能创建将解决这个问题
请包括你的工作代码,并表示你已经试过了没有奏效。 – PatrickSteele
我已经插入的代码 –