Skip to content

Commit

Permalink
📃 docs: 文档更新
Browse files Browse the repository at this point in the history
  • Loading branch information
白云苍狗 committed Nov 6, 2023
1 parent b4bc31c commit ca4de97
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
33 changes: 33 additions & 0 deletions docs/guide/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,31 @@ interface ConverConfig {
}
```

### 过期提醒 NoticeOutdate

通过配置 `noticeOutdate` 字段使用,`enable``true` 时,会根据文章发布时间计算已经过去多少天,如果超出 `limitDay` 配置天数,则会显示过期提醒标识

```ts
interface NoticeOutdateConfig {
/**
* 是否启用
*/
enable?: boolean;
/**
* 样式
*/
style?: "simple" | "flat";
/**
* 距离今天多少天时显示
*/
limitDay?: number;
/**
* 现实在文章中位置
*/
position?: "top" | "bottom";
}
```

## 友接页 Links

在 layout 为 `links` 时为友链页,页面会根据 `links` 配置渲染列表。
Expand Down Expand Up @@ -601,6 +626,14 @@ interface BuiltPageConfig {

具体插槽 [请看这里](https://github.com/maluns/vitepress-theme-async/packages/vitepress-theme-async/layouts/Layout.vue)

## 全局组件 Global Components

主题中将页面中部分模块拆分单独的组件,位于 `vitepress-theme-async/components/global` 目录中。可通过 `globalComponents` 字段配置是否需要将组件注册为全局组件使用,设置为 `true` 默认会将所有组件注册为全局组件,也可一传递组件名称 `['TrmDividerTitle']` 选择性的注册。

```ts
globalComponents?: boolean | Array<string>;
```

## 自定义图标 Icon

主题内置图标是通过组件方式使用的,参考 vitepress 覆盖组件使用方式。
Expand Down
8 changes: 4 additions & 4 deletions packages/vitepress-theme-async/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,11 @@ export const defineConfig = config => {
}

// 处理 less 配置
config.vite.css.preprocessorOptions.less.globalVars.isReadmode = Boolean(config.themeConfig.rightside.readmode);
config.vite.css.preprocessorOptions.less.globalVars.isAside = Boolean(config.themeConfig.rightside.aside);
config.vite.css.preprocessorOptions.less.globalVars.isReward = Boolean(config.themeConfig.reward.enable);
config.vite.css.preprocessorOptions.less.globalVars.isReadmode = Boolean(config.themeConfig?.rightside?.readmode);
config.vite.css.preprocessorOptions.less.globalVars.isAside = Boolean(config.themeConfig?.rightside?.aside);
config.vite.css.preprocessorOptions.less.globalVars.isReward = Boolean(config.themeConfig?.reward?.enable);
config.vite.css.preprocessorOptions.less.globalVars.isSearch = Boolean(config.themeConfig?.search?.provider === 'local');
config.vite.css.preprocessorOptions.less.globalVars.isCustomMdStyle = Boolean(config.themeConfig.customMdStyle);
config.vite.css.preprocessorOptions.less.globalVars.isCustomMdStyle = Boolean(config.themeConfig?.customMdStyle);

return config;
};
Expand Down

0 comments on commit ca4de97

Please sign in to comment.