英文:
Uncaught TypeError: Cannot read properties of undefined (reading 'fn')
问题
I don't understand why i keep getting this error. Please help.
*** --------------------------------------------
* AdminLTE CardRefresh.js
* License MIT
* --------------------------------------------
*/
import $ from 'jquery';
/**
* 常量
* ====================================================
*/
const NAME = 'CardRefresh'
const DATA_KEY = 'lte.cardrefresh'
const EVENT_KEY = `.${DATA_KEY}`
const JQUERY_NO_CONFLICT = $.fn[NAME]
const EVENT_LOADED = `loaded${EVENT_KEY}`
const EVENT_OVERLAY_ADDED = `overlay.added${EVENT_KEY}`
const EVENT_OVERLAY_REMOVED = `overlay.removed${EVENT_KEY}`
const CLASS_NAME_CARD = 'card';
const SELECTOR_CARD = `.${CLASS_NAME_CARD}`
const SELECTOR_DATA_REFRESH = '[data-card-widget="card-refresh"]'
英文:
I don't understand why i keep getting this error. Please help.
*** --------------------------------------------
* AdminLTE CardRefresh.js
* License MIT
* --------------------------------------------
*/
import $ from 'jquery'
/**
* Constants
* ====================================================
*/
const NAME = 'CardRefresh'
const DATA_KEY = 'lte.cardrefresh'
const EVENT_KEY = `.${DATA_KEY}`
const JQUERY_NO_CONFLICT = $.fn[NAME]
const EVENT_LOADED = `loaded${EVENT_KEY}`
const EVENT_OVERLAY_ADDED = `overlay.added${EVENT_KEY}`
const EVENT_OVERLAY_REMOVED = `overlay.removed${EVENT_KEY}`
const CLASS_NAME_CARD = 'card'
const SELECTOR_CARD = `.${CLASS_NAME_CARD}`
const SELECTOR_DATA_REFRESH = '[data-card-widget="card-refresh"]'
答案1
得分: 0
更新 2023:
我使用了这段代码片段来解决我遇到的所有问题!
从bootstrap 5开始,他们将要求您使用他们的Proper。而我在这里使用的是Bundle,它仍然与所有功能配合良好
对于nextjs 13
<Script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js" />
<Script type="text/javascript" src="https://unpkg.com/@popperjs/core@2" />
<Script
type="text/javascript"
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
crossOrigin="anonymous"
/>
英文:
Update 2023:
I used this code snippet to fix all the problems I had!
As of bootstrap 5 they will require you to use their Proper . And here I use Bundle and it still works well with all functions
for nextjs 13
<Script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js" />
<Script type="text/javascript" src="https://unpkg.com/@popperjs/core@2" />
<Script
type="text/javascript"
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
crossOrigin="anonymous"
/>
答案2
得分: -1
import * as $ from 'jquery'
英文:
import $ from 'jquery'
Looks like it's undefined. Try instead
import * as $ from 'jquery'
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论