🎈 perf(多选): 完成购物车多选逻辑

This commit is contained in:
xuan
2022-09-27 12:03:22 +08:00
parent eb22811dfa
commit 3b3adcb203
10 changed files with 53 additions and 47 deletions
+3 -3
View File
@@ -4,7 +4,7 @@ import "./iconfont.scss";
import Taro from "@tarojs/taro";
import classnames from "classnames";
const initSvgSize = (36 / 750) * Taro.getSystemInfoSync().windowWidth
const SystemWidth = Taro.getSystemInfoSync().windowWidth
const quot = '"'
function hex2rgb(hex) {
@@ -43,7 +43,7 @@ const IconFont:FC<PropsType> = ({
}) => {
const [colors, setColors] = useState<PropsType['color']>()
const [isStr, setIsStr] = useState(true)
const [svgSize, setSvgSize] = useState(initSvgSize)
const [svgSize, setSvgSize] = useState(() => (size / 750) * SystemWidth)
useEffect(() => {
setIsStr(typeof color === 'string')
@@ -60,7 +60,7 @@ const IconFont:FC<PropsType> = ({
}, [color])
useEffect(() => {
setSvgSize((size / 750) * Taro.getSystemInfoSync().windowWidth)
setSvgSize((size / 750) * SystemWidth)
}, [size])
// 也可以使用 if (name === 'xxx') { return <view> } 来渲染,但是测试发现在ios下会有问题,报错 Maximum call stack啥的。下面这个写法没问题