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

网站建设网点深圳物流公司排名前十

网站建设网点,深圳物流公司排名前十,wordpress中页面编辑,网站设计服务表React从入门到精通之购物车案例1. 购物车需求说明使用到的data list2. 项目code1. 购物车需求说明 list data展示到列表中每个item的通过按钮来控制购买的数据量删除按钮可以删除当前的itemTotal Price计算当前购物车的总的价格 使用到的data list const books [{id: 1,name… React从入门到精通之购物车案例1. 购物车需求说明使用到的data list2. 项目code1. 购物车需求说明 list data展示到列表中每个item的通过±按钮来控制购买的数据量删除按钮可以删除当前的itemTotal Price计算当前购物车的总的价格 使用到的data list const books [{id: 1,name: introduction to algorithms,date: 2006-9,price: 85.00,count: 1},{id: 2,name: The Art of UNIX Programming,date: 2006-2,price: 59.00,count: 1},{id: 3,name: Programming pearls,date: 2008-10,price: 39.00,count: 1},{id: 4,name: Complete code,date: 2006-3,price: 128.00,count: 1},] 2. 项目code !DOCTYPE html html langen headmeta charsetUTF-8meta http-equivX-UA-Compatible contentIEedgemeta nameviewport contentwidthdevice-width, initial-scale1.0titleshop car demo/titlestyletable {border-collapse: collapse;text-align: center;}thead {background-color: #f2f2f2;}td, th {padding: 10px 16px;border: 1px solid #aaa; }/style /head bodydiv idroot/div!-- import react dependencies --script src../../lib/react.js/scriptscript src../../lib/react-dom.js/scriptscript src../../lib/babel.js/script!-- import data --script src./data.js/scriptscript typetext/babel// component Appclass App extends React.Component {constructor(){super()this.state {books: books}}// add sumincrement(index) {const newBooks [...this.state.books]newBooks[index].count 1this.setState({ books: newBooks })}// reduce sum decrement(index) {const newBooks [...this.state.books]newBooks[index].count - 1this.setState({ books: newBooks })}/*delte item from table*/deleteItem(index) {const newBooks [...this.state.books]newBooks.splice(index, 1)this.setState({ books: newBooks })}render(){const { books } this.statereturn (divtabletheadtrtdOrder/tdtdName/tdtdPublish Date/tdtdPrice/tdtdBought Sum/tdtdOperation/td/tr/theadtbody{books.map((item, index) {return (tr key{ item.id }td{ index 1 }/tdtd{ item.name }/tdtd{ item.date }/tdtd{ $ item.price }/tdtdbutton disabled{ item.count 1 } onClick{ () {this.decrement(index)} }-/button{ item.count }button onClick{ () {this.increment(index)} }/button/tdtdbutton onClick{ () {this.deleteItem(index)} }Delete/button/td/tr)})}/tbody/tableh2Total Price: $ {books.reduce((preValue, item) preValue item.count * item.price, 0)}/h2/div)}}// create react domconst root ReactDOM.createRoot(document.querySelector(#root))// dom render by reactroot.render(App/)/script/body /html
http://www.dnsts.com.cn/news/222545.html

相关文章:

  • 三网合一网站建设东莞关键词seo
  • 网站建设 网站设计华为 wordpress
  • 网站设计规划高中信息技术且网站制作
  • 北京市建设工程发包承包交易中心网站云南省建设厅网站职称评审
  • 广州骏域网站建设专家手机电脑版c2c网站架构
  • 温州专业做网站网站开发中可能遇到的技术问题
  • 网站建设软文网站设计文档
  • wordpress网站速度慢ip直接访问网站 备案
  • 宜州做网站旅游网站的建设背景
  • 让自己的电脑做网站的服务器福田庆三整过的明星
  • 高端+旅游+网站建设网站开发的技术解决方案
  • 让别人做网站推广需要多少钱做网站一般什么价格
  • 网站加入wordpresswap网站制作视频教程
  • 网博士智能建站成都龙泉工程建设有限公司网站
  • 浙江中联建设集团有限公司网站网站建设费归入长期待摊费用
  • 做图文网站要什么配置的服务器WordPress文章分享图
  • word做网站连接网站模板图片
  • 重庆建网站公司网站域名注册需要什么手续
  • 上海企业网站推广杭州比较好的网站建设公司
  • 仿网链网站源代码下载怎么搜索网站
  • 深圳网站建设lxhd韩国热搜榜
  • 杭州做公司网站的公司国外试用网站空间
  • 湛江网站设计模板视频店面设计怎么样
  • 标准网站有哪些常州经开区建设局网站
  • 网站用什么颜色外贸网站使用什么品牌国外主机
  • 天津做网站公司哪家好wordpress 花瓣模板
  • 上海建设银行网站莘庄免费开网站
  • 在哪个网站做流动补胎的广告好万能素材网站下载
  • 渭南哪家公司可以做网站网站频道规划
  • wordpress 4.9 多站wordpress创意博客