我有一个由 HTML 设计师设计的 html。他使用nice-select.js作为下拉菜单。我将它导入我的index.html并执行了这个:
$(document).ready(function(e){
$(".drop").niceSelect();
}
当它加载到第一页时它工作正常。但是在单击指向不同组件的菜单项时,js 不会在此处启动,并且设计不会针对该组件。
现在如何在中使用此$
功能ComponentdidMountMethod()
?
我已经使用 npm install jquery --save 安装了 jquery 并尝试使用它但出现错误niceSelect is not a function
。
任何人都可以在这方面提供帮助。
提前致谢。
import React, { Component } from 'react';
import{Link} from 'react-router-dom';
import $ from 'jquery';
$(".drop").niceSelect();
这给出了一个错误 nice select is not a function。