html:
<el-table v-loading = "isLoading" element-loading-background = "rgba(255, 255, 255, .5)" element-loading-text = "加载中,请稍后..." element-loading-spinner = "el-icon-loading"> </el-table>data设置:
data(){ return { isLoading:false } }请求示例:
methods:{ getList() { //请求之前,开启loading this.isLoading = true; collieryList(1, 10).then(response => { //请求成功,关闭loading this.isLoading = false; }).catch(err => { //请求失败,关闭loading this.isLoading = false; }) }, }