Taro 封装箭头组件

参数说明类型默认值必填
color箭头的颜色string#000000
lineWidth箭头线的宽度number2
breadth箭头的大小number5
unfold是否展开(多用于下拉框)booleanfalse
fixedAngle固定角度(优先级大于unfold)number-
import { View } from "@tarojs/components"

interface HArrowProps {
    color?:string,
    lineWidth?:number, // 线的宽度
    breadth?:number, // 箭头的大小
    unfold?:boolean,
    fixedAngle?:number,
}

const HArrow = (props:HArrowProps) => {
    const {
        color = '#000000',
        lineWidth = 2,
        breadth = 5,
        unfold = false,
        fixedAngle
    } =  props
    return (
        <View style={{
            width:`${breadth}px`,
            height:`${breadth}px`,
            borderTop:`${lineWidth}px ${color} solid`,
            borderRight:`${lineWidth}px ${color} solid`,
            transform:`rotate(${fixedAngle || (unfold ? -45 : 135)}deg)`,
            transition: 'all 1s ease-out'
        }}>
        </View>
    )
}

export default HArrow
Logo

智屏生态联盟致力于大屏生态发展,利用大屏快应用技术降低开发者开发、发布大屏应用门槛

更多推荐