admin管理员组文章数量:1352828
I defined a mobx map as below:
@observable editors = observable.map();
then I added object on the editors
as below:
editors.set(key, {
alias: 'alias-1',
message: 'hello',
})
when I get the object from editor
as below:
let myEditor = editors.get(key)
the returned object myEditor
has some builtin functions such as:
$mobx:ObservableObjectAdministration
get alias:function ()
set alias:function ()
get message:function ()
set message:function ()
I wander how I can get a plain javascript object from editor
?
I defined a mobx map as below:
@observable editors = observable.map();
then I added object on the editors
as below:
editors.set(key, {
alias: 'alias-1',
message: 'hello',
})
when I get the object from editor
as below:
let myEditor = editors.get(key)
the returned object myEditor
has some builtin functions such as:
$mobx:ObservableObjectAdministration
get alias:function ()
set alias:function ()
get message:function ()
set message:function ()
I wander how I can get a plain javascript object from editor
?
1 Answer
Reset to default 8You can use toJS.
Example
class MyStore {
@observable editors = observable.map({});
}
const myStore = new MyStore();
myStore.editors.set('example', {
alias: 'alias-1',
message: 'hello'
});
console.log(toJS(myStore.editors));
本文标签: javascriptHow to get a plain object from mobx objectStack Overflow
版权声明:本文标题:javascript - How to get a plain object from mobx object? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743916549a2561320.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论