简体   繁体   中英

MeteorJS: How to set value inside object inside ReactiveDict?

So, I have an object inside a ReactiveDict that I want to update:

dataSet = new ReactiveDict('dataSet');
dataSet.set({
 defaultInfo: {
  title: 'Default'
 }
});

updateTitle(title) { 
 // not sure what to put here to update the default title
 dataSet.set({  })
}

Thoughts? I'm using ES6.

So, I was able to create a solution, though not exactly what I had in mind.

I wasn't able to find a way to update the object, only replace it with a new object:

  updateTitle(title) {dataSet.set({
   defaultInfo: _.extend(dataSet.get('defaultInfo'), {title: title})
  })}

This is using underscoreJS for the _.extend

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM