Dialog

Dialog 弹框

代码示例

import { BfDialog } from '@bud-fe/react-taro-ui';
import { Button, View } from '@tarojs/components';
import Taro from '@tarojs/taro';
import React, { useState } from 'react';
export default () => {
const [baseOpened, setBaseOpened] = useState(false);
const [singleBtnOpened, setSingleBtnOpened] = useState(false);
const [disableOpened, setDisableOpened] = useState(false);
return (
<>
<Button className="group-title" onClick={() => setBaseOpened(true)}>
基础用法
</Button>
<Button className="group-title" onClick={() => setDisableOpened(true)}>
confirmDisable=true
</Button>
<Button className="group-title" onClick={() => setSingleBtnOpened(true)}>
自定义渲染 content
</Button>
<BfDialog
actionTip="操作提示"
isOpened={baseOpened}
title="提醒"
content="业务台账修改需要您的上级审批,若您正在执行拜访任务,不会造成影响。"
onCancel={() => setBaseOpened(false)}
onTipClick={() => Taro.showToast({ title: '操作提示' })}
/>
<BfDialog
confirmDisable
actionTip="操作提示"
isOpened={disableOpened}
title="标题"
content="内容"
onCancel={() => setDisableOpened(false)}
onTipClick={() => Taro.showToast({ title: '操作提示' })}
/>
<BfDialog
isOpened={singleBtnOpened}
title="标题"
content={
<View>
<View>123</View>
<View>123</View>
<View>123</View>
<View>123</View>
<View>123</View>
<View>123</View>
<View>123</View>
</View>
}
onCancel={() => setSingleBtnOpened(false)}
/>
</>
);
};

API

属性名描述类型默认值
isOpened是否打开booleanfalse
title标题any--
content内容any--
contentClass内容区样式string--
showActions是否展示操作栏booleantrue
actionMode操作栏模式(单/双按钮)。默认为双按钮"singleBtn" | "doubleBtn"doubleBtn
actionTip操作栏底部提示string--
cancelText自定义取消按钮文本string'取消'
confirmText自定义确认按钮文本string'确定'
confirmDisable确认按钮是否禁用booleanfalse
cancelDisable取消按钮是否禁用booleanfalse
styleMode对话框样式。默认为bf样式"base" | "bf"'bf'
showCloseIcon是否展示关闭icon。bf样式时有效booleantrue
showActionShadow当内容区长度超过最大高度时是否显示吸底按钮上方阴影booleantrue
onCancel回调: 取消() => void--
onConfirm回调: 确认() => void--
onTipClick回调: 提示() => void--
dumi10:24