🐳 chore(迁移仓库): 迁移仓库到新的仓库
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
|
||||
.divider {
|
||||
position: relative;
|
||||
// 垂直
|
||||
&-vertical {
|
||||
display: inline-block;
|
||||
width: 1px;
|
||||
height: 1em;
|
||||
margin: 0 8px;
|
||||
border-left: 1px $borderStyle $borderColor;
|
||||
vertical-align: middle;
|
||||
}
|
||||
// 水平
|
||||
&-horizontal {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
margin: 48px 0;
|
||||
border-top: 1px $borderStyle $borderColor;
|
||||
}
|
||||
&-text{
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
padding: 0 40px;
|
||||
font-weight: 500;
|
||||
font-size: 28px;
|
||||
color: #333;
|
||||
background-color: #fff;
|
||||
}
|
||||
}
|
||||
.is{
|
||||
&-center{
|
||||
left: 50%;
|
||||
transform: translateX(-50%) translateY(-50%);
|
||||
}
|
||||
&-left{
|
||||
left: 20px;
|
||||
transform:translateY(-50%);
|
||||
}
|
||||
&-right{
|
||||
right: 20px;
|
||||
transform:translateY(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Usage:
|
||||
*
|
||||
* <View>巴拉巴拉小魔仙</View>
|
||||
* <Divider direction="vertical" borderStyle="solid"></Divider
|
||||
* <View>全身变</View>
|
||||
*
|
||||
*/
|
||||
|
||||
import { View } from "@tarojs/components";
|
||||
import { FC, ReactNode } from "react";
|
||||
import styles from "./index.module.scss";
|
||||
import classnames from "classnames";
|
||||
|
||||
type BorderStype = 'solid' | 'dashed' | 'dotted' | 'double'
|
||||
|
||||
interface DividerProps {
|
||||
direction?: "horizontal" | "vertical";
|
||||
borderStyle?: BorderStype;
|
||||
contentPosition?: "left" | "center" | "right";
|
||||
children?: ReactNode;
|
||||
}
|
||||
const Divider: FC<DividerProps> = props => {
|
||||
const {
|
||||
direction = "horizontal",
|
||||
borderStyle = "solid",
|
||||
contentPosition = "center"
|
||||
} = props;
|
||||
|
||||
const classname = classnames(
|
||||
styles["divider"],
|
||||
styles["divider-" + direction]
|
||||
);
|
||||
const contentClassname = classnames(
|
||||
styles["divider-text"],
|
||||
styles["is-" + contentPosition]
|
||||
);
|
||||
|
||||
const borderTopStyle: { borderTopStyle: BorderStype } = {
|
||||
borderTopStyle: borderStyle
|
||||
};
|
||||
const borderLeftStyle: { borderLeftStyle: BorderStype } = {
|
||||
borderLeftStyle: borderStyle
|
||||
};
|
||||
|
||||
const dividerStyle =
|
||||
direction === "horizontal" ? borderTopStyle : borderLeftStyle;
|
||||
|
||||
return (
|
||||
<View className={classname} style={dividerStyle}>
|
||||
{props.children && direction !== "vertical" && (
|
||||
<View className={contentClassname}>{props.children}</View>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
};
|
||||
export default Divider
|
||||
@@ -17,4 +17,4 @@ export default memo(({onClose, styleObj = {}}:Params) => {
|
||||
<Text className={`iconfont icon-qingkong ${style.icon_a_btn}`}></Text>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -25,7 +25,7 @@ export default memo(({list = [], defaultValue = 0, tabsOnClick, style={}}: Param
|
||||
|
||||
useEffect(() => {
|
||||
const index = list?.findIndex(item => {
|
||||
return item.value == defaultValue
|
||||
return item.value == defaultValue
|
||||
})
|
||||
if(index !== -1) {
|
||||
const num = index > 0?( index - 1) : 0
|
||||
@@ -58,4 +58,4 @@ export default memo(({list = [], defaultValue = 0, tabsOnClick, style={}}: Param
|
||||
</View>
|
||||
</>
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user