diff --git a/package-lock.json b/package-lock.json
index 9ce4dd9568538a35c751ce24fcab8d15ef76fd8e..6976a637d934e7839108c8afc45985e4b802651e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -24,6 +24,7 @@
"react-router-dom": "^6.22.3",
"react-scripts": "5.0.1",
"react-vant": "^3.3.4",
+ "redux-persist": "^6.0.0",
"sass": "^1.75.0",
"web-vitals": "^2.1.4"
}
@@ -15595,6 +15596,14 @@
"resolved": "https://registry.npmmirror.com/redux/-/redux-5.0.1.tgz",
"integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w=="
},
+ "node_modules/redux-persist": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmmirror.com/redux-persist/-/redux-persist-6.0.0.tgz",
+ "integrity": "sha512-71LLMbUq2r02ng2We9S215LtPu3fY0KgaGE0k8WRgl6RkqxtGfl7HUozz1Dftwsb0D/5mZ8dwAaPbtnzfvbEwQ==",
+ "peerDependencies": {
+ "redux": ">4.0.0"
+ }
+ },
"node_modules/redux-thunk": {
"version": "3.1.0",
"resolved": "https://registry.npmmirror.com/redux-thunk/-/redux-thunk-3.1.0.tgz",
diff --git a/package.json b/package.json
index e80785397b7c315838597772541ba588154569bf..e59dbc2c55c5427a1809f52c4472a0cc242ec75d 100644
--- a/package.json
+++ b/package.json
@@ -19,6 +19,7 @@
"react-router-dom": "^6.22.3",
"react-scripts": "5.0.1",
"react-vant": "^3.3.4",
+ "redux-persist": "^6.0.0",
"sass": "^1.75.0",
"web-vitals": "^2.1.4"
},
diff --git a/src/component/jjt/App.js b/src/component/jjt/App.js
new file mode 100644
index 0000000000000000000000000000000000000000..bbaead2212fd2eed14a0afb3e32e05cde87d8a81
--- /dev/null
+++ b/src/component/jjt/App.js
@@ -0,0 +1,14 @@
+import React from 'react'
+import { useSelector,useDispatch } from 'react-redux'
+import { add } from '../../store/Num'
+export default function App() {
+ let dispatch = useDispatch()
+ let tonum =()=>{
+ dispatch(add(10))
+ }
+ return (
+
+
+
+ )
+}
diff --git a/src/component/lwl/home.html b/src/component/lwl/home.html
new file mode 100644
index 0000000000000000000000000000000000000000..33f29e07906e9dc91612a0bec17fb37533eaba48
--- /dev/null
+++ b/src/component/lwl/home.html
@@ -0,0 +1,11 @@
+
+
+
+
+
+ Document
+
+
+ 这是lwl的首页测试
+
+
\ No newline at end of file
diff --git a/src/index.js b/src/index.js
index 460a75ece74b4bfd843a3a8505a4697a9083f275..130e65e79099c48feaa0937b888a49779fae5fd0 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,16 +1,19 @@
-import React from 'react';
-import ReactDOM from 'react-dom/client';//用来加载虚拟dom
-import './index.css';
-import '@nutui/nutui-react/dist/style.css'
-import App from './App';
-import { RouterProvider } from 'react-router-dom';
-import router from './router';
-const root = ReactDOM.createRoot(document.getElementById('root'));
+import React from "react";
+import ReactDOM from "react-dom/client"; //用来加载虚拟dom
+import "@nutui/nutui-react/dist/style.css";
+import { RouterProvider } from "react-router-dom";
+import router from "./router";
+import "./index.css";
+import { Provider } from "react-redux";
+import { PersistGate } from "redux-persist/integration/react";
+import { persistor, store } from "./store";
+const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
-
-
+
+
+
+
+
);
-
-
diff --git a/src/router/index.js b/src/router/index.js
index 8c34d9e1ca3f9ea0952751d5e27bba66bdf477f5..2c7876044fd88417090c5cec853d12d396ded532 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -1,5 +1,5 @@
import { createBrowserRouter } from "react-router-dom";
-import App from "../App";
+import App from "../component/jjt/App";
// 路由配置
let router = createBrowserRouter([
{
diff --git a/src/store/Num.js b/src/store/Num.js
new file mode 100644
index 0000000000000000000000000000000000000000..87fef08cede06d0180c7b1ba5a8c504667ba16a6
--- /dev/null
+++ b/src/store/Num.js
@@ -0,0 +1,14 @@
+import { createSlice } from "@reduxjs/toolkit";
+let store = createSlice({
+ name: "num",
+ initialState: {
+ num: 0
+ },
+ reducers: {
+ add(state,action) {
+ state.num = action.payload
+ }
+ }
+})
+export const { add } = store.actions;
+export default store;
\ No newline at end of file
diff --git a/src/store/index.js b/src/store/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..5e0aca0197bcf04aadb0f4fbaf0ad819f2f65d13
--- /dev/null
+++ b/src/store/index.js
@@ -0,0 +1,20 @@
+import {configureStore,combineReducers} from "@reduxjs/toolkit"
+import {persistStore,persistReducer} from "redux-persist"
+import storage from "redux-persist/lib/storage"
+import Num from "./Num";
+const rootRedecer = combineReducers({
+ num:Num.reducer,
+});
+const persistConfig = {
+ key:'root',
+ storage,
+}
+const persistedReducer = persistReducer(persistConfig,rootRedecer);
+export const store = configureStore({
+ reducer:persistedReducer,
+ middleware:(getDefaultMiddleware)=>
+ getDefaultMiddleware({
+ serializableCheck:false,
+ }),
+});
+export const persistor = persistStore(store)
\ No newline at end of file