0

我对 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?

4

1 回答 1

0

首先使用 npm 安装 UIkit npm install uikit。然后:

import UIkit from 'uikit'

请记住,react 仅适用于数据属性,来自文档的引用:

React 仅适用于 data-uk-* 前缀。

于 2017-06-11T20:24:31.700 回答