doc: add changelog to site

v2.3
tangjinzhou 2021-09-23 16:27:08 +08:00
parent ae01387d90
commit 9bb6e79db0
9 changed files with 43 additions and 2066 deletions

View File

@ -70,7 +70,7 @@ module.exports = {
'no-var': 'error', 'no-var': 'error',
'no-console': [2, { allow: ['warn', 'error'] }], 'no-console': [2, { allow: ['warn', 'error'] }],
'object-shorthand': 2, 'object-shorthand': 2,
'no-unused-vars': [2, { ignoreRestSiblings: true, argsIgnorePattern: '^h$' }], 'no-unused-vars': [2, { ignoreRestSiblings: true, argsIgnorePattern: '^_' }],
'no-undef': 2, 'no-undef': 2,
camelcase: 'off', camelcase: 'off',
'no-extra-boolean-cast': 'off', 'no-extra-boolean-cast': 'off',

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -69,7 +69,11 @@ export const createMarkdownRenderer = (options: MarkdownOptions = {}): MarkdownR
.use(emoji) .use(emoji)
.use(anchor, { .use(anchor, {
slugify, slugify,
permalink: false, permalink: anchor.permalink.linkInsideHeader({
symbol: `
<span aria-hidden="true" class="anchor">#</span>
`,
}),
permalinkBefore: true, permalinkBefore: true,
permalinkSymbol: '#', permalinkSymbol: '#',
permalinkAttrs: () => ({ 'aria-hidden': true }), permalinkAttrs: () => ({ 'aria-hidden': true }),

View File

@ -47,17 +47,17 @@ const useMenus = (): {
} }
}) })
.map(r => ({ ...r.meta, path: r.path.split(':lang')[0].replace('-cn', '') })); .map(r => ({ ...r.meta, path: r.path.split(':lang')[0].replace('-cn', '') }));
if (category === 'docs') { // if (category === 'docs') {
ms.push({ // ms.push({
enTitle: 'Change Log', // enTitle: 'Change Log',
title: '更新日志', // title: '更新日志',
category: 'docs', // category: 'docs',
target: '_blank', // target: '_blank',
path: globalConfig.isZhCN.value // path: globalConfig.isZhCN.value
? 'https://github.com/vueComponent/ant-design-vue/blob/next/CHANGELOG.zh-CN.md' // ? 'https://github.com/vueComponent/ant-design-vue/blob/next/CHANGELOG.zh-CN.md'
: 'https://github.com/vueComponent/ant-design-vue/blob/next/CHANGELOG.en-US.md', // : 'https://github.com/vueComponent/ant-design-vue/blob/next/CHANGELOG.en-US.md',
} as any); // } as any);
} // }
return ms; return ms;
}); });
const activeMenuItem = computed(() => { const activeMenuItem = computed(() => {

View File

@ -67,9 +67,7 @@ export default defineComponent({
() => route.path, () => route.path,
pathname => { pathname => {
const modules = pathname.split('/'); const modules = pathname.split('/');
if (pathname === 'changelog' || pathname === 'changelog-cn') { if (pathname === '/docs/resources' || pathname === '/docs/resources-cn') {
activeMenuItem.value = 'docs/vue';
} else if (pathname === '/docs/resources' || pathname === '/docs/resources-cn') {
activeMenuItem.value = 'docs/resources'; activeMenuItem.value = 'docs/resources';
} else if (modules[1] === 'components') { } else if (modules[1] === 'components') {
activeMenuItem.value = 'components'; activeMenuItem.value = 'components';

View File

@ -42,7 +42,7 @@
<a-anchor-link <a-anchor-link
v-for="h in headers" v-for="h in headers"
:key="h.title" :key="h.title"
:href="h.href || `#${h.title}`" :href="h.href || `#${h.title.replace(/^(\d)/, '_$1')}`"
:title="h.title" :title="h.title"
></a-anchor-link> ></a-anchor-link>
</a-anchor> </a-anchor>
@ -117,10 +117,11 @@ export default defineComponent({
} }
}); });
const themeMode = inject('themeMode', () => ({ const themeMode = inject('themeMode', {
theme: ref('default'), theme: ref('default'),
changeTheme: () => void 0, // eslint-disable-next-line @typescript-eslint/no-unused-vars
})); changeTheme: (_key: any) => void 0,
});
watch( watch(
() => route.path, () => route.path,
@ -141,7 +142,7 @@ export default defineComponent({
const pageData = computed(() => const pageData = computed(() =>
isDemo.value isDemo.value
? matchCom.value[isZhCN.value ? 'CN' : 'US']?.pageData ? matchCom.value[isZhCN.value ? 'CN' : 'US']?.pageData
: matchCom.value?.pageData, : (matchCom.value as any)?.pageData,
); );
const headers = computed(() => { const headers = computed(() => {
if (isDemo.value) { if (isDemo.value) {

View File

@ -138,6 +138,16 @@ const routes = [
meta: { enTitle: 'Sponsor', title: '支持我们', category: 'docs' }, meta: { enTitle: 'Sponsor', title: '支持我们', category: 'docs' },
component: () => import('../vueDocs/sponsor.en-US.md'), component: () => import('../vueDocs/sponsor.en-US.md'),
}, },
{
path: 'vue/changelog-cn',
meta: { enTitle: 'Change Log', title: '更新日志', category: 'docs' },
component: () => import('../../../CHANGELOG.zh-CN.md'),
},
{
path: 'vue/changelog',
meta: { enTitle: 'Change Log', title: '更新日志', category: 'docs' },
component: () => import('../../../CHANGELOG.en-US.md'),
},
{ path: '', redirect: '/docs/vue/introduce/' }, { path: '', redirect: '/docs/vue/introduce/' },
], ],
}, },

View File

@ -56,7 +56,7 @@
</section> </section>
</template> </template>
<script lang="ts"> <script lang="ts">
import { GlobalConfig } from '../App.vue'; import type { GlobalConfig } from '../App.vue';
import { computed, defineComponent, inject, onMounted, ref } from 'vue'; import { computed, defineComponent, inject, onMounted, ref } from 'vue';
import { SearchOutlined } from '@ant-design/icons-vue'; import { SearchOutlined } from '@ant-design/icons-vue';
import { GLOBAL_CONFIG } from '../SymbolKey'; import { GLOBAL_CONFIG } from '../SymbolKey';