Skip to content

Commit 4b06ad0

Browse files
committed
fix docs
1 parent 2bea54c commit 4b06ad0

File tree

8 files changed

+38
-159
lines changed

8 files changed

+38
-159
lines changed

docs/vue/i18n.en-US.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ If you want to use other languages, you can follow the instructions below.
66

77
## LocaleProvider
88

9-
vue-antd-ui provides a React Component [LocaleProvider](/ant-design/components/locale-provider) for configuring vue-antd-ui locale text globally.
9+
vue-antd-ui provides a Vue Component [LocaleProvider](/ant-design/components/locale-provider) for configuring vue-antd-ui locale text globally.
1010

1111
````html
1212
<template>

docs/vue/introduce.en-US.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ Following the Ant Design specification, we developed a Vue UI library `antd` tha
2626
## Features
2727

2828
- An enterprise-class UI design language for web applications.
29-
- A set of high-quality React components out of the box.
29+
- A set of high-quality Vue components out of the box.
3030
- Shared [Ant Design of React](https://ant.design/docs/spec/introduce) design resources.
3131

3232
## Environment Support
3333

34-
* Modern browsers and Internet Explorer 9+ (with [polyfills](https://vuecomponent.github.io/ant-design/docs/react/getting-started-cn#兼容性))
34+
* Modern browsers and Internet Explorer 9+ (with [polyfills](https://vuecomponent.github.io/ant-design/docs/vue/getting-started-cn/#兼容性))
3535
* Server-side Rendering
3636

3737
## Version

docs/vue/introduce.zh-CN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
## 支持环境
3232

33-
* 现代浏览器和 IE9 及以上(需要 [polyfills](https://vuecomponent.github.io/ant-design/docs/react/getting-started-cn#兼容性))。
33+
* 现代浏览器和 IE9 及以上(需要 [polyfills](https://vuecomponent.github.io/ant-design/docs/vue/getting-started-cn/#兼容性))。
3434
* 支持服务端渲染。
3535

3636
## 版本
@@ -118,7 +118,7 @@ import 'vue-antd-ui/dist/antd.css'; // or 'vue-antd-ui/dist/antd.less'
118118

119119
- [首页](https://vuecomponent.github.io/ant-design/)
120120
- [Ant Design React](https://ant.design/)
121-
- [组件库](https://vuecomponent.github.io/ant-design/docs/react/introduce-cn)
121+
- [组件库](https://vuecomponent.github.io/ant-design/docs/vue/introduce-cn)
122122
- [更新日志](/ant-design/changelog-cn)
123123
- [CodeSandbox 模板](https://codesandbox.io/s/2wpk21kzvr) for bug reports
124124
- [定制主题](/ant-design/docs/vue/customize-theme-cn)

docs/vue/use-with-vue-cli.en-US.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
[vue-cli](https://github.com/vuejs/vue-cli) is one of the best Vue application development tools. We are going to use `antd` within it and modify the webpack config for some customized needs.
55

6-
---
76

87
## Install and Initialization
98

@@ -100,7 +99,7 @@ Now we need to customize the default webpack config.
10099

101100
### Use babel-plugin-import
102101

103-
[babel-plugin-import](https://github.com/ant-design/babel-plugin-import) is a babel plugin for importing components on demand ([How does it work?](/ant-design/docs/vue/getting-started#Import-on-Demand)).
102+
[babel-plugin-import](https://github.com/ant-design/babel-plugin-import) is a babel plugin for importing components on demand ([How does it work?](/ant-design/docs/vue/getting-started/#Import-on-Demand)).
104103

105104
```bash
106105
$ yarn add babel-plugin-import --dev
@@ -150,7 +149,7 @@ Remove the `import 'vue-antd-ui/dist/antd.css';` statement added before because
150149
})
151150
```
152151

153-
Then reboot with `npm run dev` and visit the demo page, you should not find any [warning messages](https://zos.alipayobjects.com/rmsportal/vgcHJRVZFmPjAawwVoXK.png) in the console, which prove that the `import on demand` config is working now. You will find more info about it in [this guide](/ant-design/docs/vue/getting-started#Import-on-Demand).
152+
Then reboot with `npm run dev` and visit the demo page, you should not find any [warning messages](https://zos.alipayobjects.com/rmsportal/vgcHJRVZFmPjAawwVoXK.png) in the console, which prove that the `import on demand` config is working now. You will find more info about it in [this guide](/ant-design/docs/vue/getting-started/#Import-on-Demand).
154153

155154
### Customize Theme
156155

docs/vue/use-with-vue-cli.zh-CN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ new Vue({
9696

9797
### 使用 babel-plugin-import
9898

99-
[babel-plugin-import](https://github.com/ant-design/babel-plugin-import) 是一个用于按需加载组件代码和样式的 babel 插件([原理](/ant-design/docs/vue/getting-started#按需加载))。
99+
[babel-plugin-import](https://github.com/ant-design/babel-plugin-import) 是一个用于按需加载组件代码和样式的 babel 插件([原理](/ant-design/docs/vue/getting-started-cn/#按需加载))。
100100

101101
```bash
102102
$ yarn add babel-plugin-import --dev
@@ -147,7 +147,7 @@ $ yarn add babel-plugin-import --dev
147147
})
148148
```
149149

150-
最后重启 `npm run dev` 访问页面,antd 组件的 js 和 css 代码都会按需加载,你在控制台也不会看到这样的[警告信息](https://zos.alipayobjects.com/rmsportal/vgcHJRVZFmPjAawwVoXK.png)。关于按需加载的原理和其他方式可以阅读[这里](/ant-design/docs/vue/getting-started-cn#按需加载)
150+
最后重启 `npm run dev` 访问页面,antd 组件的 js 和 css 代码都会按需加载,你在控制台也不会看到这样的[警告信息](https://zos.alipayobjects.com/rmsportal/vgcHJRVZFmPjAawwVoXK.png)。关于按需加载的原理和其他方式可以阅读[这里](/ant-design/docs/vue/getting-started-cn/#按需加载)
151151

152152
### 自定义主题
153153

site/components/demo.vue

Lines changed: 0 additions & 140 deletions
This file was deleted.

site/components/layout.vue

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,31 @@ export default {
2525
this.unsubscribe()
2626
}
2727
},
28+
mounted () {
29+
this.addSubMenu()
30+
},
2831
watch: {
29-
'$route': function () {
32+
'$route.path': function () {
3033
this.store.setState({ currentSubMenu: [] })
34+
this.addSubMenu()
3135
},
3236
},
3337
methods: {
38+
addSubMenu () {
39+
if (this.$route.path.indexOf('/docs/vue/') !== -1) {
40+
this.$nextTick(() => {
41+
const menus = []
42+
this.$refs.doc.querySelectorAll(['h2', 'h3']).forEach(dom => {
43+
const id = dom.id
44+
if (id) {
45+
const title = dom.textContent.split('#')[0].trim()
46+
menus.push({ cnTitle: title, usTitle: title, id })
47+
}
48+
})
49+
this.currentSubMenu = menus
50+
})
51+
}
52+
},
3453
subscribe () {
3554
const { store } = this
3655
this.unsubscribe = store.subscribe(() => {
@@ -42,21 +61,22 @@ export default {
4261
const lis = []
4362
currentSubMenu.forEach(({ cnTitle, usTitle, id }) => {
4463
const title = isCN ? cnTitle : usTitle
45-
const className = window.location.hash === `#${id}` ? 'current' : ''
64+
const className = decodeURIComponent(window.location.hash) === `#${id}` ? 'current' : ''
4665
lis.push(<li title={title}><a href={`#${id}`} class={className}>{title}</a></li>)
4766
})
67+
const showApi = this.$route.path.indexOf('/components/') !== -1
4868
return (
4969
<a-affix>
5070
<ul id='demo-toc' class='toc'>
5171
{lis}
52-
<li title='API' key='API'>
72+
{showApi ? <li title='API' key='API'>
5373
<a
54-
href='#api'
74+
href='#API'
5575
class={{
56-
current: window.location.hash === '#api',
76+
current: window.location.hash === '#API',
5777
}}
5878
>API</a>
59-
</li>
79+
</li> : ''}
6080
</ul>
6181
</a-affix>
6282
)
@@ -144,12 +164,12 @@ export default {
144164
<a-col xxl={20} xl={19} lg={19} md={18} sm={0} xs={0}>
145165
<div class='content main-container'>
146166
<div class='toc-affix' style='width: 110px;'>
147-
{Demo ? this.getSubMenu(isCN) : ''}
167+
{this.getSubMenu(isCN)}
148168
</div>
149169
{Demo ? <Provider store={this.store}>
150170
<Demo key={isCN ? 'cn' : 'en'}/>
151171
</Provider> : ''}
152-
<div class='markdown api-container'>
172+
<div class='markdown api-container' ref='doc'>
153173
<router-view></router-view>
154174
</div>
155175
</div>

webpack.base.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const md = require('markdown-it')('default', {
4747
highlight: renderHighlight,
4848
}).use(require('markdown-it-anchor'), {
4949
level: 2,
50-
// slugify: string => string,
50+
slugify: string => string.trim().split(' ').join('-'),
5151
permalink: true,
5252
// renderPermalink: (slug, opts, state, permalink) => {},
5353
permalinkClass: 'anchor',

0 commit comments

Comments
 (0)