🎈 perf(邀请码): 添加错误❌处理机制
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
box-sizing: border-box;
|
||||
|
||||
&--normal {
|
||||
height: 72px;
|
||||
font-size: $font_size_medium;
|
||||
@@ -69,10 +70,19 @@
|
||||
}
|
||||
}
|
||||
&--text {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
align-items: center;
|
||||
color: currentColor;
|
||||
.loading {
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
left: -40px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
z-index: 1;
|
||||
}
|
||||
}
|
||||
// active 伪类
|
||||
&--primary:active {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Text, View } from '@tarojs/components'
|
||||
import { View } from '@tarojs/components'
|
||||
import type { FC, ReactNode } from 'react'
|
||||
import classnames from 'classnames'
|
||||
import Loading from '../loading'
|
||||
import styles from './index.module.scss'
|
||||
|
||||
type ButtonType = 'primary' | 'danger' | 'warning' | 'info'
|
||||
@@ -18,6 +19,7 @@ interface PropsType {
|
||||
customClassName?: string
|
||||
customStyles?: React.CSSProperties
|
||||
customTextClassName?: string
|
||||
loading?: boolean
|
||||
}
|
||||
|
||||
const NormalButton: FC<PropsType> = (props) => {
|
||||
@@ -33,6 +35,7 @@ const NormalButton: FC<PropsType> = (props) => {
|
||||
customStyles = {},
|
||||
customClassName = '',
|
||||
customTextClassName = '',
|
||||
loading = false,
|
||||
} = props
|
||||
const getClassName = () => {
|
||||
const classObject = {
|
||||
@@ -55,7 +58,9 @@ const NormalButton: FC<PropsType> = (props) => {
|
||||
|
||||
return (
|
||||
<View className={classnames(styles.button, getClassName(), customClassName)} style={customStyles} onClick={handleClick}>
|
||||
<View className={classnames(styles['button--text'], customTextClassName)}>{children}</View>
|
||||
<View className={classnames(styles['button--text'], customTextClassName)}>
|
||||
<View className={styles.loading}>{loading && <Loading width={30} />}</View>
|
||||
{children}</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user