From e86221272a0d6d474181206cf26b90e63a8bde35 Mon Sep 17 00:00:00 2001 From: wuyiping0628 <1106773985@qq.com> Date: Wed, 11 Mar 2026 18:31:14 -0700 Subject: [PATCH 1/2] feat: except for the TinyRobot page, other pages have hidden playground buttons --- .vitepress/theme/index.ts | 7 ++++++- .vitepress/theme/style.css | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.vitepress/theme/index.ts b/.vitepress/theme/index.ts index f33951d..4251f24 100644 --- a/.vitepress/theme/index.ts +++ b/.vitepress/theme/index.ts @@ -43,7 +43,7 @@ export default { }, Layout, setup() { - // 为img元素添加点击放大功能 + // 为img元素添加点击放大功能并根据路由隐藏 playground 图标 const route = useRoute(); let zomm: any = null; watch( @@ -54,6 +54,11 @@ export default { } if (typeof window !== 'undefined'){ zomm = mediumZoom('.main img', {background: 'var(--vp-c-bg)'}) + if (route.path.includes('tiny-robot')) { + document.body.classList.remove('hide-code-playground'); + } else { + document.body.classList.add('hide-code-playground'); + } } }), {immediate: true} diff --git a/.vitepress/theme/style.css b/.vitepress/theme/style.css index 4b70b73..c219ed2 100644 --- a/.vitepress/theme/style.css +++ b/.vitepress/theme/style.css @@ -177,6 +177,11 @@ body, .VPContent { padding-top: 0 !important; } + +/* 隐藏代码 playground 图标,在除了 tiny-robot 路由下启用 */ +body.hide-code-playground .lucide.lucide-play-icon.lucide-play { + display: none !important; +} .VPHome .container { max-width: 92rem; } From ab6f11d638ac2fa01bbd5edb2bfc53f335082bc8 Mon Sep 17 00:00:00 2001 From: wuyiping0628 <1106773985@qq.com> Date: Wed, 11 Mar 2026 18:55:57 -0700 Subject: [PATCH 2/2] feat: add ts type to Zoom --- .vitepress/theme/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.vitepress/theme/index.ts b/.vitepress/theme/index.ts index 4251f24..a026131 100644 --- a/.vitepress/theme/index.ts +++ b/.vitepress/theme/index.ts @@ -9,7 +9,7 @@ import MermaidBlock from './components/MermaidBlock.vue' import '@opentiny/tiny-robot-style' import {nextTick, watch} from 'vue'; import {useRoute} from 'vitepress'; -import mediumZoom from 'medium-zoom'; +import mediumZoom, { Zoom } from 'medium-zoom'; import { insertFurion } from './insert-furion' // 引入样式文件 import './medium-zoom.css'; @@ -45,15 +45,15 @@ export default { setup() { // 为img元素添加点击放大功能并根据路由隐藏 playground 图标 const route = useRoute(); - let zomm: any = null; + let zoom: Zoom | null = null; watch( () => route.path, () => nextTick(() => { - if (zomm) { - zomm.detach(); + if (zoom) { + zoom.detach(); } if (typeof window !== 'undefined'){ - zomm = mediumZoom('.main img', {background: 'var(--vp-c-bg)'}) + zoom = mediumZoom('.main img', {background: 'var(--vp-c-bg)'}) if (route.path.includes('tiny-robot')) { document.body.classList.remove('hide-code-playground'); } else {