doc: update doc

pull/1091/head
tanjinzhou 2019-08-12 20:38:09 +08:00
parent ad81186ec5
commit d232bf65f3
6 changed files with 176 additions and 145 deletions

View File

@ -145,14 +145,10 @@ function tag() {
execSync(`git config --global user.name ${process.env.GITHUB_USER_NAME}`);
execSync(`git tag ${version}`);
execSync(
`git push https://${
process.env.GITHUB_TOKEN
}@github.com/vueComponent/ant-design-vue.git ${version}:${version}`,
`git push https://${process.env.GITHUB_TOKEN}@github.com/vueComponent/ant-design-vue.git ${version}:${version}`,
);
execSync(
`git push https://${
process.env.GITHUB_TOKEN
}@github.com/vueComponent/ant-design-vue.git master:master`,
`git push https://${process.env.GITHUB_TOKEN}@github.com/vueComponent/ant-design-vue.git master:master`,
);
console.log('tagged');
}

View File

@ -110,9 +110,7 @@ export default {
if (settings.centerMode) {
if (settings.slidesToScroll > 1 && process.env.NODE_ENV !== 'production') {
console.warn(
`slidesToScroll should be equal to 1 in centerMode, you are using ${
settings.slidesToScroll
}`,
`slidesToScroll should be equal to 1 in centerMode, you are using ${settings.slidesToScroll}`,
);
}
settings.slidesToScroll = 1;
@ -121,16 +119,12 @@ export default {
if (settings.fade) {
if (settings.slidesToShow > 1 && process.env.NODE_ENV !== 'production') {
console.warn(
`slidesToShow should be equal to 1 when fade is true, you're using ${
settings.slidesToShow
}`,
`slidesToShow should be equal to 1 when fade is true, you're using ${settings.slidesToShow}`,
);
}
if (settings.slidesToScroll > 1 && process.env.NODE_ENV !== 'production') {
console.warn(
`slidesToScroll should be equal to 1 when fade is true, you're using ${
settings.slidesToScroll
}`,
`slidesToScroll should be equal to 1 when fade is true, you're using ${settings.slidesToScroll}`,
);
}
settings.slidesToShow = 1;

View File

@ -376,9 +376,7 @@ function processEntity(entity, wrapper) {
if (currentEntity) {
warning(
false,
`Conflict! value of node '${entity.key}' (${value}) has already used by node '${
currentEntity.key
}'.`,
`Conflict! value of node '${entity.key}' (${value}) has already used by node '${currentEntity.key}'.`,
);
}
wrapper.valueEntities[value] = entity;

View File

@ -1,12 +1,17 @@
<script>
import axios from 'axios';
const carbonUrls = {
'vuecomponent.github.io': '//cdn.carbonads.com/carbon.js?serve=CK7DL2JW&placement=vuecomponentgithubio',
'tangjinzhou.gitee.io':'//cdn.carbonads.com/carbon.js?serve=CK7DL2JN&placement=tangjinzhougiteeio',
'ant-design-vue.gitee.io':'//cdn.carbonads.com/carbon.js?serve=CK7DL2JN&placement=antdesignvuegiteeio',
'vuecomponent.github.io':
'//cdn.carbonads.com/carbon.js?serve=CK7DL2JW&placement=vuecomponentgithubio',
'tangjinzhou.gitee.io':
'//cdn.carbonads.com/carbon.js?serve=CK7DL2JN&placement=tangjinzhougiteeio',
'ant-design-vue.gitee.io':
'//cdn.carbonads.com/carbon.js?serve=CK7DL2JN&placement=antdesignvuegiteeio',
'vue.ant.design': '//cdn.carbonads.com/carbon.js?serve=CK7DL2JW&placement=vueantdesign',
};
const carbonUrl = carbonUrls[location.host] || '//cdn.carbonads.com/carbon.js?serve=CK7DL2JW&placement=vueantdesign';
const carbonUrl =
carbonUrls[location.host] ||
'//cdn.carbonads.com/carbon.js?serve=CK7DL2JW&placement=vueantdesign';
export default {
props: {
isMobile: Boolean,
@ -17,18 +22,17 @@ export default {
// if(isGitee) {
// adId = '#cf';
// }
if(e.path !== t.path && this.$el.querySelector(adId)){
this.$el.innerHTML = "";
if (e.path !== t.path && this.$el.querySelector(adId)) {
this.$el.innerHTML = '';
this.load();
}
this.adInterval && clearInterval(this.adInterval);
this.adInterval = setInterval(()=>{
if(!this.$el.querySelector(adId)){
this.$el.innerHTML = "";
this.adInterval = setInterval(() => {
if (!this.$el.querySelector(adId)) {
this.$el.innerHTML = '';
this.load();
}
}, 20000);
},
},
mounted() {
@ -41,35 +45,35 @@ export default {
// .then(function (response) {
// document.getElementById("codefund-ads").innerHTML = response.data;
// });
// } else
if(carbonUrl) {
const e = document.createElement("script");
e.id = "_carbonads_js";
// } else
if (carbonUrl) {
const e = document.createElement('script');
e.id = '_carbonads_js';
e.src = carbonUrl;
this.$el.appendChild(e);
}
},
},
render () {
return (
<div id="carbon-ads" class={this.isMobile ? 'carbon-mobile':''}/>
);
render() {
return <div id="carbon-ads" class={this.isMobile ? 'carbon-mobile' : ''} />;
},
};
</script>
<style lang="less">
#carbon-ads {
width: 266px;
position: fixed;
left: 0;
bottom: 0px;
#carbon-ads {
width: 280px;
float: right;
position: relative;
right: 0;
bottom: 0;
padding: 0;
overflow: hidden;
z-index: 9;
background-color: #fff;
border-radius: 3px;
font-size: 13px;
background: #f5f5f5;
font-family: "Source Sans Pro", "Helvetica Neue", Arial, sans-serif;
font-family: 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif;
}
#carbonads {
overflow: hidden;
@ -100,9 +104,9 @@ export default {
overflow: hidden;
}
#carbon-ads .carbon-poweredby {
color: #aaa ;
font-weight: normal ;
line-height: 1.2 ;
color: #aaa;
font-weight: normal;
line-height: 1.2;
margin-top: 6px;
}
#carbon-ads.carbon-mobile {

View File

@ -12,7 +12,7 @@
height="100"
alt="浏览器工作原理与实践"
src="http://pvrd7go2h.bkt.clouddn.com/geektime-browser.jpeg"
>
/>
</a>
</div>
</template>
@ -40,12 +40,10 @@ export default {
<style lang="less" scoped>
#geektime-ads {
max-width: 280px;
height: 100px;
float: right;
position: relative;
right: 0;
bottom: 0;
width: 266px;
position: fixed;
left: 0;
bottom: 0px;
padding: 0;
overflow: hidden;
z-index: 9;

View File

@ -38,7 +38,7 @@ export default {
showDemo: Boolean,
showApi: Boolean,
},
data () {
data() {
this.store = create({
currentSubMenu: [],
});
@ -50,18 +50,18 @@ export default {
isMobile,
};
},
provide () {
provide() {
return {
demoContext: this,
};
},
watch: {
'$route.path': function () {
'$route.path': function() {
this.store.setState({ currentSubMenu: [] });
this.addSubMenu();
},
},
beforeDestroy () {
beforeDestroy() {
if (this.unsubscribe) {
this.unsubscribe();
}
@ -73,7 +73,7 @@ export default {
this.debouncedResize.cancel();
}
},
mounted () {
mounted() {
this.$nextTick(() => {
this.addSubMenu();
const nprogressHiddenStyle = document.getElementById('nprogress-style');
@ -88,7 +88,7 @@ export default {
});
},
methods: {
addSubMenu () {
addSubMenu() {
if (this.$route.path.indexOf('/docs/vue/') !== -1) {
this.$nextTick(() => {
const menus = [];
@ -104,13 +104,13 @@ export default {
});
}
},
subscribe () {
subscribe() {
const { store } = this;
this.unsubscribe = store.subscribe(() => {
this.currentSubMenu = this.store.getState().currentSubMenu;
});
},
getSubMenu (isCN) {
getSubMenu(isCN) {
const currentSubMenu = this.currentSubMenu;
const lis = [];
currentSubMenu.forEach(({ cnTitle, usTitle, id }) => {
@ -119,34 +119,33 @@ export default {
});
const showApi = this.$route.path.indexOf('/components/') !== -1;
return (
<a-anchor offsetTop={100} class='demo-anchor'>
<a-anchor offsetTop={100} class="demo-anchor">
{lis}
{showApi ? <a-anchor-link key='API' title='API' href='#API' /> : ''}
{showApi ? <a-anchor-link key="API" title="API" href="#API" /> : ''}
</a-anchor>
);
},
getDocsMenu (isCN, pagesKey) {
getDocsMenu(isCN, pagesKey) {
const docsMenu = [];
docsList.forEach(({ key, enTitle, title }, index) => {
const k = isCN ? `${key}-cn` : key;
pagesKey.push({ name: k,
url: `/docs/vue/${k}/`,
title: isCN ? title : enTitle,
});
docsMenu.push(<a-menu-item key={k}>
<router-link to={`/docs/vue/${k}/`}>{isCN ? title : enTitle }</router-link>
</a-menu-item>);
pagesKey.push({ name: k, url: `/docs/vue/${k}/`, title: isCN ? title : enTitle });
docsMenu.push(
<a-menu-item key={k}>
<router-link to={`/docs/vue/${k}/`}>{isCN ? title : enTitle}</router-link>
</a-menu-item>,
);
});
return docsMenu;
},
resetDocumentTitle (component, name, isCN) {
resetDocumentTitle(component, name, isCN) {
let titleStr = 'Ant Design Vue';
if (component) {
const { subtitle, title } = component;
const componentName = isCN ? subtitle + ' ' + title : title;
titleStr = componentName + ' - ' + titleStr;
} else {
const currentKey = docsList.filter((item) => {
const currentKey = docsList.filter(item => {
return item.key === name;
});
if (currentKey.length) {
@ -155,13 +154,13 @@ export default {
}
document.title = titleStr;
},
mountedCallback () {
mountedCallback() {
NProgress.done();
document.documentElement.scrollTop = 0;
},
},
render () {
render() {
const name = this.name;
const isCN = isZhCN(name);
const titleMap = {};
@ -193,7 +192,7 @@ export default {
const MenuItems = [];
sortBy(menus, ['title']).forEach(({ title, subtitle }) => {
const linkValue = isCN
? [<span>{title}</span>, <span class='chinese'>{subtitle}</span>]
? [<span>{title}</span>, <span class="chinese">{subtitle}</span>]
: [<span>{title}</span>];
let key = `${title.replace(/(\B[A-Z])/g, '-$1').toLowerCase()}`;
if (isCN) {
@ -209,9 +208,11 @@ export default {
subtitle,
url: `/components/${key}/`,
});
MenuItems.push(<a-menu-item key={key}>
<router-link to={`/components/${key}/`}>{linkValue}</router-link>
</a-menu-item>);
MenuItems.push(
<a-menu-item key={key}>
<router-link to={`/components/${key}/`}>{linkValue}</router-link>
</a-menu-item>,
);
});
MenuGroup.push(<a-menu-item-group title={type}>{MenuItems}</a-menu-item-group>);
}
@ -229,84 +230,124 @@ export default {
this.resetDocumentTitle(config, reName, isCN);
const { isMobile } = this;
return (
<div class='page-wrapper'>
<Header searchData={searchData} name={name}/>
<div class="page-wrapper">
<Header searchData={searchData} name={name} />
<a-locale-provider locale={locale}>
<div class='main-wrapper'>
<div class="main-wrapper">
<a-row>
{isMobile ? <MobileMenu ref='sidebar' wrapperClassName='drawer-wrapper'>
<a-menu
class='aside-container menu-site'
selectedKeys={[name]}
defaultOpenKeys={['Components']}
inlineIndent={40}
mode='inline'>
{docsMenu}
<a-sub-menu title={`Components(${searchData.length})`} key='Components'>
{MenuGroup}
</a-sub-menu>
</a-menu>
</MobileMenu>
:
<a-col ref='sidebar' class='site-sidebar main-menu' xxl={4} xl={5} lg={5} md={6} sm={8} xs={12}>
<a-affix>
<section class="main-menu-inner">
<Sponsors title={isCN ? '赞助商' : 'Sponsors'}/>
<a-menu
class='aside-container menu-site'
selectedKeys={[name]}
defaultOpenKeys={['Components']}
inlineIndent={40}
mode='inline'>
{docsMenu}
<a-sub-menu title={`Components(${searchData.length})`} key='Components'>
{MenuGroup}
</a-sub-menu>
</a-menu>
</section>
</a-affix>
</a-col>
}
{isMobile ? (
<MobileMenu ref="sidebar" wrapperClassName="drawer-wrapper">
<a-menu
class="aside-container menu-site"
selectedKeys={[name]}
defaultOpenKeys={['Components']}
inlineIndent={40}
mode="inline"
>
{docsMenu}
<a-sub-menu title={`Components(${searchData.length})`} key="Components">
{MenuGroup}
</a-sub-menu>
</a-menu>
</MobileMenu>
) : (
<a-col
ref="sidebar"
class="site-sidebar main-menu"
xxl={4}
xl={5}
lg={5}
md={6}
sm={8}
xs={12}
>
<a-affix>
<section class="main-menu-inner">
<Sponsors title={isCN ? '赞助商' : 'Sponsors'} />
<a-menu
class="aside-container menu-site"
selectedKeys={[name]}
defaultOpenKeys={['Components']}
inlineIndent={40}
mode="inline"
>
{docsMenu}
<a-sub-menu title={`Components(${searchData.length})`} key="Components">
{MenuGroup}
</a-sub-menu>
</a-menu>
</section>
</a-affix>
</a-col>
)}
<a-col xxl={20} xl={19} lg={19} md={18} sm={24} xs={24}>
<section class='main-container main-container-component'>
<section class="main-container main-container-component">
<CarbonAds isMobile={isMobile} />
<GeektimeAds isMobile={isMobile} />
{!isMobile ? <div class='toc-affix' style='width: 150px;'>
{this.getSubMenu(isCN)}
</div> : null}
{this.showDemo ? <Provider store={this.store} key={isCN ? 'cn' : 'en'}>
<router-view
class={`demo-cols-${config.cols || 2}`}
{...{ directives: [
{
name: 'mountedCallback',
value: this.mountedCallback,
},
] }}
></router-view>
</Provider> : ''}
{this.showApi ? <div class='markdown api-container' ref='doc'>
<router-view
{...{ directives: [
{
name: 'mountedCallback',
value: this.mountedCallback,
},
] }}
></router-view>
</div> : ''}
{!isMobile ? (
<div class="toc-affix" style="width: 150px;">
{this.getSubMenu(isCN)}
</div>
) : null}
{this.showDemo ? (
<Provider store={this.store} key={isCN ? 'cn' : 'en'}>
<router-view
class={`demo-cols-${config.cols || 2}`}
{...{
directives: [
{
name: 'mountedCallback',
value: this.mountedCallback,
},
],
}}
></router-view>
</Provider>
) : (
''
)}
{this.showApi ? (
<div class="markdown api-container" ref="doc">
<router-view
{...{
directives: [
{
name: 'mountedCallback',
value: this.mountedCallback,
},
],
}}
></router-view>
</div>
) : (
''
)}
</section>
<section class='prev-next-nav'>
{prevPage ? <router-link class='prev-page' to={`${prevPage.url}`}><a-icon type='left' />&nbsp;&nbsp;{prevPage.title}</router-link> : ''}
{nextPage ? <router-link class='next-page' to={`${nextPage.url}`}>{nextPage.title}&nbsp;&nbsp;<a-icon type='right' /></router-link> : ''}
<section class="prev-next-nav">
{prevPage ? (
<router-link class="prev-page" to={`${prevPage.url}`}>
<a-icon type="left" />
&nbsp;&nbsp;{prevPage.title}
</router-link>
) : (
''
)}
{nextPage ? (
<router-link class="next-page" to={`${nextPage.url}`}>
{nextPage.title}&nbsp;&nbsp;
<a-icon type="right" />
</router-link>
) : (
''
)}
</section>
<Footer ref='footer' isCN={isCN}/>
<Footer ref="footer" isCN={isCN} />
</a-col>
</a-row>
</div>
</a-locale-provider>
{ name.indexOf('back-top') === -1 ? <a-back-top /> : null }
{ isCN && <Geektime isMobile={isMobile} /> }
{name.indexOf('back-top') === -1 ? <a-back-top /> : null}
{isCN && <Geektime isMobile={isMobile} />}
</div>
);
},