当前位置: 首页 > news >正文

钦州住房和城乡建设局网站自己建的网站地址

钦州住房和城乡建设局网站,自己建的网站地址,上海企业信息,大连长建个人主页目录 一、react基础 5.loadsh使用排序8.ref获取DOM对象10.props使用*13.UseEffect 二、 react使用redux三、美团外卖项目完成页面制作使用redux渲染页面使用react-router-dom评价 一、react基础 jsx 大括号的作用 {count} {userLlist.map((item){return li key{item… 目录 一、react基础 5.loadsh使用排序8.ref获取DOM对象10.props使用*13.UseEffect 二、 react使用redux三、美团外卖项目完成页面制作使用redux渲染页面使用react-router-dom评价 一、react基础 jsx 大括号的作用 {count} {userLlist.map((item){return li key{item.id}{item.name}/li}) } key是用于react内部渲染处理的基础条件渲染 {flag p{显示}/p}复杂条件渲染 function getItem(){if(type1) return p有图模式p/else if(type2) return 无图/}2、useState使用 state是状态变量数据变化视图变化 const [userList,setUserList]useState([{id:1,name:z}])3.map,filter函数使用 4.tab切换功能实现 const tab{{type: ,text: }} //将type设为class高亮5.loadsh使用排序 import * as _ from lodash setCommentList(_.orderby(commentList,star//字段名desc)) //不改变原数组6.classnames优化类名控制 7.受控绑定表单 input value{value} onChange{(e){setValue(e.target.value); //显示输入}}typetext/8.ref获取DOM对象 const inputRefuseRef(null); input ref{inputRef}/ //使用inputRef.current获取DOM对象9.uuid和dayjs库的使用 10.props使用 用于父传子组件消息 function Son(prop){prop.nameprop.children //特殊属性 } function Father(prop){return Son namexxxpthis is spanp//Son }11.子传父兄弟之间传消息(利用子传父父传兄弟) 12.使用Context跨层通信 1、全局中createContext创建一个Context上下文对象 2、上层用Context.Provider value{mdg}/传递数据 3、底层用useContext(Context)方法获取数据*13.UseEffect const [commentList,setCommentList]useState([])useEffect((){async function getCommentList(){// async异步await等待const resawait fetch(/comment).then(resres.json().then(data{console.log(data);return data})) setCommentList(res);}getCommentList()},[])清除副作用最常见是在组件卸载时候 14.自定义hook 构造一个use开头的函数名在函数体内封装可复用的逻辑把组件中用到的状态变量return出去 使用时解构出来 15.hook使用规则 1.组件外使用 x 2.iffor循环内使用 x 16.json-server和axios使用 二、 react使用redux 在我们继续之前你需要熟悉一些重要的 Redux 术语 stateactionaction 是一个具有 type 字段的普通 JavaScript 对象reducer是一个函数接收当前的 state 和一个 action 对象必要时决定如何更新状态并返回新状态。函数签名是(state, action) newState。 你可以将 reducer 视为一个事件监听器它根据接收到的 action事件类型处理事件。dispatch,调用actionselector 三、美团外卖项目 添加按钮怎么显示 解决方法antd icon 滚动菜单如何实现 解决方法将延长的区域设置overflow:autoflex flex:1 不管内容多少一般都是平分空间空间大小都一致、 而 flex:auto 是根据内容的大小来分不是平的除非内容都是一样才平分 完成页面制作 使用redux渲染页面 完成购物车功能 store.js // 编写storeimport { createSlice } from reduxjs/toolkit import axios from axiosconst foodsStore createSlice({name: foods,initialState: {// 商品列表foodsList: [],// 菜单激活下标值activeIndex: 0,// 购物车列表cartList: []},reducers: {// 更改商品列表setFoodsList (state, action) {// payload是传入的值state.foodsList action.payload},changeActiveIndex(state,action){state.activeIndex action.payload},addCart (state, action) {// 是否添加过以action.payload.id去cartList中匹配 匹配到了 添加过const item state.cartList.find(item item.id action.payload.id)if (item) {item.count} else {state.cartList.push(action.payload)}},// count增increCount (state, action) {// 关键点找到当前要修改谁的count idconst item state.cartList.find(item item.id action.payload.id)item.count},// count减decreCount (state, action) {// 关键点找到当前要修改谁的count idconst item state.cartList.find(item item.id action.payload.id)if (item.count 0) {return}item.count--},clearCart(state){state.cartList[];},} })// 异步获取部分 const { setFoodsList, changeActiveIndex, addCart, increCount, decreCount, clearCart } foodsStore.actions const fetchFoodsList () {return async (dispatch) {// 编写异步逻辑const res await axios.get(meituan/menu)// 调用dispatch函数提交actiondispatch(setFoodsList(res.data))} }export { fetchFoodsList, changeActiveIndex, addCart, increCount, decreCount, clearCart }const reducer foodsStore.reducerexport default reducer使用react-router-dom 制作路由表 const router createBrowserRouter([{path:login,element:DempPage/},{path:index,element:DempPage/} ])声明式导航 Link to/index /编程式导航 useNavigate()Routes 多个Route需要Route包起来RouteOutle 给children占位 评价 在img标签里面只设置宽度不设置高度图片就会等比例缩放。
http://www.w-s-a.com/news/593941/

相关文章:

  • 百度网站优化排名加强服务保障满足群众急需i
  • 宁夏建设职业技术学院网站安徽网站优化建设
  • 四川关于工程建设网站硬盘做网站空间
  • 桂林网站制作培训学校外包seo公司
  • 莱州网站建设方案北京装修公司口碑
  • 大型网站建设济南兴田德润团队怎么样韩国女足出线了吗
  • 南通做网站找谁重庆网络推广网站推广
  • ps网站主页按钮怎么做怎样做网站的用户分析
  • 哪个网站做黑色星期五订酒店活动公司网络营销推广软件
  • 岳阳新网网站建设有限公司网页设计基础考试题目
  • 辽宁响应式网站费用海外平台有哪些
  • 杨凌规划建设局网站网站后台建设怎么进入
  • 有赞商城网站建设企业管理咨询是做什么的
  • 提供衡水网站建设中国石化工程建设有限公司邮政编码
  • 大芬地铁站附近做网站工业设计公司报价
  • 建设网站最强永年网站建设
  • 网站分站代理加盟wordpress国内工作室主题
  • 东营远见网站建设公司服装网站建设内容
  • 互助平台网站建设费用百度seo优化怎么做
  • lol英雄介绍网站模板工商局网上注册
  • 电商网站运营策划什么样的网站容易做seo
  • 网站备案需要什么流程怎么创建小程序卖东西
  • 陇西网站建设 室内设计持啊传媒企业推广
  • 连云港做网站制作首选公司如何让单位网站做防护
  • wordpress企业网站源码开发网站用什么工具做设计
  • 网站负责人不是法人seo神马网站推广器
  • 网站建设绩效考核方案wordpress支付宝付款
  • 高要区住房和城乡建设局网站如何网上注销自己的公司
  • 哪种技术做网站容易论文答辩图片做记录片的是哪个网站
  • 怎样在微信中做网站网站的备案号在哪