mrcio-ui
Version:
107 lines (81 loc) • 3.22 kB
Plain Text
1.安装
npm install mrcio-ui --save
2.引用
import {GlobalLoading, PartLoading} from "mrcio-ui"
3.loading API 属性
(1)全局loading
属性名(name) 类型(type) 必要性(Required) 默认值(default) 描述(description)
open Boolean true false 是否显示loading
type String true 无 loading的类型,现在有loading,success,fail,hint
title String true 无 loading弹出的标题,如:提交成功,正在加载中
content String false 无 loading内容
btnText String false 无 loading按钮文字,如:"提交", 注:hint 时 指提交的文字 其他指返回文字
submitFn Function true 无 hint 提交的方法
handleClose Function true 无 所有返回的方法
(2)全局loading
4. 使用方式
import React, {Component} from 'react'
import {GlobalLoading, PartLoading} from "mrcio-ui"
class TestLoading extends Component {
constructor(props) {
super(props);
this.state = {
open: false,
type: "loading",
title: "正在加载中...",
content: "",
btnText: "",
};
};
setOpenFn = (type)=> {
this.setState({
open: true,
type: "fail",
title: "提交失败",
content: "调休余额不足,请填写加班后,在休假",
btnText: "",
})
};
submitFn = ()=> {
this.setState({
open: false,
})
console.log("submitFn");
alert(1);
};
handleClose = ()=> {
console.log("handleClose");
this.setState({
open: false,
})
};
render() {
return (
<div>
<div>button 全局loading</div>
<br/>
<div style={{
display: "flex",
width: "20rem",
justifyContent: "space-between",
padding: "1rem",
border: "#eee solid 1px",
}}>
<div onClick={this.setOpenFn.bind(this, '4')}>提示</div>
</div>
<GlobalLoading
open={this.state.open}
type={this.state.type}//"loading" // loading success fail hint
title={this.state.title}//"正在提交中..."
content={this.state.content}//"按实际付款哈看帅哥"
btnText={this.state.btnText}//"提交" // hint 时 指提交的文字 其他指返回文字
submitFn={this.submitFn}
handleClose={this.handleClose}
/>
<br/><br/>
<PartLoading/>
</div>
)
}
}
export default TestLoading;