00:00:00
切换为默认博客风
当前默认风格为文档风
docs\.vitepress\theme\components\ConfigSwitch.vue
文件
docs\.vitepress\theme\components\TeekLayoutProvider.vue
文件:
在无痕浏览器打开,可以看到默认是文档风格的:
切换Teek为默认博客风格
之前默认是文档风格,这里修改默认为博客风格。
环境
测试环境:
Teek@1.5.0-2025.9.23
自己的开源库《vitepress-theme-teek-one》 --(克隆自 作者Teeker的文档风开源库《vitepress-theme-teek-docs-template》)
2025年9月24日测试
配置
(1)编辑docs\.vitepress\theme\components\TeekLayoutProvider.vue
文件:
注释掉docs风格,添加如下代码:
ts
// 默认文档风
// import { teekDocConfig } from "../config/teekConfig";
// 默认博客风
import { teekBlogCardConfig } from "../config/teekConfig";
// 默认文档风
// const currentStyle = ref("doc");
// const teekConfig = ref(teekDocConfig);
// 默认博客风
const currentStyle = ref("blog-card");
const teekConfig = ref(teekBlogCardConfig);
(2)编辑docs\.vitepress\theme\components\ConfigSwitch.vue
文件:
注释博客风格,去掉docs风格注释
ts
// 默认文档风格
// const themeStyle = defineModel({ default: "doc" });
// const currentStyle = useStorage("tk:configStyle", "doc");
// 默认博客风格
const themeStyle = defineModel({ default: "blog-card" });
const currentStyle = useStorage("tk:configStyle", "blog-card");
const teekConfig = ref(teekDocConfig);
验证:在无痕浏览器打开,可以看到默认是博客风格的:
结束。