随笔分类 -  React

摘要:将组件中所用数据和方法通过props传给子UI组件,子UI组件调用这些数据和方法完成页面渲染(业务逻辑层的构造函数不变) TodtListUI.js import React, { Component } from 'react' import {Input,Button,List} from 'a 阅读全文
posted @ 2022-06-21 02:30 SimoonJia 阅读(154) 评论(0) 推荐(0)
摘要:export const getListAction=(data)=>({ type:GET_LIST, data }) const action=getListAction(data) 调用该方法,取到的是括号内部的值 所以该写法可看作()=>{return{}} 首先这里用的时ES6的箭头函数 阅读全文
posted @ 2022-06-21 02:22 SimoonJia 阅读(412) 评论(0) 推荐(0)
摘要:报错的意思应该是因为必须在组件挂载后订阅 componentDidMount(){ // store.subscribe(this.storeChange) //订阅 } 阅读全文
posted @ 2022-06-21 02:11 SimoonJia 阅读(378) 评论(0) 推荐(0)
摘要:import axios from "axios"; const baseUrl = "http:/123.57.50.179:8900"; const getRequest = (path, params) => { return axios.get(baseUrl + path, { param 阅读全文
posted @ 2022-06-21 00:09 SimoonJia 阅读(226) 评论(0) 推荐(0)
摘要:import localStorage from "localStorage";//引入 localStorage.setItem("userInfo", JSON.stringify(res.data.data));//存 localStorage.setItem("user", res.data 阅读全文
posted @ 2022-06-21 00:04 SimoonJia 阅读(837) 评论(0) 推荐(0)
摘要:constructor(props){ super(props) this.state=store.getState() this.changeInputValue=this.changeInputValue.bind(this) this.storeChange=this.storeChange. 阅读全文
posted @ 2022-06-20 19:55 SimoonJia 阅读(218) 评论(0) 推荐(0)
摘要:this的指向不对,需要用bind绑定this 例如 constructor(props){ super(props) this.state=store.getState() this.changeInputValue=this.changeInputValue.bind(this)//绑定 sto 阅读全文
posted @ 2022-06-19 02:47 SimoonJia 阅读(1404) 评论(0) 推荐(0)
摘要:(查看自己使用的哪个npm源) npm config get registry 安装arm(管理npm源) npm i nrm -g 查看npm源 nrm ls 切换npm源 nrm use taobao(镜像源) 其他正常使用 npm i (加载配置) 阅读全文
posted @ 2022-04-14 17:22 SimoonJia 阅读(249) 评论(0) 推荐(0)