问题描述
我正在尝试加入stimulusJS
this.itemsList = this.itemsRefList.snapshotChanges().pipe(
map(changes =>{
let temp = changes.map(c => ({
product: c.payload.key,firmware: c.payload.child('latest').val(),ref: c.payload.ref,}))
//map is done,call other code here
this.callOtherMethodHere();
return temp;
})
);
我希望能够在连接时获取此值,因为我想知道它是否已更改。
解决方法
您的代码在const
函数范围内声明了connect()
变量。但是您应该改为使用this
( Stimulus Controller )属性:
...
connect() {
this.fooValue = this.fooTarget.value
...