1
0
mirror of https://github.com/sendevia/website.git synced 2026-03-08 08:44:15 +08:00

16 Commits

Author SHA1 Message Date
c5628d1661 chore(package): update to version 26.3.8.332 2026-03-08 00:45:23 +08:00
8795c219ac feat: add rewrite rule for posts index and move main index to posts 2026-03-08 00:45:09 +08:00
c856ce009d article: fix date timezone formatting 2026-03-08 00:41:14 +08:00
b87a0d2918 feat(ArticleMasonry): add preset category prop and dynamic tag filtering 2026-03-08 00:31:08 +08:00
b4c6347538 fix(AppBar): search bar displacement when scrolling on desktop 2026-03-07 22:42:35 +08:00
3b17ade7f7 chore: update version format 2026-03-07 22:31:45 +08:00
b81d7fd415 feat(Header): adjust header gradient mask 2026-03-06 16:56:40 +08:00
206cf373a3 fix(ci): move platforms to docker build and push step 2026-03-06 00:09:25 +08:00
9677ac1367 feat(ci): disable build cache 2026-03-05 23:30:50 +08:00
b41cea0bed chore(package): update to version 26.3.5(323) 2026-03-05 23:19:08 +08:00
8345515977 fix(ci): remove buildkitd-flags 2026-03-05 23:14:32 +08:00
dd069771a8 feat(ci): add multi-platform support and buildkit flags to docker workflow 2026-03-05 23:12:00 +08:00
e4217512aa feat(NavBar): wrap components in ClientOnly 2026-03-05 23:11:36 +08:00
93a42ec037 feat: switch from nginx to caddy for static site hosting 2026-03-05 22:53:31 +08:00
d489bf24c4 feat: add Caddyfile 2026-03-05 22:53:08 +08:00
67a26def4f feat(Article): wrap post info in ClientOnly 2026-03-05 22:28:21 +08:00
19 changed files with 309 additions and 265 deletions

View File

@@ -61,5 +61,5 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
no-cache: true
platforms: linux/amd64,linux/arm64

View File

@@ -17,6 +17,9 @@ import { anchor } from "./theme/utils/mdCustomAnchor";
export default defineConfig({
base: "/",
cleanUrls: true,
rewrites: {
"posts/index.md": "index.md",
},
lang: "zh_CN",
title: "sendevia 的小站",
titleTemplate: ":title",

View File

@@ -7,6 +7,15 @@ import { useGlobalData } from "../composables/useGlobalData";
const postsStore = usePostStore();
const { theme } = useGlobalData();
interface Props {
/** 预设分类筛选 */
presetCategory?: string;
}
const props = withDefaults(defineProps<Props>(), {
presetCategory: "",
});
/** 设置面板是否打开 */
const isSettingsOpen = ref(false);
/** 设置面板的 DOM 引用 */
@@ -14,7 +23,7 @@ const settingsPanelRef = ref<HTMLElement | null>(null);
/** 触发按钮的 DOM 引用 */
const settingsTriggerRef = ref<HTMLElement | null>(null);
/** 选中的分类(单选,空字符串代表全部) */
const selectedCategory = ref("");
const selectedCategory = ref(props.presetCategory);
/** 选中的标签(多选,空数组代表全部) */
const selectedTags = ref<string[]>([]);
/** 排序字段: `date` | `title` */
@@ -81,7 +90,7 @@ const columnCount = computed(() => {
/**
* 获取仅经过筛选(未排序)的文章列表
* 逻辑:筛选分类和标签
* 筛选分类和标签
*/
const filteredRawList = computed(() => {
let posts = [...(postsStore.posts || [])];
@@ -101,9 +110,36 @@ const filteredRawList = computed(() => {
return posts;
});
/**
* 获取当前分类下的文章标签
* 如果当前有选中的分类,则只返回该分类下的文章所出现的标签
*/
const currentCategoryTags = computed(() => {
if (!selectedCategory.value) {
return postsStore.allTags;
}
const tagSet = new Set<string>();
postsStore.posts.forEach((post) => {
if (post.categories.includes(selectedCategory.value)) {
post.tags.forEach((tag) => tagSet.add(tag));
}
});
return Array.from(tagSet);
});
/**
* 判断是否有预设分类
* 如果有预设分类则分类section应该隐藏
*/
const hasPresetCategory = computed(() => {
return props.presetCategory !== "";
});
/**
* 对筛选后的列表进行排序
* 逻辑:根据 sortField 和 sortOrder 排序
* 根据 sortField 和 sortOrder 排序
*/
const sortedArticlesList = useSorted(filteredRawList, (a, b) => {
let comparison = 0;
@@ -310,7 +346,7 @@ const clearTags = () => {
</div>
</div>
<div class="section">
<div v-if="!hasPresetCategory" class="section">
<div class="section-header">
<h6>分类 <span v-if="selectedCategory" @click="selectedCategory = ''">clear</span></h6>
</div>
@@ -333,7 +369,7 @@ const clearTags = () => {
</div>
<div class="chip-container">
<MaterialChip
v-for="tag in postsStore.allTags"
v-for="tag in currentCategoryTags"
:key="tag"
:color="selectedTags.includes(tag) ? 'tonal' : 'outlined'"
:icon="selectedTags.includes(tag) ? 'check' : ''"

View File

@@ -174,7 +174,9 @@ if (isClient()) {
<template>
<nav class="NavBar" :class="navClass">
<div class="fab-container">
<MaterialButton color="text" :icon="navStateStore.isNavExpanded ? 'menu_open' : 'menu'" @click="toggleNav" />
<ClientOnly>
<MaterialButton color="text" :icon="navStateStore.isNavExpanded ? 'menu_open' : 'menu'" @click="toggleNav" />
</ClientOnly>
<button class="fab" @mousedown.prevent @click.stop="toggleSearch">
<span>{{ searchStateStore.isSearchActive ? "close" : "search" }}</span>
<p :ref="(el) => setLabelRef(el, '.fab')">搜索</p>
@@ -202,15 +204,17 @@ if (isClient()) {
</div>
<div class="actions">
<MaterialButton
class="theme-btn"
size="m"
color="text"
:title="themeStateStore.currentLabel"
:icon="themeStateStore.currentIcon"
@click="toggleTheme"
>
</MaterialButton>
<ClientOnly>
<MaterialButton
class="theme-btn"
size="m"
color="text"
:title="themeStateStore.currentLabel"
:icon="themeStateStore.currentIcon"
@click="toggleTheme"
>
</MaterialButton>
</ClientOnly>
</div>
</nav>
</template>

View File

@@ -142,15 +142,15 @@ if (isClient()) {
<PrevNext />
</main>
<aside id="article-aside">
<div class="post-info">
<p v-if="frontmatter.description" class="description">{{ frontmatter.description }}</p>
<p v-if="formattedPublishDate" class="date-publish">发布于 {{ formattedPublishDate }}</p>
<ClientOnly>
<ClientOnly>
<div class="post-info">
<p v-if="frontmatter.description" class="description">{{ frontmatter.description }}</p>
<p v-if="formattedPublishDate" class="date-publish">发布于 {{ formattedPublishDate }}</p>
<p v-if="formattedLastUpdated" :title="lastUpdatedRawTime" class="date-update">
{{ formattedLastUpdated }}
</p>
</ClientOnly>
</div>
</div>
</ClientOnly>
<ButtonGroup v-if="frontmatter?.external_links" :links="frontmatter.external_links" size="m" layout="vertical" />
<PageIndicator />
</aside>

View File

@@ -233,6 +233,10 @@
transition: opacity var(--md-sys-motion-spring-fast-effect-duration) var(--md-sys-motion-spring-fast-effect);
}
}
&.hidden {
top: 0px;
}
}
&.scroll {
@@ -246,10 +250,8 @@
&.hidden {
top: -64px;
}
}
@media screen and (max-width: 840px) {
.AppBar {
@media screen and (max-width: 840px) {
top: 0;
width: 100%;

View File

@@ -125,7 +125,7 @@
&:nth-of-type(1) {
backdrop-filter: blur(10px);
filter: url(#noise-filter);
mask-image: linear-gradient(to right, black 0%, transparent 60%);
mask-image: linear-gradient(to right, black 0%, transparent 100%);
mix-blend-mode: screen;
z-index: 1;
}
@@ -133,12 +133,6 @@
&:nth-of-type(2) {
z-index: 0;
}
@media screen and (max-width: 840px) {
&:nth-of-type(1) {
mask-image: linear-gradient(to right, black 0%, transparent 100%);
}
}
}
}
@@ -350,10 +344,6 @@
}
img {
&:nth-of-type(1) {
transition: 5s var(--md-sys-motion-spring-slow-effect);
}
&:nth-of-type(2) {
transition: var(--md-sys-motion-spring-slow-effect-duration) var(--md-sys-motion-spring-default-effect)
var(--md-sys-motion-spring-fast-effect-duration);
@@ -380,11 +370,6 @@
}
img {
&:nth-of-type(1) {
opacity: 0;
transform: translateX(-25%);
}
&:nth-of-type(2) {
opacity: 0;
transform: scale(1.005);

37
Caddyfile Normal file
View File

@@ -0,0 +1,37 @@
:80 {
# 根目录指向构建产物
root * /app
# 关闭访问日志
log {
output discard
}
# 启用压缩
encode gzip zstd
# 文件服务器配置
try_files {path} {path}.html {path}/
file_server
# 错误页面处理
handle_errors {
@404 {
expression {http.error.status_code} == 404
}
@403 {
expression {http.error.status_code} == 403
}
rewrite @404 /404.html
rewrite @403 /404.html
file_server
}
# 静态资源缓存配置
@assets {
path /assets/*
}
header @assets {
Cache-Control "public, immutable, max-age=31536000"
}
}

View File

@@ -9,19 +9,19 @@ RUN apt-get update && apt-get install -y git \
WORKDIR /app
# 拉取项目代码
RUN git clone https://github.com/sendevia/website .
RUN git clone https://github.com/sendevia/website . --depth=1
# 安装依赖并构建
RUN npm i && npm run docs:build
# 最终阶段
FROM nginx:stable-perl
FROM caddy:alpine AS final
# 从构建阶段复制 dist 产物到 workdir
COPY --from=builder /app/.vitepress/dist /app/dist
# 从构建阶段复制 dist 产物到工作目录
COPY --from=builder /app/.vitepress/dist /app
# 暴露端口80 HTTP 和 443 HTTPS
EXPOSE 80 443
# 复制Caddyfile配置文件
COPY Caddyfile /etc/caddy/Caddyfile
# 启动 nginx
CMD ["nginx", "-g", "daemon off;"]
# 启动Caddy服务器
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile"]

View File

@@ -1,5 +1,5 @@
{
"version": "26.3.4(316)",
"version": "26.3.8.332",
"scripts": {
"update-version": "bash ./scripts/update-version.sh",
"docs:dev": "vitepress dev",

View File

@@ -2,7 +2,7 @@
title: "AincradMix"
description: "一个 osu! 皮肤"
color: "#8400db"
impression:
impression:
- /assets/images/22/s0_amix_vision.webp
- /assets/images/22/screenshot01.webp
categories:
@@ -12,7 +12,7 @@ tags:
- osu!
- 示例文章
- 作品介绍
date: 2022-07-04T04:00:00Z
date: 2022-07-04T04:00:00+08
external_links:
- type: download
label: 直连下载
@@ -29,7 +29,7 @@ external_links:
1. 本皮肤通过游戏补丁的方式,做到了覆盖几乎全部的 osu! 界面元素。
2. 结合更现代的设计,扩展了《刀剑神域》中出现的界面设计。
:::
:::
# 优点
@@ -46,6 +46,7 @@ external_links:
- 本皮肤所提供的 dll 文件仅替换了图像资源,未做其他修改。如果不放心,你可以使用 dnSpy 自行替换文件
[^1]: 通过修改 osu! 的资源 dll。
[^2]: 此为估计得出。
# 皮肤预览

View File

@@ -7,7 +7,7 @@ categories:
- 博客主题
tags:
- readme
date: 2026-02-25T21:44:00Z
date: 2026-02-25T21:44:00+08
external_links:
- type: download
icon: rocket_launch

View File

@@ -0,0 +1,144 @@
---
title: "Button group"
description: "按钮组组件"
color: "#42b883"
categories:
- 组件
tags:
- Vue 3
- 开发文档
- UI
date: 2026-02-25T21:20:00+08
---
# ButtonGroup 按钮组组件
`ButtonGroup` 是一个用于聚合多个 `MaterialButton` 的容器组件。它支持灵活的布局切换、统一的属性默认值配置以及全局事件委托监听。
## 核心特性
- **布局自适应**支持水平Horizontal和垂直Vertical两种排列方式。
- **属性继承与覆盖**:可以在组级别设置默认的尺寸、颜色、图标等,也可以在具体的按钮项中进行个性化覆盖。
- **智能类型识别**:内置了对 `download``normal` 类型的样式及图标自动匹配逻辑。
- **事件委托**:支持统一监听 `@click` 事件,便捷获取点击的项信息及索引。
## 组件属性 (Props)
| 属性名 | 类型 | 默认值 | 可选值 | 说明 |
| :---------- | :--------------- | :------------- | :---------------------------------- | :--------------- |
| `links` | `ExternalLink[]` | `[]` | - | 按钮配置数组 |
| `layout` | `string` | `"horizontal"` | `"horizontal"`, `"vertical"` | 布局方向 |
| `size` | `string` | `"s"` | `"xs"`, `"s"`, `"m"`, `"l"`, `"xl"` | 默认按钮尺寸 |
| `color` | `string` | - | - | 默认按钮颜色样式 |
| `icon` | `string` | - | - | 默认按钮图标 |
| `target` | `string` | - | - | 默认链接打开方式 |
| `ariaLabel` | `string` | - | - | 组的无障碍标签 |
## 组件事件 (Emits)
| 事件名 | 回调参数 | 说明 |
| :------- | :-------------------------------------------------- | :------------------------- |
| `@click` | `(event: Event, item: ExternalLink, index: number)` | 当组内任意按钮被点击时触发 |
## 按钮配置项 (ExternalLink)
每一项 `links` 中的对象支持以下配置:
| 属性名 | 类型 | 说明 |
| :---------- | :--------- | :------------------------------------------------------ |
| `label` | `string` | 按钮显示的文本内容 |
| `id` | `string` | (可选) 自定义标识符,方便在事件处理中识别 |
| `link` | `string` | (可选) 点击跳转的链接地址 |
| `type` | `string` | (可选) 预设类型:`download` (充满色), `normal` (色调色) |
| `icon` | `string` | (可选) 覆盖组设置的图标 |
| `color` | `string` | (可选) 覆盖组设置的颜色 |
| `size` | `string` | (可选) 覆盖组设置的尺寸 |
| `target` | `string` | (可选) 覆盖组设置的打开方式 |
| `ariaLabel` | `string` | (可选) 按钮的无障碍标签 |
| `onClick` | `Function` | (可选) 单体独立的点击回调函数 |
## 使用示例
### 1. 基础用法 (水平排列)
```vue
<ButtonGroup
:links="[
{ label: '查看详情', id: 'detail' },
{ label: '下载资源', id: 'download', type: 'download' },
]"
@click="(e, item) => console.log('点击了:', item.id)"
/>
```
<ButtonGroup
:links="[
{ label: '查看详情', id: 'detail' },
{ label: '下载资源', id: 'download', type: 'download' }
]"
@click="(e, item) => console.log('点击了:', item.id)"
/>
### 2. 垂直排列与尺寸控制
```vue
<ButtonGroup
layout="vertical"
size="l"
:links="[
{ label: '选项一', icon: 'settings' },
{ label: '选项二', icon: 'person' },
]"
/>
```
<ButtonGroup
layout="vertical"
size="l"
:links="[
{ label: '选项一', icon: 'settings' },
{ label: '选项二', icon: 'person' }
]"
/>
### 3. 混合图标与文本
```vue
<ButtonGroup
size="m"
:links="[
{ id: 'prev', icon: 'chevron_left', ariaLabel: '上一页' },
{ id: 'index', label: '1 / 5', color: 'tonal' },
{ id: 'next', icon: 'chevron_right', ariaLabel: '下一页' },
]"
/>
```
<ButtonGroup
size="m"
:links="[
{ id: 'prev', icon: 'chevron_left', ariaLabel: '上一页' },
{ id: 'index', label: '1 / 5', color: 'tonal' },
{ id: 'next', icon: 'chevron_right', ariaLabel: '下一页' }
]"
/>
### 4. 链接跳转
```vue
<ButtonGroup
target="_blank"
:links="[
{ label: 'GitHub', link: 'https://github.com', icon: 'code' },
{ label: '首页', link: '/', icon: 'home' },
]"
/>
```
<ButtonGroup
target="_blank"
:links="[
{ label: 'GitHub', link: 'https://github.com', icon: 'code' },
{ label: '首页', link: '/', icon: 'home' }
]"
/>

View File

@@ -8,7 +8,7 @@ tags:
- markdown 语法
- 示例文章
- 组件示例
date: 2007-08-31T00:00:00Z
date: 2007-08-31T00:00:00+08
---
# 语法高亮
@@ -99,14 +99,14 @@ MaterialButton 组件是一个通用的按钮组件,支持多种样式和功
#### 属性列表
| 属性 | 类型 | 默认值 | 可选值 | 描述 |
| ---- | ---- | ---- | ---- | ---- |
| `shape` | `string` | `"round"` | `"round"`, `"square"` | 按钮形状 |
| `size` | `string` | `"s"` | `"xs"`, `"s"`, `"m"`, `"l"`, `"xl"` | 按钮尺寸 |
| `color` | `string` | `"filled"` | `"elevated"`, `"filled"`, `"tonal"`, `"outlined"`, `"standard"`, `"text"` | 按钮颜色样式 |
| `icon` | `string` | - | Material Icons 名称 | 按钮图标 |
| `href` | `string` | - | 任意URL | 如果提供,按钮将渲染为链接 |
| `target` | `string` | `"_blank"` | `"_blank"`, `"_self"`, `"_parent"`, `"_top"` | 链接打开方式 |
| 属性 | 类型 | 默认值 | 可选值 | 描述 |
| -------- | -------- | ---------- | ------------------------------------------------------------------------- | -------------------------- |
| `shape` | `string` | `"round"` | `"round"`, `"square"` | 按钮形状 |
| `size` | `string` | `"s"` | `"xs"`, `"s"`, `"m"`, `"l"`, `"xl"` | 按钮尺寸 |
| `color` | `string` | `"filled"` | `"elevated"`, `"filled"`, `"tonal"`, `"outlined"`, `"standard"`, `"text"` | 按钮颜色样式 |
| `icon` | `string` | - | Material Icons 名称 | 按钮图标 |
| `href` | `string` | - | 任意URL | 如果提供,按钮将渲染为链接 |
| `target` | `string` | `"_blank"` | `"_blank"`, `"_self"`, `"_parent"`, `"_top"` | 链接打开方式 |
#### 使用示例
@@ -140,34 +140,30 @@ Card 组件用于展示内容卡片,支持多种变体和样式。
#### 属性列表
| 属性 | 类型 | 默认值 | 可选值 | 描述 |
| ---- | ---- | ---- | ---- | ---- |
| `variant` | `string` | `"feed"` | `"feed"` | 卡片变体 |
| `size` | `string` | `"m"` | `"s"`, `"m"`, `"l"` | 卡片尺寸 |
| `color` | `string` | `"filled"` | `"elevated"`, `"filled"`, `"outlined"` | 卡片颜色样式 |
| `title` | `string` | - | 任意字符串 | 卡片标题 |
| `description` | `string` | - | 任意字符串 | 卡片描述 |
| `date` | `string` | - | 日期字符串 | 发布日期 |
| `tags` | `string[]` | - | 字符串数组 | 标签列表 |
| `category` | `string[]` | - | 字符串数组 | 分类列表 |
| `impression` | `string[]` | `[]` | 图片URL数组 | 印象图片 |
| `href` | `string` | - | 任意URL | 卡片链接 |
| `downloadable` | `boolean` | `false` | `true`, `false` | 是否可下载 |
| 属性 | 类型 | 默认值 | 可选值 | 描述 |
| -------------- | ---------- | ---------- | -------------------------------------- | ------------ |
| `variant` | `string` | `"feed"` | `"feed"` | 卡片变体 |
| `size` | `string` | `"m"` | `"s"`, `"m"`, `"l"` | 卡片尺寸 |
| `color` | `string` | `"filled"` | `"elevated"`, `"filled"`, `"outlined"` | 卡片颜色样式 |
| `title` | `string` | - | 任意字符串 | 卡片标题 |
| `description` | `string` | - | 任意字符串 | 卡片描述 |
| `date` | `string` | - | 日期字符串 | 发布日期 |
| `tags` | `string[]` | - | 字符串数组 | 标签列表 |
| `category` | `string[]` | - | 字符串数组 | 分类列表 |
| `impression` | `string[]` | `[]` | 图片URL数组 | 印象图片 |
| `href` | `string` | - | 任意URL | 卡片链接 |
| `downloadable` | `boolean` | `false` | `true`, `false` | 是否可下载 |
#### 使用示例
```vue
<!-- 基础卡片 -->
<Card
title="文章标题"
description="这是一段文章描述,简要介绍文章内容。"
date="2023-10-01"
/>
<Card title="文章标题" description="这是一段文章描述,简要介绍文章内容。" date="2023-10-01" />
```
```vue
<!-- 带图片卡片 -->
<Card
<Card
title="项目展示"
description="展示一个有趣的项目"
impression="['/assets/images/project1.jpg', '/assets/images/project2.jpg']"
@@ -177,22 +173,12 @@ Card 组件用于展示内容卡片,支持多种变体和样式。
```vue
<!-- 可下载资源卡片 -->
<Card
title="资源下载"
description="包含可下载的文件资源"
downloadable
tags="['资源', '下载']"
category="['教程']"
/>
<Card title="资源下载" description="包含可下载的文件资源" downloadable tags="['资源', '下载']" category="['教程']" />
```
```vue
<!-- 不同样式卡片 -->
<Card
title="轮廓样式"
description="使用轮廓样式的卡片"
color="outlined"
/>
<Card title="轮廓样式" description="使用轮廓样式的卡片" color="outlined" />
```
### ButtonGroup 组件 (ButtonGroup.vue)
@@ -201,19 +187,19 @@ ButtonGroup 组件用于将多个按钮组合在一起,支持水平和垂直
#### 属性列表
| 属性 | 类型 | 默认值 | 可选值 | 描述 |
| ---- | ---- | ---- | ---- | ---- |
| `links` | `ExternalLink[]` | `[]` | 链接对象数组 | 按钮链接列表 |
| `size` | `string` | `"s"` | `"xs"`, `"s"`, `"m"`, `"l"`, `"xl"` | 按钮尺寸 |
| `layout` | `string` | `"horizontal"` | `"horizontal"`, `"vertical"` | 布局方向 |
| 属性 | 类型 | 默认值 | 可选值 | 描述 |
| -------- | ---------------- | -------------- | ----------------------------------- | ------------ |
| `links` | `ExternalLink[]` | `[]` | 链接对象数组 | 按钮链接列表 |
| `size` | `string` | `"s"` | `"xs"`, `"s"`, `"m"`, `"l"`, `"xl"` | 按钮尺寸 |
| `layout` | `string` | `"horizontal"` | `"horizontal"`, `"vertical"` | 布局方向 |
#### ExternalLink 类型
```typescript
interface ExternalLink {
type: string; // 链接类型:'download' 或 'normal'
label: string; // 按钮标签文本
link: string; // 链接地址
type: string; // 链接类型:'download' 或 'normal'
label: string; // 按钮标签文本
link: string; // 链接地址
}
```
@@ -225,7 +211,7 @@ interface ExternalLink {
:links="[
{ type: 'normal', label: '查看文档', link: '/docs' },
{ type: 'download', label: '下载资源', link: '/downloads/file.zip' },
{ type: 'normal', label: 'GitHub', link: 'https://github.com/example' }
{ type: 'normal', label: 'GitHub', link: 'https://github.com/example' },
]"
size="m"
layout="horizontal"
@@ -236,26 +222,16 @@ interface ExternalLink {
:links="[
{ type: 'normal', label: '选项一', link: '/option1' },
{ type: 'normal', label: '选项二', link: '/option2' },
{ type: 'normal', label: '选项三', link: '/option3' }
{ type: 'normal', label: '选项三', link: '/option3' },
]"
size="s"
layout="vertical"
/>
<!-- 不同尺寸按钮组 -->
<ButtonGroup
:links="[
{ type: 'download', label: '小尺寸下载', link: '/download' }
]"
size="xs"
/>
<ButtonGroup :links="[{ type: 'download', label: '小尺寸下载', link: '/download' }]" size="xs" />
<ButtonGroup
:links="[
{ type: 'normal', label: '大尺寸按钮', link: '/large' }
]"
size="xl"
/>
<ButtonGroup :links="[{ type: 'normal', label: '大尺寸按钮', link: '/large' }]" size="xl" />
```
# 更多信息

View File

@@ -5,7 +5,7 @@ color: "#39c5bb"
impression: "/assets/images/132307491_p0.webp"
categories:
tags:
date: 2007-08-31T00:00:00Z
date: 2007-08-31T00:00:00+08
---
这只是一篇示例文章。

View File

@@ -1,144 +0,0 @@
---
title: "Button group"
description: "按钮组组件"
color: "#42b883"
categories:
- 开发文档
tags:
- Vue 3
- 组件
- UI
date: 2026-02-25T21:20:00Z
---
# ButtonGroup 按钮组组件
`ButtonGroup` 是一个用于聚合多个 `MaterialButton` 的容器组件。它支持灵活的布局切换、统一的属性默认值配置以及全局事件委托监听。
## 核心特性
- **布局自适应**支持水平Horizontal和垂直Vertical两种排列方式。
- **属性继承与覆盖**:可以在组级别设置默认的尺寸、颜色、图标等,也可以在具体的按钮项中进行个性化覆盖。
- **智能类型识别**:内置了对 `download``normal` 类型的样式及图标自动匹配逻辑。
- **事件委托**:支持统一监听 `@click` 事件,便捷获取点击的项信息及索引。
## 组件属性 (Props)
| 属性名 | 类型 | 默认值 | 可选值 | 说明 |
| :--- | :--- | :--- | :--- | :--- |
| `links` | `ExternalLink[]` | `[]` | - | 按钮配置数组 |
| `layout` | `string` | `"horizontal"` | `"horizontal"`, `"vertical"` | 布局方向 |
| `size` | `string` | `"s"` | `"xs"`, `"s"`, `"m"`, `"l"`, `"xl"` | 默认按钮尺寸 |
| `color` | `string` | - | - | 默认按钮颜色样式 |
| `icon` | `string` | - | - | 默认按钮图标 |
| `target` | `string` | - | - | 默认链接打开方式 |
| `ariaLabel` | `string` | - | - | 组的无障碍标签 |
## 组件事件 (Emits)
| 事件名 | 回调参数 | 说明 |
| :--- | :--- | :--- |
| `@click` | `(event: Event, item: ExternalLink, index: number)` | 当组内任意按钮被点击时触发 |
## 按钮配置项 (ExternalLink)
每一项 `links` 中的对象支持以下配置:
| 属性名 | 类型 | 说明 |
| :--- | :--- | :--- |
| `label` | `string` | 按钮显示的文本内容 |
| `id` | `string` | (可选) 自定义标识符,方便在事件处理中识别 |
| `link` | `string` | (可选) 点击跳转的链接地址 |
| `type` | `string` | (可选) 预设类型:`download` (充满色), `normal` (色调色) |
| `icon` | `string` | (可选) 覆盖组设置的图标 |
| `color` | `string` | (可选) 覆盖组设置的颜色 |
| `size` | `string` | (可选) 覆盖组设置的尺寸 |
| `target` | `string` | (可选) 覆盖组设置的打开方式 |
| `ariaLabel` | `string` | (可选) 按钮的无障碍标签 |
| `onClick` | `Function` | (可选) 单体独立的点击回调函数 |
## 使用示例
### 1. 基础用法 (水平排列)
```vue
<ButtonGroup
:links="[
{ label: '查看详情', id: 'detail' },
{ label: '下载资源', id: 'download', type: 'download' }
]"
@click="(e, item) => console.log('点击了:', item.id)"
/>
```
<ButtonGroup
:links="[
{ label: '查看详情', id: 'detail' },
{ label: '下载资源', id: 'download', type: 'download' }
]"
@click="(e, item) => console.log('点击了:', item.id)"
/>
### 2. 垂直排列与尺寸控制
```vue
<ButtonGroup
layout="vertical"
size="l"
:links="[
{ label: '选项一', icon: 'settings' },
{ label: '选项二', icon: 'person' }
]"
/>
```
<ButtonGroup
layout="vertical"
size="l"
:links="[
{ label: '选项一', icon: 'settings' },
{ label: '选项二', icon: 'person' }
]"
/>
### 3. 混合图标与文本
```vue
<ButtonGroup
size="m"
:links="[
{ id: 'prev', icon: 'chevron_left', ariaLabel: '上一页' },
{ id: 'index', label: '1 / 5', color: 'tonal' },
{ id: 'next', icon: 'chevron_right', ariaLabel: '下一页' }
]"
/>
```
<ButtonGroup
size="m"
:links="[
{ id: 'prev', icon: 'chevron_left', ariaLabel: '上一页' },
{ id: 'index', label: '1 / 5', color: 'tonal' },
{ id: 'next', icon: 'chevron_right', ariaLabel: '下一页' }
]"
/>
### 4. 链接跳转
```vue
<ButtonGroup
target="_blank"
:links="[
{ label: 'GitHub', link: 'https://github.com', icon: 'code' },
{ label: '首页', link: '/', icon: 'home' }
]"
/>
```
<ButtonGroup
target="_blank"
:links="[
{ label: 'GitHub', link: 'https://github.com', icon: 'code' },
{ label: '首页', link: '/', icon: 'home' }
]"
/>

View File

@@ -3,11 +3,11 @@ title: "设置开机自启动的 Jekyll 服务"
description: "通过 systemd 实现一个开机自启的 Jekyll 服务,通常来说,这对使用 Jekyll 作为服务后端的网站很有用。"
color: "#aa0c2b"
impression: "/assets/images/120678678_p0.webp"
categories:
categories:
- 随笔
tags:
- jekyll
date: 2024-07-11T04:00:00Z
date: 2024-07-11T04:00:00+08
---
::: info

View File

@@ -21,7 +21,7 @@ YEAR=$(date +%y)
MONTH=$(date +%-m)
DAY=$(date +%-d)
NEW_VERSION="${YEAR}.${MONTH}.${DAY}(${NEXT_COMMIT_COUNT})"
NEW_VERSION="${YEAR}.${MONTH}.${DAY}.${NEXT_COMMIT_COUNT}"
echo "📝 更新版本号..."
# 使用 sed 更新 package.json 中的版本号