简体   繁体   中英

The data edited in Slate.js editor saved as [Object],[Object] in the data based.How to make this Object as meaningful content?

I am using a framework of slate.js named slate-plugins to build an editor. It worked to save the data in the database but the data saved as [Obj],[Obj] in the database instead of HTML data. Hence on calling the data at the frontend it is showing as [Obj][Obj] and not the actual content that I wrote.What should I do now

Your database (probably) can only store strings. So you have to serialize it before the save using JSON.stringify(value) .

When you need to do the opposite operation, use JSON.parse(value_from_database) to get an object Slate can understand.

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