Skip to content

Commit

Permalink
开发模式下不显示评论
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhongjia committed Jan 9, 2024
1 parent 130e783 commit c45c3f3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
7 changes: 5 additions & 2 deletions learn/.vitepress/theme/giscus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import { defineComponent, h } from "vue";
import { useData, useRoute } from "vitepress";
import Giscus from "@giscus/vue";

const is_dev = import.meta.env.MODE === 'development';

export default defineComponent({
setup() {
const route = useRoute();
const { isDark } = useData();

return () =>
return () =>is_dev? h("div"):
h(
"div",
{
Expand All @@ -30,6 +32,7 @@ export default defineComponent({
lang: "zh-CN",
term: route.path,
}),
);
)
;
},
});
10 changes: 10 additions & 0 deletions types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export {}
declare global {
interface ImportMeta {
env: {
NODE_ENV: "development" | "production";
MODE: "development" | "production";
// ...其他环境变量
};
}
}

0 comments on commit c45c3f3

Please sign in to comment.