日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

PC菜单筛选器

發(fā)布時(shí)間:2023/12/31 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 PC菜单筛选器 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

?

如上圖所示,不使用UI庫(kù),手寫一個(gè)篩選器

JS代碼

'use strict'; import {createElement,useEffect,useState,Fragment,useCallback,useMemo,useRef, } from 'rax'; import View from 'rax-view'; import Text from 'rax-text'; import Picture from '@ali/rax-picture'; import './index.css';const v1 ='https://img.alicdn.com/imgextra/i4/O1CN01KmlzFh1ohkrTChKp0_!!6000000005257-2-tps-18-10.png'; const v2 ='https://img.alicdn.com/imgextra/i3/O1CN01VxAOuU1E39aJS3P7Y_!!6000000000295-2-tps-18-10.png';export default function TheFilter(props) {let liTitle = [{ name: '綜合排序', id: 1 },{ name: '銷量', id: 2 },{ name: '收藏?cái)?shù)', id: 3 },{ name: '傭金金額', id: 4 },];let ch1 = [{ name: '綜合排序', id: 11 },{ name: '新品優(yōu)先', id: 12 },];let ch2 = [{ name: '傭金金額', id: 41 },{ name: '傭金比例', id: 42 },];const { changeMenu } = props;const [list, setList] = useState(liTitle);const [child1, setChild1] = useState(ch1);const [child2, setChild2] = useState(ch2);const [cur, setCur] = useState(0);const [c1, setC1] = useState(0);const [c2, setC2] = useState(0);const changeStatus = (v, index, status) => {// 處理父類篩選if (v.id === 11 || v.id === 12) {setC1(index);}if (v.id === 41 || v.id === 42) {setC2(index);}// 點(diǎn)擊子節(jié)點(diǎn)if (status) {changeMenu(v.id);stopBubbling();// 替換頭部標(biāo)題list.forEach((k) => {if (k.id === +`${v.id}`.substring(0, 1)) {k.name = v.name;}});setList(list);} else { // 點(diǎn)擊父節(jié)點(diǎn)changeMenu(v.id);setCur(index);// 復(fù)原 頭部和子內(nèi)容setList(liTitle);setC1(0);setC2(0);// setChild1(ch1);// setChild2(ch2);}};const stopBubbling = (e) => {e = window.event || e;if (e.stopPropagation) {e.stopPropagation(); // 阻止事件 冒泡傳播} else {e.cancelBubble = true; // ie兼容}};return (<View className="mod">{list.map((item, index) => {return (<ViewclassName={`${cur == index ? 'primary' : 'side'}`}key={`tilte${index}`}onClick={() => {changeStatus(item, index);}}><TextclassName="tag"lines={1}style={{ color: cur == index ? '#396efe' : '#60646f' }}>{item.name}</Text><Viewx-if={item.id === 1 || item.id === 4}className="iconDownWrapper"><PictureclassName="iconDown"source={{uri: cur == index ? v1 : v2,}}/></View><View className="sec-group" x-if={cur === 0}>{child1.map((v, index) => {return (<ViewclassName={c1 == index ? 'sec-main' : 'sec-common'}key={index}onClick={() => {changeStatus(v, index, true);}}><TextclassName={c1 == index ? 'sec-tag1' : 'sec-tag'}lines={1}>{v.name}</Text></View>);})}</View><View className="sec-mount-mod" x-if={cur === 3}>{child2.map((v, index) => {return (<ViewclassName={c2 == index ? 'sec-main' : 'sec-common'}key={index}onClick={() => {changeStatus(v, index, true);}}><TextclassName={c2 == index ? 'sec-tag1' : 'sec-tag'}lines={1}>{v.name}</Text></View>);})}</View></View>);})}</View>); }

changeMenu會(huì)將選擇的數(shù)據(jù)返回給父組件,可根據(jù)返回的數(shù)據(jù)做具體的操作

?

CSS代碼

.mod {display: flex;flex-direction: row;align-items: center;cursor: pointer;margin-bottom: 20px;margin-left: -85px; } .primary {display: flex;flex-direction: row;justify-content: center;align-items: center;width: 106px;height: 36px;background-color: #f0f6ff;border-width: 1px;border-style: solid;/* border-top-left-radius: 3px;border-bottom-left-radius: 3px; */border-color: #396efe; }.tag {margin-right: 4px;font-family: PingFang SC;font-size: 14px;font-weight: 400;line-height: 14px;white-space: nowrap; } .iconDownWrapper {display: flex;flex-direction: row;justify-content: center;align-items: center;width: 17px;height: 17px;margin-top: -2px; } .iconDown {width: 8px;height: 4px;margin-top: 1px; } .side {display: flex;flex-direction: row;align-items: center;justify-content: center;height: 36px;background-color: #ffffff;border-width: 1px;border-style: solid;width: 106px;border-color: #d4d7e1;padding: 0 18px;color: #60646f; } .side:nth-of-type(2), .side:nth-of-type(3), .side:nth-of-type(4) {border-left-style: none !important; }.labelWrapperItem0 {display: flex;flex-direction: row;justify-content: center;align-items: flex-start;width: 59px;height: 22px;white-space: nowrap; } .label {overflow: hidden;max-width: 47px;font-family: PingFang SC;font-size: 14px;font-weight: 400;color: #60646f;text-overflow: ellipsis; } .verticalLine {width: 1px;height: 34px;margin-right: 1px;background-color: #d4d7e1; } .labelWrapperItem1 {display: flex;flex-direction: row;justify-content: center;align-items: flex-start;width: 71px;height: 22px;white-space: nowrap; } .favor {overflow: hidden;max-width: 59px;font-family: PingFang SC;font-size: 14px;font-weight: 400;color: #60646f;text-overflow: ellipsis; } .verticalLine1 {width: 1px;height: 34px;margin-right: 1px;background-color: #d4d7e1; } .group {display: flex;flex-direction: row;justify-content: center;align-items: center;width: 106px;height: 22px; } .word {margin-right: 4px;font-family: PingFang SC;font-size: 14px;font-weight: 400;line-height: 14px;color: #60646f;white-space: nowrap; } .iconDownWrapper1 {display: flex;flex-direction: row;justify-content: center;align-items: center;width: 17px;height: 17px;margin-top: -1px; } .iconDown1 {width: 8px;height: 4px;margin-top: 1px; } .sec-mod {width: 107px;height: 80px;white-space: nowrap;position: absolute;top: 36px; }.sec-mount-mod {width: 107px;height: 80px;white-space: nowrap;position: absolute;background-color: #ffffff;box-shadow: 0 3px 6px 0 rgba(51, 53, 59, 0.12);border-radius: 3px;border-width: 1px;border-style: solid;border-color: #e8ebf2;top: 36px;left: 0;/* margin-left: 317px; */margin-left: 232px;z-index: 999;opacity: 0;display: block;font-size: 13px;transition: 0.3s;-webkit-transition: 0.5s;-moz-transition: 0.5s; }.primary:hover .sec-group, .primary:hover .sec-mount-mod {opacity: 1; }.sec-group {z-index: 999;display: flex;flex-direction: column;align-items: flex-start;width: 107px;height: 80px;background-color: #ffffff;box-shadow: 0 3px 6px 0 rgba(51, 53, 59, 0.12);border-radius: 3px;border-width: 1px;border-style: solid;border-color: #e8ebf2;position: absolute;top: 36px;opacity: 0;display: block;font-size: 13px;transition: 0.3s;-webkit-transition: 0.5s;-moz-transition: 0.5s; } .sec-tag {position: relative;overflow: hidden;height: 22px;max-width: 83px;margin-top: 8px;margin-left: 11px;font-family: PingFang SC;font-size: 14px;font-weight: 400;line-height: 22px;color: #33353b;text-overflow: ellipsis; } .sec-tag1 {overflow: hidden;max-width: 83px;margin-top: 8px;height: 22px;line-height: 22px;margin-left: 11px;font-family: PingFang SC;font-size: 14px;font-weight: 400;color: #396efe;text-overflow: ellipsis; } .sec-main {position: relative;display: flex;flex-direction: row;align-items: center;width: 105px;height: 40px;/* margin-top: 8px; */margin-left: 0px;background-color: #f6f8fc;line-height: 14px;border-bottom-left-radius: 2px;border-bottom-right-radius: 2px; } .sec-common {position: relative;display: flex;flex-direction: row;align-items: center;width: 105px;height: 40px;/* margin-top: 8px; */margin-left: 0px;background-color: #fff;line-height: 14px;border-bottom-left-radius: 2px;border-bottom-right-radius: 2px; }

總結(jié)

以上是生活随笔為你收集整理的PC菜单筛选器的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 高清毛片aaaaaaaaa郊外 | 欧美激情图 | aa一级片| 99视频观看| 黑人一区二区三区 | 国产精品尤物视频 | 草草影院在线 | 欧美成人综合色 | 国产精品sm | 操操操操操操操操操 | 亚洲天堂中文 | 日本黄色激情视频 | 一区二区天堂 | 国产精品久久久久久 | 黄页视频在线免费观看 | www免费黄色 | 叼嘿视频91 | 91精品久久香蕉国产线看观看 | 日韩美女免费线视频 | 日韩中文字幕综合 | 日本道中文字幕 | 日本一级黄 | 亚洲一卡二卡在线 | 黄色网在线 | 日韩经典中文字幕 | 福利精品| av网站在线观看免费 | 精品乱码一区二区三区 | 久久久综合视频 | 亚洲最新av网站 | 国产精品第一国产精品 | 成人午夜视频一区二区播放 | 四虎午夜影院 | 亚洲色图 校园春色 | 国模无码视频一区二区三区 | 天天综合在线视频 | 国语对白做受按摩的注意事项 | 久久久精品国产sm调教网站 | 日本久久久网站 | www.超碰在线.com | 欧美淫 | 成人欧美一区二区三区黑人一 | 3p在线播放 | 国产乱码在线 | 中文字幕精品一区久久久久 | 久久免费视频99 | 91免费在线观看网站 | 女人18毛片水真多 | 亚洲中文字幕一区二区在线观看 | 欧美日韩h | 都市激情亚洲 | 久久久久久久性 | 欧美伊人久久 | 国产在线观看无码免费视频 | 中文字幕视频一区 | 一级黄网 | 午夜精品一区二区三区在线 | 波多野吉衣伦理片 | 韩日视频在线 | 色屁屁影院www国产高清麻豆 | 黄色片女人 | 中文字幕第315页 | 5566毛片 | xxx麻豆 | 日韩精品一区二区在线视频 | 中文字幕第11页 | 国产另类av | 99av视频 | 九九九热视频 | 国产免费一区二区三区最新不卡 | 色视频网址| 成年人视频在线看 | 欧美另类videossexo高潮 | 日本免费在线 | 中国a级大片 | 国产成人无码AA精品区 | 欧美精品久久久久久久久 | 精品动漫一区 | 综合国产视频 | av天堂一区二区三区 | 欧美激情18 | 欧美日韩在线综合 | 国产精品国产三级国产专区51 | 少妇被爽到高潮动态图 | 不卡av电影在线观看 | 国产一区福利 | 欧美成人a∨高清免费观看 国产精品999视频 | 亚洲欧美乱综合图片区小说区 | 亚洲欧洲日韩国产 | 99国产精品久久久 | 欧美午夜剧场 | 色噜噜综合网 | 美腿丝袜亚洲色图 | 日韩中文字幕不卡 | 国产精品婷婷午夜在线观看 | 黑人一级| 国内毛片毛片毛片毛片毛片 | 噜噜噜在线视频 | xxxxx在线观看 |