将a-drawer修改为notification组件

效果图

源码

<template>
<div>
<a-drawer
placement="right"
:closable="true"
width="560"
:visible="visible"
:after-visible-change="afterVisibleChange"
@close="onClose"
:wrapStyle="{height: '26%', zIndex: 888}"
:mask="false"
v-if="notifyData.length"
>
<div style="display: flex; flex-direction: column">
<div class="per-item" v-for="(perData, index) in notifyData" style="padding: 6px 0">
<div style="display: flex; flex-direction: column">
<span>
<a-tag color="red" v-if="perData.type === 1">{{ perData.message }}</a-tag>
<a-tag color="green" v-else>{{ perData.message }}</a-tag>
<span style="font-weight: 500; font-size: 15px">
检查时间:{{ perData.checkTime }}
隐患点:{{ perData.dangerPlace }}
</span>
</span>
<div style="padding-top: 6px;
z-index: 9999;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;"
:title="perData.description">
隐患描述: {{ perData.description }}
</div>
</div>
</div>
</div>
</a-drawer>
</div>
</template>
<script>
import { loadNotifyData } from '../../api/aBus';
export default {
name: 'notify',
data() {
return {
visible: true,
notifyData: []
};
},
async mounted() {
const res = await loadNotifyData();
if (res.status === 0) {
console.log('output-> res.data: ', res.data);
this.notifyData = res.data;
setTimeout(() => {
this.onClose()
}, 8000)
}
},
methods: {
afterVisibleChange(val) {
console.log('visible', val);
},
showDrawer() {
this.visible = true;
},
onClose() {
this.visible = false;
},
}
};
</script>
<style scoped>
</style>
posted @   Felix_Openmind  阅读(15)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· AI 智能体引爆开源社区「GitHub 热点速览」
· 写一个简单的SQL生成工具
历史上的今天:
2023-03-27 Vue3综合使用案例
2023-03-27 Vue3中的Vuex
2023-03-27 defineExpose(父拿子方法)
2023-03-27 defineEmits传值(子传父)
2023-03-27 defineProps传参(父传子)
*{cursor: url(https://files-cdn.cnblogs.com/files/morango/fish-cursor.ico),auto;}
点击右上角即可分享
微信分享提示