Skip to content

Commit 59c0ff2

Browse files
HouLiXieBuRouSkyBird233
authored andcommitted
feat: 新闻展示页去除各级标题被选中时的下划线,并且首标题现在也会生成链接
1 parent 83887a4 commit 59c0ff2

File tree

3 files changed

+33
-35
lines changed

3 files changed

+33
-35
lines changed

assets/index.scss

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,19 @@ $bg-secondary: #3f6075;
1010
$common-margin: 24px;
1111

1212
@use 'heti'
13-
with(
14-
$line-length: none,
15-
$darkmode: 'manual',
16-
$manualmode-dark-selector: 'body.dark &',
17-
$font-size-h2: normal,
18-
$line-height-size-h2: normal,
19-
$std-block-unit: 16px,
20-
21-
// TODO: discussion on website font config
22-
// Heti's default font family displays Chinese quotes half-width
23-
// so they have been removed for backward compatibility.
24-
$_font-stack-sans: '',
25-
$_font-stack-serif: ''
26-
);
13+
with ($line-length: none,
14+
$darkmode: 'manual',
15+
$manualmode-dark-selector: 'body.dark &',
16+
$font-size-h2: normal,
17+
$line-height-size-h2: normal,
18+
$std-block-unit: 16px,
19+
20+
// TODO: discussion on website font config
21+
// Heti's default font family displays Chinese quotes half-width
22+
// so they have been removed for backward compatibility.
23+
$_font-stack-sans: '',
24+
$_font-stack-serif: ''
25+
);
2726

2827
.heti {
2928
> :not(h2) {
@@ -41,6 +40,7 @@ $common-margin: 24px;
4140

4241
a:hover {
4342
border-block-end: inherit;
43+
padding-block-end: 0;
4444
}
4545
}
4646

@@ -53,6 +53,7 @@ $common-margin: 24px;
5353
> :first-child {
5454
margin-top: 0;
5555
}
56+
5657
> :last-child {
5758
margin-bottom: 0;
5859
}
@@ -133,6 +134,7 @@ table {
133134
border-collapse: collapse;
134135

135136
tr {
137+
136138
th,
137139
td {
138140
border: 1px solid $bg-secondary;
@@ -190,4 +192,4 @@ td {
190192

191193
.language-menu {
192194
margin-top: -7px;
193-
}
195+
}

components/CategorySecond.vue

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,27 @@
11
<script setup>
22
const props = defineProps({
33
title: { type: String, required: true },
4-
rightText: { type: String, default: '' },
5-
rightUrl: { type: String, default: '' },
6-
rightName: { type: String, default: '' },
7-
showRightChevron: { type: Boolean },
8-
params: { type: String, default: '' }
4+
titleUrl: { type: String, default: undefined },
5+
rightText: { type: String, default: undefined },
6+
rightUrl: { type: String, default: undefined },
7+
showRightChevron: { type: Boolean }
98
});
109
</script>
1110

1211
<template>
1312
<div class="category-second">
14-
<span>
15-
{{ props.title }}
13+
<span v-if="titleUrl === undefined">
14+
{{ title }}
1615
</span>
16+
<AppLink v-else :to="titleUrl" class="no-underline">{{ title }}</AppLink>
1717

18-
<span v-if="props.rightText">
19-
<span v-if="props.rightUrl === undefined">
20-
{{ props.rightText }}
18+
<span v-if="rightText !== undefined">
19+
<span v-if="rightUrl === undefined">
20+
{{ rightText }}
2121
</span>
22-
<NuxtLinkLocale
23-
v-else
24-
:to="
25-
props.params
26-
? { name: props.rightUrl, params: props.params }
27-
: props.rightUrl
28-
">
29-
{{ props.rightText }}
30-
</NuxtLinkLocale>
22+
<AppLink v-else class="" :to="rightUrl">
23+
{{ rightText }}
24+
</AppLink>
3125
<!-- 右箭头 -->
3226
<Icon
3327
v-if="showRightChevron"

components/CommonContent.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ useHead({ title: page.value?.title });
1919
<article v-if="page">
2020
<category-second
2121
v-if="page?.body.value[0][0] !== 'h2'"
22+
:id="page?.title"
2223
:title="page?.title"
23-
:right-text="page?.date.substring(0, 10)" />
24+
:right-text="page?.date.substring(0, 10)"
25+
:title-url="`${route.path}#${page.title}`" />
2426
<ContentRenderer :value="page" class="heti" />
2527
</article>
2628
</template>

0 commit comments

Comments
 (0)