react实现价格滑块拖动筛选商品列表效果代码
代码语言:html
所属分类:电商
代码描述:react实现价格滑块拖动筛选商品列表效果代码,通过滑块拖动来选择价格区间内的商品。
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@100;400;800&display=swap'); body { margin: 0; font-family: 'Montserrat', sans-serif; } .header { margin-top: 0; text-transform: uppercase; color: white; background-color: black; text-align: center; padding: 10px; font-weight: 100; } .results { display: inline-flex; justify-content: space-around; flex-wrap: wrap; margin: 50px 10% 50px 10%; } .item { padding: 5px; } .brand { font-weight: 400; text-align: center; text-transform: uppercase; } .price { font-weight: 100; text-align: center; } .controls { margin-top: 50px; display: flex; justify-content: center; align-items: center; } .filter-text { padding-right: 10px; } #slider { -webkit-appearance: none; margin-right: 15px; width: 200px; height: 7px; background: rgb(211,211,211, 0.7); } #slider::-webkit-slider-thumb { -webkit-appearance: none; height: 20px; width: 20px; border-radius: 50%; background: white; border: 0.1 solid grey; cursor: pointer; box-shadow: 0 0 2px 0 #555; } #slider::-webkit-slider-runnable-track { -webkit-appearance: none; box-shadow: none; background: transparent; } </style> </head> <body> <div id="root"></div> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/babel.7.18.13.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/react.production.16.13.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/react-dom.production.16.13.js"></script> <script type="text/babel"> const { useState } = React; const Header = () => <h1 class="header">Handbags</h1>; const bagsArray = [ {"price": "830", "url": "//repo.bfw.wiki/bfwrepo/images/product/stella-mccartney-830.png", "brand": "Stella McCartney", "id":"1"}, {"price": "590", "url": "//repo.bfw.wiki/bfwrepo/images/product/chloe-590.png", "brand": "Chloe", "id":"2"}, {"price": "285", "url": "//repo.bfw.wiki/bfwrepo/images/product/staud-285.png", "brand": "Staud", "id":"3"}, {"price": "1190", "url": "//repo.bfw.wiki/bfwrepo/images/product/balenciaga-1190.png", "brand": "Balenciaga", "id":"4"}, {"price": "880", "url": "//repo.bfw.wiki/bfwrepo/images/product/alaia-880.png", "brand": "Alaia", "id":&qu.........完整代码请登录后点击上方下载按钮下载查看
网友评论0