Skip to content

Commit 53d3c68

Browse files
SkyBird233MingcongBai
authored andcommitted
fix(crowdsourcing): fix md styles for crowdsourcing page
1 parent c6af47e commit 53d3c68

File tree

3 files changed

+14
-19
lines changed

3 files changed

+14
-19
lines changed

src/components/MarkdownDetail.vue

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<script setup>
2-
import CategorySecond from './CategorySecond.vue';
32
import PageNotFound from './PageNotFound.vue';
43
import { useRoute } from 'vue-router';
5-
import { ref, shallowRef, defineAsyncComponent, watchEffect } from 'vue';
4+
import { shallowRef, defineAsyncComponent, watch } from 'vue';
65
76
const props = defineProps({
87
articles: {
@@ -17,7 +16,7 @@ const props = defineProps({
1716
1817
const route = useRoute();
1918
const loadError = shallowRef(false);
20-
const articleComponent = ref();
19+
const articleComponent = shallowRef();
2120
2221
function loadArticle(slug) {
2322
const path = `${props.pathPrefix ?? './articles/'}${slug.split('#')[0]}${props.pathSuffix ?? '.md'}`;
@@ -32,11 +31,10 @@ function loadArticle(slug) {
3231
}
3332
3433
loadArticle(route.params.slug);
35-
watchEffect(
34+
watch(
3635
() => route.params.slug.split('#')[0],
37-
() => {
38-
loadArticle(route.params.slug);
39-
}
36+
(newSlug) => loadArticle(newSlug),
37+
{ immediate: true }
4038
);
4139
</script>
4240
@@ -46,11 +44,7 @@ watchEffect(
4644
<PageNotFound />
4745
</template>
4846
<template v-else>
49-
<CategorySecond v-if="title" :title="title" />
50-
<component
51-
class="vuepress-markdown-body"
52-
:is="articleComponent"
53-
ref="mdComponent" />
47+
<component class="vuepress-markdown-body" :is="articleComponent" />
5448
</template>
5549
</div>
5650
</template>

src/css/index.scss

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,7 @@ $bg-secondary: #3f6075;
6060
height: 2rem !important;
6161
align-items: center !important;
6262
justify-content: space-between !important;
63-
padding-left: 10px !important;
64-
padding-right: 10px !important;
65-
padding-top: 5px !important;
66-
padding-bottom: 5px !important;
63+
padding: 5px 10px !important;
6764
line-height: normal !important;
6865
color: #fff !important;
6966
user-select: none !important;
@@ -88,6 +85,12 @@ $bg-secondary: #3f6075;
8885
padding: 0 !important;
8986
}
9087

88+
// Vuepress' CSS has already removed the top margin for the first child
89+
// Add it back as we've removed default paddings
90+
> :first-child:not(h2){
91+
margin-top: $space-lg !important;
92+
}
93+
9194
h1 {
9295
background-color: $bg-secondary;
9396
color: #fff;
@@ -100,8 +103,6 @@ $bg-secondary: #3f6075;
100103

101104
h2 {
102105
border-bottom-width: 0;
103-
// Vuepress' CSS has already removed the top margin for the first child
104-
// so the top margin here works as expected
105106
margin-top: $space-lg !important;
106107
margin-bottom: $space-lg !important;
107108
}

src/pages/crowdsourcing/CrowdsourcingIndex.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const catalog = Object.entries(csArticleFrontmatters).map(([path, title]) => {
2929
>的要求,社区不接受作为社区及项目运转资金之用的捐款。但由于我社作为无运作资本的志愿者社区,在社区日常运营及为具体项目购置大宗物件(如构建用服务器和
3030
AOSCC
3131
年度聚会等场合)时经常需要资金及物质支持。因此,我们接受针对特定项目及购买计划的金钱、物品(如电脑机箱、电源及硬盘等)及服务(如网站服务器资源等)捐赠。</p
32-
><br />
32+
>
3333
</div>
3434

3535
<category-second title="补充条例" />

0 commit comments

Comments
 (0)