Skip to content

Commit a5b5dcf

Browse files
Merge pull request #4 from OnlyOnexl/one-demo-plus
运行后自动打开网页 & 回到顶部提示
2 parents 2d2af47 + 522b2e7 commit a5b5dcf

File tree

2 files changed

+17
-1
lines changed
  • demo/docs-base/.vitepress
  • vitepress-theme-teek/src/components/RightBottomButton/src

2 files changed

+17
-1
lines changed

demo/docs-base/.vitepress/config.mts

+7
Original file line numberDiff line numberDiff line change
@@ -232,4 +232,11 @@ export default defineConfig({
232232
pattern: "https://github.com/Kele-Bingtang/hd-security/edit/master/hd-security-docs/docs/:path",
233233
},
234234
},
235+
236+
// 运行后自动打开网页
237+
vite: {
238+
server: {
239+
open: true
240+
},
241+
},
235242
});

vitepress-theme-teek/src/components/RightBottomButton/src/index.vue

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<script setup lang="ts" name="RightBottomButton">
2+
import { ElMessage } from 'element-plus'; // 引入消息提示功能
3+
import 'element-plus/es/components/message/style/css';
24
import { computed, ref, unref, onMounted, onUnmounted } from "vue";
35
import { MagicStick, ChatDotSquare } from "@element-plus/icons-vue";
46
import { useNamespace, useDebounce } from "../../../hooks";
@@ -27,7 +29,14 @@ const showToComment = computed(() => {
2729
});
2830
2931
const scrollToTop = useDebounce(() => {
30-
scrollTo("html", 0, 1500);
32+
scrollTo("html", 0, 1500, () => {
33+
// 添加Element Plus消息提示
34+
ElMessage({
35+
message: '已回到顶部',// 消息内容
36+
type: 'success', // 消息类型为成功
37+
duration: 3000 // 持续时间为3秒
38+
});
39+
});
3140
scrollTop.value = 0;
3241
}, 500);
3342

0 commit comments

Comments
 (0)