W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
加載數(shù)據(jù)時顯示動效。
在表格等容器中加載數(shù)據(jù)時顯示。
constructor(props) {
super(props);
this.table = {
columns: [
{
label: "日期",
prop: "date",
width: 180
},
{
label: "姓名",
prop: "name",
width: 180
},
{
label: "地址",
prop: "address"
}
],
data: [{
date: '2016-05-02',
name: '王小虎',
address: '上海市普陀區(qū)金沙江路 1518 弄'
}, {
date: '2016-05-04',
name: '王小虎',
address: '上海市普陀區(qū)金沙江路 1517 弄'
}, {
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀區(qū)金沙江路 1519 弄'
}, {
date: '2016-05-03',
name: '王小虎',
address: '上海市普陀區(qū)金沙江路 1516 弄'
}]
}
}
render() {
return (
<div className="el-loading-demo">
<Loading>
<Table
style={{width: '100%'}}
columns={this.table.columns}
data={this.table.data}
/>
</Loading>
</div>
)
}
可自定義加載文案。
添加text
屬性,其值會被渲染為加載文案,并顯示在加載圖標的下方。
constructor(props) {
super(props);
this.table = {
columns: [
{
label: "日期",
prop: "date",
width: 180
},
{
label: "姓名",
prop: "name",
width: 180
},
{
label: "地址",
prop: "address"
}
],
data: [{
date: '2016-05-02',
name: '王小虎',
address: '上海市普陀區(qū)金沙江路 1518 弄'
}, {
date: '2016-05-04',
name: '王小虎',
address: '上海市普陀區(qū)金沙江路 1517 弄'
}, {
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀區(qū)金沙江路 1519 弄'
}, {
date: '2016-05-03',
name: '王小虎',
address: '上海市普陀區(qū)金沙江路 1516 弄'
}]
}
}
render() {
return (
<div className="el-loading-demo">
<Loading text="拼命加載中">
<Table
style={{width: '100%'}}
columns={this.table.columns}
data={this.table.data}
/>
</Loading>
</div>
)
}
隱藏代碼
頁面數(shù)據(jù)加載時顯示。
當需要全屏遮罩時,可使用fullscreen
修飾符(此時遮罩會插入至 body 上)。
constructor(props) {
super(props);
this.state = {
fullscreen: false
}
}
onClick() {
clearTimeout(this.timeout);
this.timeout = setTimeout(() => {
this.setState({
fullscreen: false
});
}, 3000);
this.setState({
fullscreen: true
});
}
render() {
return (
<div>
<Button type="primary" onClick={this.onClick.bind(this)}>顯示整頁加載,3 秒后消失</Button>
{
this.state.fullscreen && <Loading fullscreen={true} />
}
</div>
)
}
參數(shù) | 說明 | 類型 | 可選值 | 默認值 |
---|---|---|---|---|
fullscreen | 是否全屏顯示 | bool | - | false |
text | 自定義加載文案 | string | - | - |
loading | 控制加載頁顯示 | bool | - | true |
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: