效果:在div中实现el-loading
<div class="content-main">
{{ hotList }}
</div>
getHotList(columnType) {
this.$nextTick(() => {
var loading = this.$loading({
lock: true,
text: "努力加载中...",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.5)",
target: document.querySelector(".content-main") // 替换成你的类名
});
try {
getPolicyList({columnType, pageNum: 1, pageSize: 10}).then(res15 => {
this.hotList = res15.data.rows
}).finally(() => {
loading.close();
})
} catch (error) {
console.error(error);
}
})
},