|
|
@@ -54,7 +54,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 底部图标 -->
|
|
|
- <div class="bottom-panel" @dblclick="openTopPanel" v-if="!ifShowTop">
|
|
|
+ <div class="bottom-panel" @click="openTopPanel" v-if="!ifShowTop">
|
|
|
<div class="icon"></div>
|
|
|
<div class="msg-num">{{ totalTipsNum }}</div>
|
|
|
</div>
|
|
|
@@ -203,6 +203,8 @@ export default defineComponent({
|
|
|
return totalNum <= 99 ? totalNum === 0 ? '' : totalNum : `10+`
|
|
|
})
|
|
|
|
|
|
+ const ifMove = ref(false)
|
|
|
+
|
|
|
const dragEvent = (e) => {
|
|
|
// tipsDomRef.value.stopPropagation()
|
|
|
//算出鼠标相对元素的位置
|
|
|
@@ -216,6 +218,7 @@ export default defineComponent({
|
|
|
let parentH = window.innerHeight;//父盒子的height
|
|
|
|
|
|
let move = function (move) {
|
|
|
+ ifMove.value = true;
|
|
|
//用鼠标的位置减去鼠标相对元素的位置,得到元素的位置
|
|
|
let left = move.clientX - disX;
|
|
|
let top = move.clientY - disY;
|
|
|
@@ -228,15 +231,19 @@ export default defineComponent({
|
|
|
tipsDomRef.value.style.top = top + "px";
|
|
|
}
|
|
|
|
|
|
- tipsDomRef.value.addEventListener('mousemove', move)
|
|
|
+ document.addEventListener('mousemove', move)
|
|
|
|
|
|
- tipsDomRef.value.addEventListener('mouseup', (e) => {
|
|
|
+ document.addEventListener('mouseup', (e) => {
|
|
|
//鼠标弹起来的时候不再移动
|
|
|
- tipsDomRef.value.removeEventListener('mousemove', move)
|
|
|
+ document.removeEventListener('mousemove', move)
|
|
|
})
|
|
|
}
|
|
|
|
|
|
const openTopPanel = (e) => {
|
|
|
+ if(ifMove.value){
|
|
|
+ ifMove.value = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
ifShowTop.value = !ifShowTop.value
|
|
|
// let disX = e.clientX - tipsDomRef.value.offsetLeft;
|
|
|
// let disY = e.clientY - tipsDomRef.value.offsetTop;
|