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

福建建设中心网站微信软文推广怎么做

福建建设中心网站,微信软文推广怎么做,wordpress免费手机主题,广告收益平台React从入门到精通之购物车案例1. 购物车需求说明使用到的data list2. 项目code1. 购物车需求说明 list data展示到列表中每个item的通过按钮来控制购买的数据量删除按钮可以删除当前的itemTotal Price计算当前购物车的总的价格 使用到的data list const books [{id: 1,name…

React从入门到精通之购物车案例

  • 1. 购物车需求说明
    • 使用到的data list
  • 2. 项目code

1. 购物车需求说明

在这里插入图片描述

  • list data展示到列表中
  • 每个item的通过±按钮来控制购买的数据量
  • 删除按钮可以删除当前的item
  • Total 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 lang="en">
<head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>shop car demo</title><style>table {border-collapse: collapse;text-align: center;}thead {background-color: #f2f2f2;}td, th {padding: 10px 16px;border: 1px solid #aaa;        }</style>
</head>
<body><div id="root"></div><!-- import react dependencies --><script src="../../lib/react.js"></script><script src="../../lib/react-dom.js"></script><script src="../../lib/babel.js"></script><!-- import data --><script src="./data.js"></script><script type="text/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 (<div><table><thead><tr><td>Order</td><td>Name</td><td>Publish Date</td><td>Price</td><td>Bought Sum</td><td>Operation</td></tr></thead><tbody>{books.map((item, index) => {return (<tr key={ item.id }><td>{ index + 1 }</td><td>{ item.name }</td><td>{ item.date }</td><td>{ '$' + item.price }</td><td><button disabled={ item.count <=1 } onClick={ () => {this.decrement(index)} }>-</button>{ item.count }<button onClick={ () => {this.increment(index)} }>+</button></td><td><button onClick={ () => {this.deleteItem(index)} }>Delete</button></td></tr>)})}</tbody></table><h2>Total 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.yidumall.com/news/1424.html

相关文章:

  • 上海网站制作网站建设推广优化工具
  • 做网站怎么推广清远今日头条最新消息
  • 高端企业网站 程序做网站
  • 现在注册公司好注册吗seo还能赚钱吗
  • 做化学题的网站营销型企业网站有哪些平台
  • 网站建设优化公司排名网络营销个人总结
  • 网校 039 网站建设多少钱网络营销推广价格
  • 湖北网站推广策略免费网站怎么注册
  • 门户网站ui设计国家最新新闻
  • 香港公司能在大陆做网站备案嘛百度新闻客户端
  • 如何做公司企业网站seo合作
  • 网站备案时间就是正式上线时间吗百度知道网页版登录入口
  • wordpress字段管理网站优化排名
  • 做网站建设公司企业百度一下官方网站
  • 全椒有做网站的吗合肥seo软件
  • 现在写博客还是做网站国外网站推广公司
  • 新闻网站开发报告江苏seo技术教程
  • 做网站如何防止被坑上海网站排名seo公司
  • 怎么弄一个网站微信营销的案例
  • 网页设计网站视频青岛新闻最新消息
  • 网站建设与应用岗位视频广告
  • 潍坊做网站公司cfa一级看多久两分钟
  • 免费b2b网站推广平台体育热点新闻
  • 网站做的拖管不行 怎么投诉网络营销的工具有哪些
  • 网站qq交谈怎么做的网络营销专业如何
  • 如何做电商网站 昆明读书网站排名
  • 什么网站简单最好的免费建站网站
  • 石家庄做网站电话郑州seo优化顾问热狗
  • 建设网站的成本百度指数数据分析
  • 个人网站的留言板怎么做cpc广告接单平台