[英]reactjs: Error in importing uikit.min.js
我对反应非常陌生,并且不了解如何使用本机反应,因此我使用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';
包括在内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?
首先使用npm install uikit
。 然后:
import UIkit from 'uikit'
并记住,react仅适用于数据属性,来自文档的引用:
React仅适用于data-uk- *前缀。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.