我正在开发一个使用引人注目的Dash 模板的项目。在这里,我在从 URL 更改路由时遇到一些路由问题。
auth.js
import React, { lazy, Suspense } from "react"
import { Spin } from "antd"
import { Switch, Route, Redirect } from "react-router-dom"
import AuthLayout from "../container/profile/authentication/Index"
const Login = lazy(() =>
import("../container/profile/authentication/overview/SignIn")
)
const SignUp = lazy(() =>
import("../container/profile/authentication/overview/SignUp")
)
const ForgetPassword = lazy(() =>
import("../container/profile/authentication/overview/ForgetPassword")
)
const EmailConfirmation = lazy(() =>
import("../container/profile/authentication/overview/EmailConfirmation")
)
const VerificationPage = lazy(() =>
import("../container/profile/authentication/overview/VerificationPage")
)
const NotFound = () => {
console.log("NOT FOUND")
return <Redirect to="/" />
}
const …
Run Code Online (Sandbox Code Playgroud) javascript reactjs react-router react-router-dom react-hooks
目前,我正在处理我正在处理考勤模块的人力资源系统。我想使用 Bootstrap4 DataTables 显示表格。我已经尝试了 StackOverflow 的所有链接,但没有一个解决方案适合我。
我在此代码中遇到以下错误:
application.js:1 未捕获的错误:在 webpackMissingModule (application.js:1) 中找不到模块“jquery”
出勤:131 未捕获的参考错误:$ 未在出勤:131 处定义
$(...)DataTable 不是函数
packages.json
:
{
"name": "inhouse_activities",
"private": true,
"dependencies": {
"@fortawesome/fontawesome-free": "^5.15.0",
"@nathanvda/cocoon": "^1.2.14",
"@rails/actioncable": "^6.0.0",
"@rails/activestorage": "^6.0.0",
"@rails/ujs": "^6.0.0",
"@rails/webpacker": "4.3.0",
"bootstrap": "^4.5.2",
"coffee-loader": "^1.0.0",
"coffeescript": "1.12.7",
"datatables.net": "^1.10.22",
"datatables.net-bs4": "^1.10.22",
"imports-loader": "^1.2.0",
"jquery": "^3.5.1",
"popper.js": "^1.16.1",
"toastr": "^2.1.4",
"turbolinks": "^5.2.0"
},
"version": "0.1.0",
"devDependencies": {
"webpack-dev-server": "^3.11.0"
}
}
Run Code Online (Sandbox Code Playgroud)
config/webpack/loaders/datatable.js
:
module.exports = {
test: /datatables\.net.*/,
use: [{
loader: 'imports-loader?define=>false'
}] …
Run Code Online (Sandbox Code Playgroud) 我只想在 5 秒后隐藏 UI 中的撤消按钮。这是我的代码:
Saga.js
function* updateActionListingsSaga({ payload }) {
try {
const res = yield call(updateUnpublishedListingsById, payload);
let unpublishedListings = yield select(UnpublishedListings);
if (res) {
const row = unpublishedListings.listingsData.results.find(data => data.id === res.ids[0])
if (row) {
row.review_status = payload.review_status
row.isUndoEnabled = true;
yield setTimeout(() => {row.isUndoEnabled = false}, 5000)
}
}
yield put(updateActionListingSuccess());
} catch (error) {
yield put(apiError(error.error || error.message || error));
}
}
Run Code Online (Sandbox Code Playgroud)
索引.js
item?.isUndoEnabled && (
<ConfirmDialogBtn
button={{
color: 'primary',
title: 'Undo',
icon: 'bx bx-undo', …
Run Code Online (Sandbox Code Playgroud) javascript ×2
reactjs ×2
bootstrap-4 ×1
datatables ×1
react-hooks ×1
react-redux ×1
react-router ×1
redux-saga ×1
saga ×1
webpack ×1