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 config --global user.name ${process.env.GITHUB_USER_NAME}`);
execSync(`git tag ${version}`); execSync(`git tag ${version}`);
execSync( execSync(
`git push https://${ `git push https://${process.env.GITHUB_TOKEN}@github.com/vueComponent/ant-design-vue.git ${version}:${version}`,
process.env.GITHUB_TOKEN
}@github.com/vueComponent/ant-design-vue.git ${version}:${version}`,
); );
execSync( execSync(
`git push https://${ `git push https://${process.env.GITHUB_TOKEN}@github.com/vueComponent/ant-design-vue.git master:master`,
process.env.GITHUB_TOKEN
}@github.com/vueComponent/ant-design-vue.git master:master`,
); );
console.log('tagged'); console.log('tagged');
} }

View File

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

View File

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

View File

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

View File

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

View File

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