diff --git a/src/pages/News.vue b/src/pages/News.vue index 7f9acd3a..178a60b9 100644 --- a/src/pages/News.vue +++ b/src/pages/News.vue @@ -13,7 +13,7 @@ class="justify-space-between flex-nowrap" width="320" > - + {{ item.title }} - + {{ item.title }} -
暂无新闻
-
+
暂无公告
+
- - + {{ item.title }} { + img.style.width = "75%"; + }); // 将 html 转为能够通过 window.open 打开的 url const postUrl = URL.createObjectURL( new Blob([postHtml.documentElement.outerHTML], { type: "text/html;charset=utf-8" }) ); - // 调用 tauri 打开无边框窗口 - window.open( - postUrl, - "_blank", - "height=720, width=960, toolbar=no, menubar=no, scrollbars=no,status=no" - ); + // 打开新窗口,窗口位置居中 + // 获取窗口宽度 + const width = window.screen.width; + // 获取窗口高度 + const height = window.screen.height; + // 计算窗口位置 + const left = width / 2 - 480; + const top = height / 2 - 360; + // 打开窗口 + window.open(postUrl, "_blank", `width=960,height=720,left=${left},top=${top}`); }, getPost(post_id: number) { const postUrl = `https://bbs-api.mihoyo.com/post/wapi/getPostFull?gids=2&post_id=${post_id}`; @@ -178,7 +186,6 @@ export default defineComponent({