购物车完成

This commit is contained in:
2022-04-07 17:31:49 +08:00
parent 64ed1aaad6
commit df850ed826
18 changed files with 637 additions and 107 deletions
+20
View File
@@ -0,0 +1,20 @@
.checkbox_item{
width: 40px;
height: 40px;
border: 1px solid #707070;
border-radius: 50%;
text-align: center;
line-height: 40px;
}
.checkbox_item_select{
background-color: $color_main;
border: 0;
color: #fff;
width: 44px;
height: 44px;
text-align: center;
line-height: 44px;
.miconfont{
font-size: 26px;
}
}
+32
View File
@@ -0,0 +1,32 @@
import { View } from "@tarojs/components"
import classnames from "classnames";
import { useEffect, useState } from "react";
import styles from "./index.module.scss"
type params = {
onSelect?: () => void,
onClose?: () => void,
status?: false|true
}
export default ({onSelect, onClose, status = false}: params) => {
const [selected, SetSelected] = useState(false)
const onSelectEven = () => {
let res = !selected
if(res) {
onSelect?.()
} else {
onClose?.()
}
SetSelected(res)
}
useEffect(() => {
SetSelected(status)
}, [status])
return (
<>
<View className={classnames(styles.checkbox_item, selected&&styles.checkbox_item_select)} onClick={() => onSelectEven()}>
{selected&&<View className={classnames('iconfont', 'icon-tick_gou', styles.miconfont)}></View>}
</View>
</>
)
}