Skip to content

Commit 4ea1e39

Browse files
committed
🐞 fix: 修复 appearance 设置 force 按钮显示问题 #14
1 parent 0305bd5 commit 4ea1e39

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/vitepress-theme-async/components/TrmFixedBtn.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const offset = ref(false);
2020
const ratio = ref(0);
2121
const isRead = ref(false);
2222
const isPost = useIsPost();
23-
const { theme, frontmatter, isDark } = useData<AsyncThemeConfig>();
23+
const { theme, frontmatter, isDark, site } = useData<AsyncThemeConfig>();
2424
2525
const scrollFun = () => {
2626
const scrollTop = getScrollTop();
@@ -89,7 +89,15 @@ const themePrimary = computed(() => {
8989
</template>
9090
<TrmIconTheme />
9191
</TrmPopover>
92-
<div class="trm-fixed-btn" :data-title="$t(isDark ? 'rightside.theme.light' : 'rightside.theme.dark')" @click="onSwitchThemeMode">
92+
<div
93+
v-if="
94+
site.appearance &&
95+
site.appearance !== 'force-dark' &&
96+
site.appearance !== 'force-auto'"
97+
class="trm-fixed-btn"
98+
:data-title="$t(isDark ? 'rightside.theme.light' : 'rightside.theme.dark')"
99+
@click="onSwitchThemeMode"
100+
>
93101
<TrmIconSun class="trm-dark-icon" />
94102
<TrmIconMoon class="trm-light-icon" />
95103
</div>

0 commit comments

Comments
 (0)