【发布时间】:2017-06-11 13:20:08
【问题描述】:
我对 react 很陌生,并且不知道如何使用原生 react,所以我使用 create-react-app。
我正在尝试使用 UIKit 作为框架,但我无法让它工作。由于 UIKit 的 NPM 模块只支持它的 2.x 版本,我正在尝试使用它的 3.x(来自http://www.getuikit.com/)。我正在我的一个组件中导入 JS 文件 (uikit.min.js),但编译失败。
我在文件中包含import * as uikit from 'uikit.min.js';,编译时会弹出:
./src/assets/js/uikit.min.js
Line 3: 'define' is not defined no-undef
Line 3: 'define' is not defined no-undef
Line 4: Unexpected use of 'location' no-restricted-globals
Line 4: Unexpected use of 'location' no-restricted-globals
Line 5: Unexpected use of 'location' no-restricted-globals
Line 5: 'DocumentTouch' is not defined no-undef
Line 5: 'MSGesture' is not defined no-undef
Search for the keywords to learn more about each error.
也许我做错了,但如何导入它以供我使用 UIkit v3?
【问题讨论】:
-
您可以将它作为脚本依赖项包含在您的 HTML 文件中
-
@ShubhamKhatri 试过了,但我需要使用 UIkit 的功能,例如
UIkit.modal("...").toggle()。
标签: javascript reactjs create-react-app getuikit