将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>
学而不思则罔,思而不学则殆!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 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传参(父传子)