在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問(wèn)答/Python  HTML/ zan-design出現(xiàn)react dnd報(bào)錯(cuò)

zan-design出現(xiàn)react dnd報(bào)錯(cuò)

報(bào)錯(cuò)信息:

Warning: Component EditorCard declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?

Warning: Failed context type: The context `dragDropManager` is marked as required in `DropTarget(DragSource(EditorCardItem))`, but its value is `undefined`.
    in DropTarget(DragSource(EditorCardItem)) (created by EditorCard)
    in div (created by EditorCard)
    in EditorCard (created by ShowCaseEditor)
    in div (created by ShowCaseEditor)
    in ShowCaseEditor (created by Droppable)
    in div (created by DesignEditorItem)
    in DesignEditorItem (created by Droppable)
    in div (created by DesignPreviewItem)
    in DesignPreviewItem (created by Droppable)
    in div (created by Droppable)
    in DroppableDimensionPublisher (created by Connect(DroppableDimensionPublisher))
    in Connect(DroppableDimensionPublisher) (created by Droppable)
    in Droppable (created by Connect(Droppable))
    in Connect(Droppable) (created by DesignPreview)
    in div (created by DesignPreview)
    in DragDropContext (created by DesignPreview)
    in DesignPreview (created by Design)
    in div (created by Design)
    in Design (at index.js:141)
    in div (at index.js:139)
    in Create (created by Route)
    in Route (created by withRouter(Create))
    in withRouter(Create) (created by Route)
    in Route (at routes.js:21)
    in Switch (at routes.js:20)
    in Router (created by BrowserRouter)
    in BrowserRouter (at routes.js:19)
    in Routes (at index.js:13)
    
    Uncaught Error: Could not find the drag and drop manager in the context of DragSource(EditorCardItem). Make sure to wrap the top-level component of your app with DragDropContext. Read more: http://react-dnd.github.io/react-dnd/docs-troubleshooting.html#could-not-find-the-drag-and-drop-manager-in-the-context
    at invariant (browser.js:38)
    at new DragDropContainer (decorateHandler.js:102)
    at constructClassInstance (react-dom.development.js:6355)
    at updateClassComponent (react-dom.development.js:7839)
    at beginWork (react-dom.development.js:8225)
    at performUnitOfWork (react-dom.development.js:10224)
    at workLoop (react-dom.development.js:10288)
    at HTMLUnknownElement.callCallback (react-dom.development.js:542)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:581)
    at invokeGuardedCallback (react-dom.development.js:438)
    at renderRoot (react-dom.development.js:10366)
    at performWorkOnRoot (react-dom.development.js:11014)
    at performWork (react-dom.development.js:10967)
    at requestWork (react-dom.development.js:10878)
    at scheduleWorkImpl (react-dom.development.js:10732)
    at scheduleWork (react-dom.development.js:10689)
    at Object.enqueueSetState (react-dom.development.js:6212)
    at Design../node_modules/react/cjs/react.development.js.Component.setState (react.development.js:237)
    at Design.onSelect (Design.js:773)
    at onAdd (Design.js:817)
    at DesignEditorAddComponent.js:100
    
    The above error occurred in the <DropTarget(DragSource(EditorCardItem))> component:
    in DropTarget(DragSource(EditorCardItem)) (created by EditorCard)
    in div (created by EditorCard)
    in EditorCard (created by ShowCaseEditor)
    in div (created by ShowCaseEditor)
    in ShowCaseEditor (created by Droppable)
    in div (created by DesignEditorItem)
    in DesignEditorItem (created by Droppable)
    in div (created by DesignPreviewItem)
    in DesignPreviewItem (created by Droppable)
    in div (created by Droppable)
    in DroppableDimensionPublisher (created by Connect(DroppableDimensionPublisher))
    in Connect(DroppableDimensionPublisher) (created by Droppable)
    in Droppable (created by Connect(Droppable))
    in Connect(Droppable) (created by DesignPreview)
    in div (created by DesignPreview)
    in DragDropContext (created by DesignPreview)
    in DesignPreview (created by Design)
    in div (created by Design)
    in Design (at index.js:141)
    in div (at index.js:139)
    in Create (created by Route)
    in Route (created by withRouter(Create))
    in withRouter(Create) (created by Route)
    in Route (at routes.js:21)
    in Switch (at routes.js:20)
    in Router (created by BrowserRouter)
    in BrowserRouter (at routes.js:19)
    in Routes (at index.js:13)

Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://fb.me/react-error-boundaries to learn more about error boundaries.

Warning: Can only update a mounted or mounting component. This usually means you called setState, replaceState, or forceUpdate on an unmounted component. This is a no-op.

Please check the code for the Design component.

問(wèn)題出現(xiàn):

  1. https://github.com/youzan/zen... 跑起來(lái)沒(méi)有問(wèn)題的
  2. 使用creaet-react-app 創(chuàng)建項(xiàng)目并引入zan-design 引入魔方和櫥窗組件點(diǎn)擊時(shí)候會(huì)出現(xiàn)以上問(wèn)題導(dǎo)致頁(yè)面無(wú)法顯示
  3. 使用create-react-app 新建項(xiàng)目并提取demo的client文件夾部分跑起項(xiàng)目,同樣出現(xiàn)以上問(wèn)題。
  4. 如果由于react dnd 找不到context問(wèn)題為何官網(wǎng)demo沒(méi)有暴露?
回答
編輯回答
墨小白

home.propTypes = {

}
這里的propTypes 是首字母小寫(xiě)的,不是PropTypes

你的報(bào)錯(cuò)的第一句 Component EditorCard declared PropTypes instead of propTypes說(shuō)的很明顯了

2017年2月21日 14:33
編輯回答
薄荷綠

ReactDnd需要一層包裹,需要你自己包一下,可以參考以下代碼

import HTML5Backend from 'react-dnd-html5-backend';
import { DragDropContext } from 'react-dnd';

class YourApp {
/ ... /
}

export default DragDropContext(HTML5Backend)(YourApp);

2017年12月29日 12:04
編輯回答
舊螢火

The context dragDropManager is marked as required in DropTarget(DragSource(EditorCardItem)), but its value is undefined.

這里提示的錯(cuò)誤是在DropTarget組件里,你使用了propTypes來(lái)設(shè)置dragDropManager為required,但卻沒(méi)定義。你看看你dragDropManager有沒(méi)有傳過(guò)去

2017年7月3日 07:17