需求: 发送某个请求时,设置loding动画,loading半透明,可以看见遮罩下的其他元素
问题相关代码,请勿粘贴截图
async bindUserGroup() {
if (!this.checkBindUserGroupform()) return
const loading = this.$loading({
lock: true,
text: '请等待',
background: 'rgba(0, 0, 0, 0.3)'
})
await bindUserGroup(
this.bindUserGroupform.groupCode,
this.bindUserGroupform.PackageVersionFile
)
.then(res => {
this.dialogVisible = false
loading.close()
this.$message({
type: res.data.code === 0 ? 'success' : 'error',
message: res.data.message
})
this.$router.push({
path: '/views/synergy/userGroupManagerLogs',
query: { groupCode: this.bindUserGroupform.groupCode }
})
})
.catch(err => {
this.dialogVisible = false
loading.close()
console.log(err)
})
},
运行结果及报错内容
可见遮罩下的元素都不见了,
这是正常无遮罩的页面元素