🐞 fix(#1000663#13): 修复购物页面的样式问题
This commit is contained in:
@@ -1,9 +1,20 @@
|
||||
.iconText{
|
||||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
align-items: center;
|
||||
font-size: 28px;
|
||||
.iconfont{
|
||||
font-size: 40px;
|
||||
}
|
||||
.text{
|
||||
padding: 8px;
|
||||
}
|
||||
}
|
||||
// 水平方向
|
||||
.iconText--horizontal{
|
||||
flex-flow: row nowrap;
|
||||
align-items: center;
|
||||
}
|
||||
// 垂直方向
|
||||
.iconText--vertical{
|
||||
flex-flow: column nowrap;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
@@ -1,27 +1,54 @@
|
||||
import { FC } from "react"
|
||||
import React, { FC, useMemo } from "react"
|
||||
import { View, Text } from '@tarojs/components'
|
||||
import IconFont, { IconNames } from '../iconfont/iconfont'
|
||||
import styles from './index.module.scss'
|
||||
import classnames from 'classnames'
|
||||
|
||||
type Direaction = 'left' | 'right' | 'bottom' | 'top'
|
||||
|
||||
type PropsType = {
|
||||
iconName: IconNames
|
||||
iconSize?: number
|
||||
svg?: boolean
|
||||
color?: string,
|
||||
text?: string
|
||||
direction?: Direaction
|
||||
children?: React.ReactNode
|
||||
customClass?: string
|
||||
customStyle?: React.CSSProperties
|
||||
textClassName?: string
|
||||
textCustomStyle?: React.CSSProperties
|
||||
}
|
||||
|
||||
const IconText: FC<PropsType> = (props) => {
|
||||
const { children, svg = false, iconName, iconSize = 40, text = '', color } = props
|
||||
const { children, svg = false, iconName, iconSize = 40, text = '', color,textCustomStyle,direction='left' } = props
|
||||
const classNameObject = {
|
||||
[styles['iconText--horizontal']]: ['left', 'right'].includes(direction),
|
||||
[styles['iconText--vertical']]: ['bottom', 'top'].includes(direction)
|
||||
}
|
||||
const iconComponent = svg ? <IconFont name={iconName} size={iconSize} color={color}></IconFont> : <Text className={classnames('iconfont', iconName, styles.iconfont)}></Text>
|
||||
|
||||
const textComponent = children ? children : <Text className={classnames(props.textClassName, styles['text'])} style={textCustomStyle}>{text}</Text>
|
||||
|
||||
const component = ()=>{
|
||||
console.log('direction===>',direction);
|
||||
if(direction === 'left' || direction === 'top'){
|
||||
return <>
|
||||
{iconComponent}
|
||||
{textComponent}
|
||||
</>
|
||||
}else if(direction === 'right' || direction === 'bottom'){
|
||||
return <>
|
||||
{textComponent}
|
||||
{iconComponent}
|
||||
</>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<View className={classnames(styles.iconText, props.customStyle, props.customClass)}>
|
||||
{svg ? <IconFont name={iconName} size={iconSize} color={color}></IconFont> : <Text className={classnames('iconfont', iconName, styles.iconfont)}></Text>}
|
||||
{children ? children : <Text className={classnames(props.textClassName)}>{text}</Text>}
|
||||
<View className={classnames(styles.iconText,classNameObject, props.customStyle, props.customClass)}>
|
||||
{component()}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -92,6 +92,7 @@ export default memo(
|
||||
<IconFont
|
||||
name='icon-sousuo'
|
||||
size={37}
|
||||
color='#ababac'
|
||||
customClassName={classnames(styles.icon_a_sousuo1_self, placeIcon == 'inner' ? styles.icon_inner : styles.icon_out)}></IconFont>
|
||||
)}
|
||||
<View className={styles.input_bar}>
|
||||
|
||||
Reference in New Issue
Block a user