gpt4 book ai didi

css - TypeError: $.each 不是函数 (ReactJS)

转载 作者:行者123 更新时间:2023-11-27 23:32:20 26 4
gpt4 key购买 nike

我有一个 ReactJS (Create-React-App) 元素。当我运行命令 npm start 时,它在我的本地主机上成功呈现。

但是当我运行构建命令时:npm run build 我得到以下错误:

yarn run v1.16.0 $ react-scripts build Creating an optimized production build... Failed to compile.

./src/css/master.css Module build failed: TypeError: $.each is not a function

error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

但是我没有在我的 master.css 中的任何地方使用过 $.each 函数

ma​​ster.css

@charset "utf-8";
/* CSS Document */

/* for icons */
@font-face {
font-family: 'Glyphicons Halflings';
src:url('../fonts/glyphicons-halflings-regular.eot');
src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('eot'),
url('../fonts/glyphicons-halflings-regular.woff') format('woff'),
url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'),
url('../fonts/glyphicons-halflings-regular.svg') format('svg');
font-weight: normal;
font-style: normal;
}

.glyphicon { /*http://getbootstrap.com/components//*/ /* for icon list */
display: inline-block;
font-family: "Glyphicons Halflings";
font-style: normal;
font-weight: bold;
line-height: 1;
position: relative;
top: 1px;
}

/* for refrence icons */
.glyphicon-earphone:before{content:"\e182";
color:#00429b;
}


.ajax__tab_xp .ajax__tab_tab {
height: 20px;
min-height:20px;}

/* end for icons */

@font-face {
font-family: 'omnesmedium';
src:url('../fonts/omnesmedium.eot');
src: url('../fonts/omnesmedium.eot?#iefix') format('eot'),
url('../fonts/omnesmedium.woff') format('woff'),
url('../fonts/omnesmedium.woff2') format('woff2'),
url('../fonts/omnesmedium.ttf') format('truetype'),
url('../fonts/omnesmedium.svg') format('svg');
font-weight: normal;
font-style: normal;
}

@font-face {
font-family: 'opensansregular';
src:url('../fonts/opensansregular.eot');
src: url('../fonts/opensansregular.eot?#iefix') format('eot'),
url('../fonts/opensansregular.woff') format('woff'),
url('../fonts/opensansregular.woff2') format('woff2'),
url('../fonts/opensansregular.ttf') format('truetype'),
url('../fonts/opensansregular.svg') format('svg');
font-weight: normal;
font-style: normal;
}

@font-face {
font-family: 'opensanssemibold';
src:url('../fonts/opensanssemibold.eot');
src: url('../fonts/opensanssemibold.eot?#iefix') format('eot'),
url('../fonts/opensanssemibold.woff') format('woff'),
url('../fonts/opensanssemibold.woff2') format('woff2'),
url('../fonts/opensanssemibold.ttf') format('truetype'),
url('../fonts/opensanssemibold.svg') format('svg');
font-weight: normal;
font-style: normal;
}

/*-------------------------------------------------------*/
body {
font-family: Arial, Helvetica, sans-serif;
padding: 0;
margin: 0 auto;
font-size:100%;
}
* {
outline: none;
box-sizing:border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
a:link, a:visited {
color: #2e4fa5;
text-decoration: none;
}
a:hover {
color: #2e4fa5;
text-decoration: underline;
}
.clear {
clear: both;
}
.wrapper {
overflow: hidden;/*auto*/
}
.contentarea {
max-width: 999px !important;
margin: 0 auto !important;
}

.insidebg
{
background:url(../img/topbg.jpg) repeat-x top #FFFFFF;
height:135px;
}

.homebg
{
background:url(../img/homebg.jpg) repeat-x top #0a86ca;
}

.loginbg
{
background:url(../img/jio_loginbg.jpg) top center;
height:100%;
background-color:#0a86ca;
}

.loginarea
{
width:75%;
background:url(../img/couple.png) left top no-repeat;
float:right;
margin-top:40px;
margin-bottom:100px;
height:420px;
}

.loginpatch
{
width:400px;
background-color:#FFFFFF;
-webkit-appearance: none;
border-radius:8px;
float:right;
text-align: center;
padding:35px;
margin-top:100px;
border: 5px solid rgb(255, 255, 255);
border: 5px solid rgba(255, 255, 255, .5);
-webkit-background-clip: padding-box; /* for Safari */
background-clip: padding-box; /* for IE9+, Firefox 4+, Opera, Chrome */
}
.loginpatch .StoreNo input[type="text"]
{
font-size: .9em;
font-family:opensansregular, Arial, Helvetica, sans-serif;

border:1px solid #e1e4eb;
-webkit-appearance: none;
border-radius:8px;
padding:10px;
/*text-indent:35px;*/
/*padding-left: 45px;*/
margin:10px 0px;
width:70%;
color:#787b82;
}
.loginpatch h1
{
font-size:2em;
color:#0b81c6;
font-family:omnesmedium, Arial, Helvetica, sans-serif;
font-weight:normal;
margin:0;
padding:0;
}

.txtbox1
{
font-size: .9em;
font-family:opensansregular, Arial, Helvetica, sans-serif;
background:url(../img/userid-icon.jpg) left no-repeat;
border:1px solid #e1e4eb;
-webkit-appearance: none;
border-radius:8px;
padding:10px;
/*text-indent:35px;*/
padding-left: 45px;
margin:10px 0px;
width:100%;
color:#787b82;
}

.txtbox2
{
font-size: .9em;
font-family:opensansregular, Arial, Helvetica, sans-serif;
background:url(../img/password-icon.jpg) left no-repeat;
border:1px solid #e1e4eb;
-webkit-appearance: none;
border-radius:8px;
padding:10px;
/*text-indent:35px;*/
padding-left: 45px;
margin:10px 0px;
width:100%;
color:#787b82;
}

.selectoperator select
{
font-size: .9em;
font-family:opensansregular, Arial, Helvetica, sans-serif;
border:1px solid #e1e4eb;
color:#000000;
border-radius:8px;
padding:10px;
/*text-indent:35px;*/
margin:10px 0px;
width:100%;
color:#787b82;
-webkit-appearance: none;
-moz-appearance: none;
background:url(../img/arrow-icon.png) 100% center no-repeat;
}


/*.txtbox3
{
font-size: .9em;
font-family:opensansregular, Arial, Helvetica, sans-serif;
border:1px solid #e1e4eb;
border-radius:8px;
padding:10px;
margin:10px 0px;
width:100%;
color:#787b82;
}
*/
.loginpatch .goldbutton
{
padding:.1em;
font-family:omnesmedium, Arial, Helvetica, sans-serif;
font-size:1em;
color:#a56d00;
width:95px;
border:1px solid #ffb400;
-webkit-appearance: none;
border-radius:4px;
background:url(../img/goldarrow-login.jpg) right 12% center no-repeat #ffc600;
text-align:center;
}
.loginpatch .goldbuttonPopup
{
padding:.1em;
font-family:omnesmedium, Arial, Helvetica, sans-serif;
font-size:1em;
color:#a56d00;
width:100px;
border:1px solid #ffb400;
-webkit-appearance: none;
border-radius:4px;
background:url(../img/goldarrow-login.jpg) right 1% center no-repeat #ffc600;
text-align:center;
}
.forgotpasswordtxt
{
font-family:omnesmedium, Arial, Helvetica, sans-serif;
font-weight:normal;
font-size:1em;
color:#0b81c6;
float:right;
width:150px;
margin-top:12px;
text-decoration:none;
}

.forgotpasswordtxt a
{
font-family:omnesmedium, Arial, Helvetica, sans-serif;
font-weight:normal;
font-size:1em;
color:#0b81c6;
float:right;
width:150px;
text-decoration:none;
}

.forgotpasswordtxt a:hover
{
font-family:omnesmedium, Arial, Helvetica, sans-serif;
font-weight:normal;
font-size:1em;
color:#0b81c6;
float:right;
width:150px;
text-decoration:underline;
}


.portaltitle
{
color:#214497;
font-family:omnesmedium, Arial, Helvetica, sans-serif;
font-size:2em;
font-weight:normal;
text-decoration:none;
float:right;
margin-top:0.6em;
text-align:right;

}

.header
{
overflow:hidden;
}


.logo
{
overflow:hidden;
float:left;
}

.welcomearea
{
overflow:hidden;
width:500px;
float:right;
text-align:right;
}

.yellowbg
{
background:#ffdd00;
height:4px;
border-bottom:1px solid #bac5df;
overflow:hidden;
width:100%;
}
.navbluebg
{
background:#214497;
height:55px;
/*border-bottom:1px solid #bac5df;*/
width:100%;
}

.yellowbgPopup
{
background:#ffdd00;
height:30px;
border-bottom:1px solid #bac5df;
overflow:hidden;
position:absolute;
width:100%;
color:#214497;
font-family:-Opensansregular, Arial, Helvetica, sans-serif;
font-size:.9em;
padding :5px;
font-weight:bold;

}

.userpic
{
padding:15px;
border-left:1px solid #f8f9fb;
text-align:right;
float:right;
}

.storepic
{
text-align:right;
float:right;
padding: 24px 0px 24px 0px;
}

.welcometxt
{
font-family:omnesmedium, Arial, Helvetica, sans-serif;
font-size:1em;
color:#a1a2a3;
font-weight:normal;
text-decoration:none;
float:right;
margin-top:1.6em;
text-align:right;
}

.welcometxt a
{
color:#a1a2a3;
}

.storecodenum
{
font-family:omnesmedium, Arial, Helvetica, sans-serif;
/*font-size:1em;*/
color:#616671;
font-weight:normal;
text-decoration:none;
margin-right:10px;
width:120px;
margin-top:1.6em;
float:right;
}
.storecodenum select
{
font-size: .8em;
font-family:opensansregular, Arial, Helvetica, sans-serif;
border:1px solid #e1e4eb;
color:#000000;
border-radius:4px;
/*padding:5px;*/
/*text-indent:35px;*/
/*margin:5px 0px;*/
width:90%;
color:#787b82;
-webkit-appearance: none;
-moz-appearance: none;
background:url(../img/arrow-icon.png) 90% right no-repeat;
}
.storecodenum input[type="text"]
{
background:#FFFFFF;
/*padding:10px;*/
font-family:opensansregular, Arial, Helvetica, sans-serif;
font-size:.8em;
/*margin:10px 0px;
margin-left:.8em;*/
color:#787b82;
border:1px solid #edd995;
-webkit-appearance: none;
border-radius:6px;
width:110px;
}
.navigation
{
text-align:center;
}

.bredcrum
{
overflow:hidden;
color:#7f848f;
margin:10px 0;
font-family:opensansregular, Arial, Helvetica, sans-serif;
font-size:.9em;
font-weight:normal;
text-decoration:none;
}

.bredcrum a
{
color:#214497;
font-weight:normal;
text-decoration:none;
}

.bredcrum a:hover
{
color:#214497;
font-weight:normal;
text-decoration:underline;
}

.yellowtable
{
background-color:#fffdf6;
border-top:1px solid #f9f0d0;
border-left:1px solid #f9f0d0;
border-right:1px solid #f9f0d0;
border-bottom:2px solid #f9f0d0;
padding:15px;
margin-bottom: -15px;
}

.yellowline
{
background-color:#fffdf6;
border-top:1px solid #f9f0d0;
/* border-left:1px solid #f9f0d0;
border-right:1px solid #f9f0d0;
border-bottom:1px solid #f9f0d0; */

}

.yellowtxt
{
font-family:opensanssemibold, Arial, Helvetica, sans-serif;
color:#a6881e;
font-size:1.2em;
text-align:center;
font-weight:normal;
width:100%;
}

.yellowtable input[type="text"]
{
background:#FFFFFF;
padding:.6em;
font-family:calibribold, Arial, Helvetica, sans-serif;
font-size:.8em;
margin-right:.8em;
color:#656565;
width:250px;
border:1px solid #edd995;
-webkit-appearance: none;
border-radius:8px;
}

.yellowtable .bluebutton
{
background:#0081c5;
padding:.6em;
font-family:opensansregular, Arial, Helvetica, sans-serif;
font-size:.8em;
margin-right:.8em;
color:#ffffff;
width:100px;
border:1px solid #3974b9;
-webkit-appearance: none;
border-radius:8px;
}

.yellowtable .redbutton
{
background:#e0252c;
padding:.6em;
font-family:opensansregular, Arial, Helvetica, sans-serif;
font-size:.8em;
margin-right:.8em;
color:#ffffff;
width:100px;
border:1px solid #bd1515;
-webkit-appearance: none;
border-radius:8px;
}

.tablelist
{
text-align:center;
float:0 auto;
margin:1em 0 0 0;
}

.tablelist .blueeditbutton
{
padding:.6em;
font-family:opensansregular, Arial, Helvetica, sans-serif;
font-size:.9em;
margin-right:.8em;
color:#ffffff;
width:80px;
border:none;
-webkit-appearance: none;
border-radius:4px;
background:url(../img/edit-icon.jpg) left 10% center no-repeat #0081c5;
}

.tablelist .blueeditbuttonLarge
{
padding:.6em;
font-family:opensansregular, Arial, Helvetica, sans-serif;
font-size:.9em;
margin-right:.8em;
color:#ffffff;
width:110px;
border:none;
-webkit-appearance: none;
border-radius:4px;
background:url(../img/edit-icon.jpg) left 10% center no-repeat #0081c5;
}


.tablelist .greydeletebutton
{
padding:.6em;
font-family:opensansregular, Arial, Helvetica, sans-serif;
font-size:.9em;
margin-right:.8em;
color:#ffffff;
width:80px;
border:none;
-webkit-appearance: none;
border-radius:4px;
background:url(../img/delete-icon.jpg) left 10% center no-repeat #7b818f;
text-indent:10px;
}

.tablelist .greybuttonActCode
{
padding:.6em;
font-family:opensansregular, Arial, Helvetica, sans-serif;
font-size:.9em;
margin-right:.8em;
color:#ffffff;
border:none;
-webkit-appearance: none;
border-radius:4px;
background:url(../) left 10% center no-repeat #7b818f;
text-indent:10px;
}

.tabletype2
{
overflow:hidden;
width:100%;
float:left;
border:1px solid #f9f0d0;
padding:0;
margin-top: 14px;
text-align: left;
margin-left: 0;
margin-right: 0;
margin-bottom: 0;
/*height:100%;*/
}

.tabletype2 table
{
padding:10px;
/*height: 910px;*/
}

.tabletype2 table tr
{
padding:10px;
border-top:1px solid #fbf3d7;
border-bottom:1px solid #fbf3d7;
}

.tabletype2 .title
{
color:#a6881e;
padding:10px;
font-family:opensansregular, Arial, Helvetica, sans-serif;
font-size:.9em;
text-align:left;
font-weight:800;
background:#fffdf6;
border-right:1px solid #f9f0d0;
width: 25%;
}

.tabletype2 input[type="text"]
{
background:#FFFFFF;
padding:10px;
font-family:opensansregular, Arial, Helvetica, sans-serif;
font-size:.8em;
margin:10px 0px;
margin-left:.8em;
color:#787b82;
border:1px solid #edd995;
-webkit-appearance: none;
border-radius:8px;
width:80%;
}
.mytable input[type="text"]
{
background:#FFFFFF;
padding:10px;
font-family:opensansregular, Arial, Helvetica, sans-serif;
font-size:12px;
margin:10px 0px;
margin-left:.8em;
color:#787b82;
border:1px solid #edd995;
-webkit-appearance: none;
border-radius:8px;
width:100px;
}
.tabletype2 .smallInput input[type="text"]
{
background:#FFFFFF;
padding:10px;
font-family:opensansregular, Arial, Helvetica, sans-serif;
font-size:.8em;
margin:10px 0px;
margin-left:.8em;
color:#787b82;
border:1px solid #edd995;
-webkit-appearance: none;
border-radius:8px;
width:130px;
}
.tabletype2 input[type="password"]
{
background:#FFFFFF;
padding:10px;
font-family:opensansregular, Arial, Helvetica, sans-serif;
font-size:.8em;
margin:10px 0px;
margin-left:.8em;
color:#787b82;
border:1px solid #edd995;
-webkit-appearance: none;
border-radius:8px;
width:80%;
}

.tabletype2 select
{
font-size: .9em;
font-family:opensansregular, Arial, Helvetica, sans-serif;
border:1px solid #edd995;
color:#787b82;
border-radius:8px;
padding:8px;
/*text-indent:35px;*/
margin:10px 0px;
margin-left:.8em;
width:80%;
color:#787b82;
-webkit-appearance: none;
-moz-appearance: none;
background:url(../img/selectarrow.jpg) 100% center no-repeat;
}

.tabletype2 select option
{
padding-left:10px;
}
.chkBoxList1 td
{
width:35%;

border-right:1px solid #fbf3d7;
}
.box
{
overflow:hidden;
width:30%;
float:left;
margin:10px;
}

.box h3
{
color:#214497;
font-family:opensansregular, Arial, Helvetica, sans-serif;
font-size:.9em;
}

.genbutton
{
background:#0081c5;
padding:.6em;
font-family:opensansregular, Arial, Helvetica, sans-serif;
font-size:.8em;
margin-right:.8em;
color:#ffffff;
width:100px;
border:1px solid #3974b9;
-webkit-appearance: none;
border-radius:8px;
margin-top:10px;
}

.testCssStyle {
color: #1f5ca9;
background-color: #c5d4e6;
table-layout: auto;
border-collapse: separate;
border-right: gray thin solid;
border-top: gray thin solid;
border-left: gray thin solid;
border-bottom: gray thin solid;
}

.fl-left {
float: left;
}
.sch-btn {
width: 68px;
padding: 10px;
margin-left: 2px;
}
.bcol-white {
background-color: #ffffff !important;
}
.btn-blue {
background: #0081c5;
padding: .6em;
font-family: opensansregular, Arial, Helvetica, sans-serif;
font-size: .8em;
color: #ffffff;
width: 100px;
border: 1px solid #3974b9;
-webkit-appearance: none;
border-radius: 8px;
}
.lbl-txt-1 {
font-family: humnst777, Arial, Helvetica, sans-serif;
font-size: 0.9rem;
padding: 10px;
}
.txt-center {
text-align: center;
}
.fl-right {
float: right;
}
.hiddencol {
display: none;
}
div.scrollmenu {
background-color: #333;
overflow: auto;
white-space: nowrap;
}
/* added by chandrani */
.loadingcc{
width: 100px;
height: 100px;
box-sizing: border-box;
border-radius: 50%;
border-top: 10px solid #e74c3c;
position: relative;
animation: a1 2s linear infinite;

display: flex;
align-items: center;
justify-content: center;
}

.loadingcc::before,.loadingcc::after{
content: '';
width: 100px;
height: 100px;
position: absolute;
left: 0;
top: -10px;
box-sizing: border-box;
border-radius: 50%;
}

.loadingcc::before{
border-top: 10px solid #e67e22;
transform: rotate(120deg);
}

.loadingcc::after{
border-top: 10px solid #3498db;
transform: rotate(240deg);
}

.loadingcc span{
position: absolute;
width: 110px;
height: 100px;
color: #fff;
text-align: center;
line-height: 100px;
animation: a2 2s linear infinite;
}

@keyframes a1 {
to{
transform: rotate(360deg);
}
}

@keyframes a2 {
to{
transform: rotate(-360deg);
}
}
/* end */

.w-30 {width:30%;float:left;display:block;margin-right:10px;}
.box-100 {width:100%;float:left;display:block;padding:5px;}
.ajax__calendar_container {border: 1px solid #646464;background-color: #ffffff;color: #000000;}
.ajax__calendar_container table thead tr td {font-size:11px !important;padding:0px !important;color:#000000 !important;border-left:none !important;border-right:none !important;background-color:#ffffff !important;}
.editdate tbody td {font-size:11px !important;padding:0px !important;color:#000000 !important;border-left:none !important;border-right:none !important;background-color:#ffffff !important;}
.tbl-bb {font-size:16px !important;}
.mt1 {margin-top:1px;}
.mt4 {margin-top:4px;}
.tblbg {background-color:transparent; border-style:none;}
.bw0{border-width:0px}
.mr-10{margin-right:10px}
.whitespace{white-space:nowrap;}
.fade.show{opacity: 1;}
.col-red{color:#ff0000;}
.text-center{text-align:center;}
.mtb10{margin:10px auto;}
.tbl-global{margin:auto;width:100%;}
.tbl-global thead th td{padding:5px;}
.tbl-global tbody tr td{padding:5px;}
.tabletype2 textarea{background:#FFFFFF;padding:10px;font-family:opensansregular, Arial, Helvetica, sans-serif;font-size:.8em;margin:10px 0px;margin-left:.8em;color:#787b82;border:1px solid #edd995;-webkit-appearance: none;border-radius:8px;width:80%;}
.tab-menu{background-color:transparent !important;padding: inherit !important;border-bottom: 1px solid #f9f0d0 !important;position:inherit !important;}
.nav-tabs>li>a.active, .nav-tabs>li>a.active:hover, .nav-tabs>li>a.active:focus{border:1px solid #f9f0d0;border-bottom-color:transparent;background-color:#ffffff;}
label{font-weight:normal;}
.ml-10{margin-left:10px !important;}
.tabletype2 .title{font-size:.8em;width:16%; }
/*End New Class Added by Krishna*/
/*.pie {
border-radius:10px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
behavior: url(../PIE.htc);
}*/

package.json

{
"name": "react-express-tutorial",
"version": "0.1.0",
"private": true,
"dependencies": {
"axios": "^0.18.0",
"body-parser": "^1.18.2",
"bootstrap": "4.0.0",
"cors": "^2.8.4",
"crypto-js": "^3.1.9-1",
"express": "^4.16.3",
"jquery": "^1.12.0",
"jquery-ui": "^1.12.1",
"jquery-ui-dist": "^1.12.1",
"mongoose": "^5.0.13",
"nodemon": "^1.17.3",
"popper.js": "^1.15.0",
"react": "^16.3.1",
"react-bell-icon": "^1.0.0",
"react-confirm-alert": "^2.4.1",
"react-dom": "^16.3.1",
"react-global-configuration": "^1.3.0",
"react-idle-timer": "^4.2.8",
"react-router-dom": "^4.2.2",
"react-scripts": "1.1.4"
},
"scripts": {
"start": "set PORT= 3006 && react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"browserslist": {
"production": [
">0.2%",
"not ie <= 11",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"css-loader": "^3.2.0",
"style-loader": "^1.0.0"
}
}

index.js

import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import { BrowserRouter } from 'react-router-dom';
import registerServiceWorker from './registerServiceWorker';

import '../node_modules/bootstrap/dist/css/bootstrap.min.css';

ReactDOM.render(
<BrowserRouter>
<App />
</BrowserRouter>, document.getElementById('root'));
registerServiceWorker();

App.js

import React, { Component } from 'react';
import { BrowserRouter as Router, Switch, Route, withRouter} from 'react-router-dom';
//import {BrowserRouter, Route, Redirect, Switch, withRouter} from 'react-router-dom';


import Login from './components/Login.js';
import Default from'./components/Default.js';

class App extends Component {
render() {
return (
<div className="App">
<Route path="/Default" component={Default}/>

<Router >
<Switch>
{/* chandrani */}
<Route exact path="/" component={Login}/>
</Switch>
</Router>
</div>
)
}

}

export default withRouter(App);

helper.jsx 我在其中使用了 jQuery:

import React from 'react';
import 'bootstrap/dist/css/bootstrap.css';
import '../css/style.css';
import $ from 'jquery';
import 'jquery-ui';
import BellIcon from 'react-bell-icon';

export function reusecompdidmount() {
$(document).ready(function() {
$("input").attr("autocomplete", "off");
$('.nav-list li:not(ul li ul li):gt(4)').hide();
$('.next').click(function() {
if ($('.nav-list li:not(ul li ul li):visible:last').is(':last-child')) {
return false;
}

var currentIndex = $('.nav-list').children('li:not(ul li ul li):visible:last').index(),
nextIndex = currentIndex + 6;
console.log("currentIndex " + currentIndex + " nextIndex" + nextIndex);
$('.nav-list li:not(ul li ul li)').hide();
$('.nav-list li:not(ul li ul li):lt(' + nextIndex + '):gt(' + currentIndex + ')').show("slide", 500);
});
$('.prev').click(function() {
if ($('.nav-list li:not(ul li ul li):visible:first').is(':first-child')) {
return false;
}

var currIndex = $('.nav-list').children('li:not(ul li ul li):visible:first').index(),
prevIndex = currIndex - 6;
$('.nav-list li:not(ul li ul li)').hide();
if (prevIndex < 0) {
$('.nav-list li:not(ul li ul li):lt(' + currIndex + ')').show("slide", 500);
} else {
$('.nav-list li:not(ul li ul li):lt(' + currIndex + '):gt(' + prevIndex + ')').show("slide", 500);
}
});
});
}

export function slider(){
const $ = require("jquery");
require("jquery-ui/ui/effects/effect-slide");
$(document).ready(function() {
$("input").attr("autocomplete", "off");
$('.nav-list li:not(ul li ul li):gt(4)').hide();
$('.next').click(function() {
if ($('.nav-list li:not(ul li ul li):visible:last').is(':last-child')) {
return false;
}

var currentIndex = $('.nav-list').children('li:not(ul li ul li):visible:last').index(),
nextIndex = currentIndex + 6;
//console.log("currentIndex01 " + currentIndex + " nextIndex" + nextIndex);
$('.nav-list li:not(ul li ul li)').hide();
$('.nav-list li:not(ul li ul li):lt(' + nextIndex + '):gt(' + currentIndex + ')').show("slide", 500);
});
$('.prev').click(function() {
if ($('.nav-list li:not(ul li ul li):visible:first').is(':first-child')) {
return false;
}

var currIndex = $('.nav-list').children('li:not(ul li ul li):visible:first').index(),
prevIndex = currIndex - 6;
$('.nav-list li:not(ul li ul li)').hide();
if (prevIndex < 0) {
$('.nav-list li:not(ul li ul li):lt(' + currIndex + ')').show("slide", 500);
} else {
$('.nav-list li:not(ul li ul li):lt(' + currIndex + '):gt(' + prevIndex + ')').show("slide", 500);
}
});
});
}

我做错了什么?

最佳答案

我能想到的唯一问题是在您的 index.js 中导入 Bootstrap 。尝试将其更改为:

导入 'bootstrap/dist/css/bootstrap.min.css';

您可能还需要添加 bootstrap 的 JS:import 'bootstrap/dist/js/bootstrap.min.js';

编辑:另一个问题可能是您导入了多个 jQuery 实例。因此,除了顶级(尤其是那些内联“require”导入)之外,删除所有这些,我认为 bootstrap 或 jquery-ui 可能会自己拉 jQuery,所以在那种情况下你根本不需要包含它。

关于css - TypeError: $.each 不是函数 (ReactJS),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57428747/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com