[英]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.