@peng_kai/kit 0.3.0-beta.37 → 0.3.0-beta.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  import { useEventListener, useIntervalFn } from '@vueuse/core';
3
3
  import { Empty, Dropdown, Badge, Menu, MenuItem } from 'ant-design-vue';
4
4
  import { type UseQueryReturnType } from '@tanstack/vue-query'
5
- import { watch, ref, computed } from 'vue'
5
+ import { watch, ref, computed, customRef } from 'vue'
6
6
  import dayjs from '../../../libs/dayjs';
7
7
  import { useRouter } from 'vue-router';
8
8
  import audioURL from './y682.mp3?url';
@@ -12,6 +12,14 @@ noticeAudio.muted = true;
12
12
  noticeAudio.src = audioURL;
13
13
  document.body.append(noticeAudio);
14
14
 
15
+ export const audioMuted = customRef<boolean>((tracker) => ({
16
+ get: () => noticeAudio.muted,
17
+ set: (val) => {
18
+ noticeAudio.muted = val;
19
+ tracker();
20
+ }
21
+ }));
22
+
15
23
  const faviconEle = document.querySelector('link[rel="icon"]');
16
24
  const logoFaviconHref = document.querySelector('link[rel="icon"]')?.getAttribute('href')!;
17
25
  const numCanvas = document.createElement('canvas') as (HTMLCanvasElement & { num: number, dataURL: string });
@@ -52,7 +60,8 @@ function operate(notice: TNotice) {
52
60
  // num > oldNum && noticeAudio.play();
53
61
  // }, { immediate: true });
54
62
  useEventListener(document, 'click', () => {
55
- noticeAudio.muted = false;
63
+ // noticeAudio.muted = false;
64
+ audioMuted.value = false;
56
65
  });
57
66
 
58
67
  useIntervalFn(() => {
@@ -100,7 +109,8 @@ useIntervalFn(() => {
100
109
  <i class="i-ri:notification-4-line block text-5" :class="{ shake: !!noticeNum }" />
101
110
  </div>
102
111
  <template #overlay>
103
- <Menu v-if="noticeNum" @click="visible = false" class="max-h-100 overflow-y-auto">
112
+ <div v-if="noticeNum">
113
+ <Menu @click="visible = false" class="max-h-100 overflow-y-auto">
104
114
  <MenuItem v-for="(item, i) of noticeList" :key="i" @click="operate(item)">
105
115
  <div class="min-w-50">
106
116
  <div>{{ item.title }}</div>
@@ -110,6 +120,9 @@ useIntervalFn(() => {
110
120
  </div>
111
121
  </MenuItem>
112
122
  </Menu>
123
+ 123
124
+ </div>
125
+
113
126
  <div v-else class="h-40 min-w-50 flex items-center justify-center rounded-2 bg-$antd-colorBgElevated shadow"
114
127
  @click="visible = false">
115
128
  <Empty description="暂无通知" :image="Empty.PRESENTED_IMAGE_SIMPLE" />
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@peng_kai/kit",
3
3
  "type": "module",
4
- "version": "0.3.0-beta.37",
4
+ "version": "0.3.0-beta.38",
5
5
  "description": "",
6
6
  "author": "",
7
7
  "license": "ISC",