5 changed files with 281 additions and 106 deletions
@ -0,0 +1,97 @@ |
|||
import { Button, notification } from "ant-design-vue"; |
|||
import { CloseSquareTwoTone } from "@ant-design/icons-vue"; |
|||
import { h, VNode } from "vue"; |
|||
/** |
|||
* 消息弹窗组件 Notification |
|||
* @param {string} title 标题 |
|||
* @param {string} content 内容 |
|||
* @param {string} id 唯一标识 |
|||
* @param {number} duration 持续时间: 默认不关闭(单位:秒) |
|||
* @param {string} btnAText 按钮1 名称 |
|||
* @param {string} btnBText 按钮2 名称 |
|||
* @param {Event} btnAEvent 按钮1 事件 |
|||
* @param {Event} btnBEvent 按钮2 事件 |
|||
*/ |
|||
export default function popup( |
|||
title = "标题", |
|||
content: VNode[] | string = "请输入内容", |
|||
id = "", |
|||
duration = 0, |
|||
btnAText = "", btnBText = "", |
|||
btnAEvent = () => {/* do nothing.*/ }, |
|||
btnBEvent = () => {/* do nothing.*/ } |
|||
): void { |
|||
const key = id === "" ? `id-${Date.now()}` : id; |
|||
notification.open({ |
|||
key, |
|||
duration: duration, |
|||
message: h( |
|||
"h2", |
|||
{ |
|||
style: { color: "#fff", |
|||
textAlign: "center" |
|||
}, |
|||
}, |
|||
title |
|||
), |
|||
description: h( |
|||
"div", |
|||
{ |
|||
style: { color: "#fff" }, |
|||
}, |
|||
content |
|||
), |
|||
placement: 'topLeft', |
|||
style: { |
|||
width: "540px", |
|||
// height: "600px",
|
|||
// marginLeft: `-200px`,
|
|||
/**right导致页面重排,不流畅,但目前mac和Windows通过效果 |
|||
*/ |
|||
top: "50%", |
|||
left: `50%`, |
|||
transform: 'translate(-50%,-50%)', |
|||
backgroundColor: "rgba(0 ,64 ,64 , 0.8)", |
|||
userSelect: "none", |
|||
//boxShadow: "inset 0 0 15px 4px #56ffff",
|
|||
// boxShadow: "inset 0 0 4px 2px #56ffff",
|
|||
borderRadius:"5px", |
|||
border:"2px solid #56ffff88", |
|||
color: "white", |
|||
position: 'fixed', |
|||
}, |
|||
btn: h("div", null, [ |
|||
btnAText == "" ? null : h( |
|||
Button, |
|||
{ |
|||
type: "primary", |
|||
size: "small", |
|||
danger: true, |
|||
onClick: btnAEvent, |
|||
}, |
|||
btnAText |
|||
), |
|||
btnBText == "" ? null : h( |
|||
Button, |
|||
{ |
|||
type: "primary", |
|||
size: "small", |
|||
style: { |
|||
marginLeft: "7px", |
|||
}, |
|||
danger: true, |
|||
onClick: btnBEvent, |
|||
}, |
|||
btnBText |
|||
), |
|||
]), |
|||
closeIcon: h(CloseSquareTwoTone, { |
|||
style: { |
|||
display:"none" |
|||
}, |
|||
}) , |
|||
onClose: () => { |
|||
notification.close(key); |
|||
}, |
|||
}); |
|||
} |
@ -0,0 +1,82 @@ |
|||
<template> |
|||
<div class="buttomList"> |
|||
<div class="buttomItem"> |
|||
<div class="buttomName">标签标志</div> |
|||
</div> |
|||
<div class="buttomItem"> |
|||
<div class="buttomName">截图</div> |
|||
</div> |
|||
<div class="buttomItem"> |
|||
<div class="buttomName">录像</div> |
|||
</div> |
|||
<div class="buttomItem"> |
|||
<div class="buttomName">3D缩放</div> |
|||
</div> |
|||
<div class="buttomItem"> |
|||
<div class="buttomName">设备标记</div> |
|||
</div> |
|||
<div class="buttomItem"> |
|||
<div class="buttomName">工具箱</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script setup lang='ts'> |
|||
|
|||
</script> |
|||
|
|||
<style scoped lang='less'> |
|||
.buttomList { |
|||
position: absolute; |
|||
right: 1%; |
|||
top: 15%; |
|||
width: 80px; |
|||
} |
|||
|
|||
@keyframes rounte { |
|||
from { |
|||
transform: rotate(0deg); |
|||
} |
|||
|
|||
to { |
|||
transform: rotate(360deg); |
|||
} |
|||
} |
|||
|
|||
.buttomItem { |
|||
position: relative; |
|||
width: 80px; |
|||
height: 80px; |
|||
} |
|||
|
|||
.buttomItem::before { |
|||
content: ''; |
|||
background: url(@/assets/images/buttonBG01.png); |
|||
background-size: 100% 100%; |
|||
position: absolute; |
|||
animation: rounte 5s linear infinite; |
|||
top: 5%; |
|||
bottom: 5%; |
|||
left: 5%; |
|||
right: 5%; |
|||
z-index: 1; |
|||
} |
|||
|
|||
.buttomItem:hover::before { |
|||
background: url(@/assets/images/buttonBG02.png); |
|||
background-size: 100% 100%; |
|||
} |
|||
|
|||
.buttomName { |
|||
position: absolute; |
|||
top: 50%; |
|||
left: 50%; |
|||
transform: translate(-50%, -50%); |
|||
text-align: center; |
|||
color: #fff; |
|||
line-height: 3vw; |
|||
width: 100%; |
|||
z-index: 2; |
|||
font-size: 0.8em; |
|||
} |
|||
</style> |
Loading…
Reference in new issue