♻️ 简化代码

This commit is contained in:
BTMuli
2023-10-14 14:34:32 +08:00
parent 358255d50a
commit 58e3c0e1a6
4 changed files with 112 additions and 295 deletions

View File

@@ -52,8 +52,9 @@ import { ref, onMounted, onUnmounted } from "vue";
import { useRouter } from "vue-router";
import Mys from "../../plugins/Mys";
import { useAppStore } from "../../store/modules/app";
import { useHomeStore } from "../../store/modules/home";
import { createTGWindow } from "../../utils/TGWindow";
import { createPost, createTGWindow } from "../../utils/TGWindow";
import { stamp2LastTime } from "../../utils/toolFunc";
// vue
@@ -176,13 +177,8 @@ async function toOuter(url: string, title: string): Promise<void> {
}
function toPost(pool: TGApp.Plugins.Mys.Gacha.RenderCard): void {
const path = router.resolve({
name: "帖子详情",
params: {
post_id: pool.postId.toString(),
},
}).href;
createTGWindow(path, "Sub_window", `Post_${pool.postId} ${pool.title}`, 960, 720, false, false);
const isDev = useAppStore().devMode;
createPost(pool.postId.toString(), isDev);
}
onUnmounted(() => {

View File

@@ -48,7 +48,8 @@ import { ref, onMounted, onUnmounted } from "vue";
import { useRouter } from "vue-router";
import Mys from "../../plugins/Mys";
import { createTGWindow } from "../../utils/TGWindow";
import { useAppStore } from "../../store/modules/app";
import { createPost } from "../../utils/TGWindow";
import { stamp2LastTime } from "../../utils/toolFunc";
// vue
@@ -105,16 +106,9 @@ onMounted(async () => {
loading.value = false;
});
async function toPost(card: TGApp.Plugins.Mys.Position.RenderCard): Promise<void> {
// 获取路由路径
const path = router.resolve({
name: "帖子详情",
params: {
post_id: card.postId,
},
}).href;
// 打开新窗口
createTGWindow(path, "Sub_window", `Post_${card.postId} ${card.title}`, 960, 720, false, false);
function toPost(card: TGApp.Plugins.Mys.Position.RenderCard): void {
const isDev = useAppStore().devMode;
createPost(card.postId.toString(), isDev);
}
onUnmounted(() => {