2017-01-08 34 views
0

我使用SlateJS並嘗試使用將數據加載到一個const:imgData = data.get("file");常量在陣營始終具有值「默認值:對象」

這工作得很好,如果我不導入反應,但反應過來的時候是進口該對象包含下面的值。這是什麼價值?這是如何發生的?我如何避免這種情況?

default: Object 
    Children: Object 
    Component: ReactComponent(props, context, updater) 
    DOM: Object 
    PropTypes: Object 
    PureComponent: ReactPureComponent(props, context, updater) 
    __spread:() 
    cloneElement: (element, props, children) 
    createClass: (spec) 
    createElement: (type, props, children) 
    createFactory: (type) 
    createMixin: (mixin) 
    isValidElement: (object) 
    version: "15.4.1" 
    __proto__: Object 
    __proto__: Object 

非常感謝您提供的任何幫助。

+0

這是什麼 「文件」? – Codesingh

+0

這是一個包含圖像的斑點。在我執行data.get之後,const imgData包含blob,除非導入ReactJS,否則它將包含上面粘貼的內容。 – Slbox

+0

我認爲導入的反應是分配這個關鍵字。 – Codesingh

回答

-2

使用這一點,將真正幫助你:

imgData = JSON.stringify(data.get("file")); 
+0

謝謝,但問題是對象包含完全錯誤的值,而不是我需要它被串化。該對象應該只包含一個具有類型和大小屬性的blob。 – Slbox