|
@@ -12,7 +12,7 @@
|
|
|
:key="index"
|
|
|
:class="{
|
|
|
'menu-item': true,
|
|
|
- active: selectMenu == item.path,
|
|
|
+ active: selectMenu == item.path
|
|
|
}"
|
|
|
>
|
|
|
<span
|
|
@@ -30,6 +30,7 @@
|
|
|
<script setup>
|
|
|
// import header_local from './components/header.vue';
|
|
|
import { ref } from 'vue';
|
|
|
+import { ElMessage } from 'element-plus';
|
|
|
import { useRoute, useRouter } from 'vue-router';
|
|
|
|
|
|
const Router = useRouter();
|
|
@@ -52,9 +53,43 @@ const selectMenuFunc = item => {
|
|
|
document.title = item.title;
|
|
|
Router.push({
|
|
|
path: item.path,
|
|
|
- query: {},
|
|
|
+ query: {}
|
|
|
});
|
|
|
};
|
|
|
+
|
|
|
+/**
|
|
|
+ * @description: 通知权限
|
|
|
+ * 1 如果用户已经同意授权,返回值为granted;
|
|
|
+ * 2 如果用户已经拒绝授权,返回值为denied;
|
|
|
+ * 3 如果用户还没有作出选择,返回值为default;
|
|
|
+ */
|
|
|
+function notificationFunc() {
|
|
|
+ if (!Notification) return;
|
|
|
+ if (Notification.permission == 'denied') return;
|
|
|
+ if (Notification.permission === 'default') Notification.requestPermission();
|
|
|
+
|
|
|
+ const permission = {
|
|
|
+ denied: '拒绝授权',
|
|
|
+ granted: '同意授权',
|
|
|
+ default: '不明授权'
|
|
|
+ };
|
|
|
+
|
|
|
+ console.log(permission[Notification.permission]);
|
|
|
+
|
|
|
+ // if (Notification.permission === 'granted') {
|
|
|
+ // // 如果用户允许系统提醒,则创建一个通知
|
|
|
+ // var notification = new Notification('这是一个系统提醒', {
|
|
|
+ // body: '这是提醒的正文内容',
|
|
|
+ // icon: 'path/to/icon.png' // 可选的图标路径
|
|
|
+ // });
|
|
|
+
|
|
|
+ // // 可以在通知被点击时执行一些操作
|
|
|
+ // notification.onclick = function () {
|
|
|
+ // console.log('用户点击了系统提醒');
|
|
|
+ // };
|
|
|
+ // }
|
|
|
+}
|
|
|
+notificationFunc();
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|