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

汽车之家网站做的很烂小程序制作策划案

汽车之家网站做的很烂,小程序制作策划案,wordpress 滑动门效果,acg二次元wordpress主题1 条件渲染 使用条件渲染#xff0c;结合TodoList案例#xff0c;进行完善#xff0c;实现以下功能#xff1a; 当列表中的数据为空的时候#xff0c;现实提示信息暂无待办事项当列表中存在数据的时候#xff0c;提示信息消失 这里介绍三种实现方式。 注意这里的Empty是…1 条件渲染 使用条件渲染结合TodoList案例进行完善实现以下功能 当列表中的数据为空的时候现实提示信息暂无待办事项当列表中存在数据的时候提示信息消失 这里介绍三种实现方式。 注意这里的Empty是前端框架Antd的组件如果安装了antd直接使用即可如果没有安装可以用div代替也是可以的。这里为了更直观所以使用了前端框架antd的Empty组件。 1、三元操作符 {/*方式一*/} {this.state.list.length 0 ? Empty style{{float:left}} description{暂无待办事项} / : null}2、逻辑与操作符 {/*方式二*/} { this.state.list.length 0 Empty style{{float:left}} description{暂无待办事项} /}3、css控制 方式三主要是通过给Empty容器绑定className属性为hidden然后通过className属性设置容器的display:none来实现Empty的隐藏与现实该方法中的Empty是一直都存在的。 {/*方式三*/} Empty className{this.state.list.length 0 ? : hidden} style{{float:left}} description{暂无待办事项} /2、实现效果动图如下 3、完整代码 import React, {Component} from react; import {Button, Empty} from antd; import {DeleteOutlined} from ant-design/icons;import ./css/App.css import ./css/01-index.cssexport default class App extends Component {a 35;myRef React.createRef();// 定义状态state {list: [{id: 1,name: 凯文·杜兰特},{id: 2,name: 德文·布克},{id: 3,name: 布拉德利·比尔}]}render() {return (div style{{marginTop: 10, marginLeft: 10}}input style{{width: 200}}ref{this.myRef}/{/*非常推荐*/}Button style{{backgroundColor: #2ba471, border: none}} size{middle} type{primary}onClick{() {this.handlerClick() // 非常推荐传参数}}添加/Buttonul{this.state.list.map((item, index) li style{{fontWeight: bold, fontSize: 20px}} key{item.id}{item.name}Button size{small}style{{marginLeft: 10}}type{primary}shape{circle}dangeronClick{() this.handlerDeleteClick(index)}icon{DeleteOutlined/}//li)}/ul{/*方式一*/}{/*{this.state.list.length 0 ? Empty style{{float:left}} description{暂无待办事项} / : null}*/}{/*方式二*/}{/*{ this.state.list.length 0 Empty style{{float:left}} description{暂无待办事项} /}*/}{/*方式三*/}Empty className{this.state.list.length 0 ? : hidden} style{{float:left}} description{暂无待办事项} //div)}handlerClick () {console.log(Click4, this.myRef.current.value);// 不要这样写因为不要直接修改状态可能会造成不可预期的问题// this.state.list.push(this.myRef.current.value);let newList [...this.state.list];newList.push({id: Math.random() * 100000000, // 生产不同的idname: this.myRef.current.value});this.setState({list: newList})}handlerDeleteClick(index) {console.log(Del-, index);// 深复制let newList this.state.list.concat();newList.splice(index, 1);this.setState({list: newList})// 清空输入框this.myRef.current.value ;} }
http://www.zqtcl.cn/news/119448/

相关文章:

  • 挖矿网站怎么做域名注册需要多少钱?
  • 哈尔滨制作网站企业各位给推荐个网站
  • 程序员做网站类的网站犯法吗wordpress源码系统下载
  • 西安注册公司在哪个网站国际知名工程咨询公司
  • 重庆市网站备案材料做网站和做新媒体运营
  • 大岭山网站建设公司网站建设需要具备的能力
  • 网站建设接外包流程网上可以报警备案吗
  • 建筑网站接单WordPress文章数据转emlog
  • 海口网络平台网站开发wordpress on lnmp
  • 手机怎么登录自己做的网站免费注册域名网站知乎
  • 万宁市住房和城乡建设局网站网页游戏制作过程的
  • 网站建设批复意见浏览有关小城镇建设的网站 记录
  • 做国际贸易做什么网站遵义做网站优化
  • 电商平台正在建设中网站页面提示开发手机网站用什么好
  • 电商设计素材网站推荐百度云app下载安装
  • 网站怎样和首页做链接地址百度怎么打广告在首页
  • 眉县做网站网站开发技术可行性分析
  • 深圳求职网站哪个好网站上面的在线咨询是怎么做的
  • 做饰品一般用什么网站做首饰凡客数据
  • 工业电商做网站怎么样wordpress 韩国 主题
  • 网站的优化从几个方面网站建设需注意哪些事项
  • 网站建设的技术有哪些内容东莞网站建设最优
  • 网站建设税费很多网站没有后台
  • 百度云主机上装网站flash怎么做网页
  • 外贸网站能用阿里云吗哔哩哔哩网页版打不开
  • 南宁月嫂网站建设财经直播的网站开发一个多少钱
  • 宁波网站的建设百度网盟推广 网站
  • 大连城乡建设局网站青岛网站建设外贸
  • 石家庄网站建设招聘珠海快速网站建设
  • 网站建设代理ai制作网页