@@ -13,7 +13,7 @@ import Content from './containers/Content';
1313import Header from './containers/Header' ;
1414import Navigator from './containers/Navigator' ;
1515
16- import { Notification , Col , Row , Affix } from 'santd' ;
16+ import { Notification , Col , Row , Affix , Icon } from 'santd' ;
1717
1818import routes from './lib/routes' ;
1919import './style/index.less' ;
@@ -28,21 +28,58 @@ class Index extends Component {
2828 <s-row>
2929 <s-col xs="24" sm="24" md="24" lg="6" xl="5" xxl="4" class="main-menu">
3030 <s-affix>
31- <section class="main-menu-inner">
32- <doc-navigator
33- class="aside-container menu-site"
34- style="top: {{navigatorFixedTop}}px;"
35- routes="{{routes}}"
36- currentPath="{{currentPath}}"
37- on-redirect="handleRedirect"
38- />
39- </section>
40- </s-affix>
31+ <section class="main-menu-inner">
32+ <doc-navigator
33+ class="aside-container menu-site"
34+ style="top: {{navigatorFixedTop}}px;"
35+ routes="{{routes}}"
36+ currentPath="{{currentPath}}"
37+ on-redirect="handleRedirect"
38+ />
39+ </section>
40+ </s-affix>
4141 </s-col>
4242 <s-col xs="24" sm="24" md="24" lg="18" xl="19" xxl="20">
4343 <section class="main-container">
4444 <doc-content content="{{content}}" />
4545 </section>
46+ <section class="prev-next-nav">
47+ <a class="prev-page" href="#{{leftNav.key}}" s-if="leftNav"><s-icon type="left" /> {{leftNav.text || leftNav.name}}</a>
48+ <a class="next-page" href="#{{rightNav.key}}" s-if="rightNav">{{rightNav.text || rightNav.name}} <s-icon type="right" /></a>
49+ </section>
50+ <footer id="footer">
51+ <div class="footer-wrap">
52+ <s-row>
53+ <s-col xs="24" sm="24" md="6">
54+ <div class="footer-center">
55+ <h2>相关资源</h2>
56+ <div><a href="https://ant.design/docs/react/introduce-cn" target="_blank">Ant Design</a><span> - </span><span>React</span></div>
57+ <div><a href="https://antdv.com/docs/vue/introduce-cn" target="_blank">Ant Design</a><span> - </span><span>Vue</span></div>
58+ <div><a href="https://github.com/NG-ZORRO/ng-zorro-antd" target="_blank">Ant Design</a><span> - </span><span>Angular</span></div>
59+ <div><a href="https://github.com/websemantics/awesome-ant-design" target="_blank">Awesome Ant Design</a></div>
60+ <div><a href="https://baidu.github.io/san/">San</a></div>
61+ </div>
62+ </s-col>
63+ <s-col xs="24" sm="24" md="6">
64+ <div class="footer-center">
65+ <h2>帮助</h2>
66+ <div><a href="https://github.com/ecomfe/santd" target="_blank">GitHub</a></div>
67+ <div><a href="#/docs/changelog">更新日志</a></div>
68+ </div>
69+ </s-col>
70+ <s-col xs="24" sm="24" md="6">
71+ <div class="footer-center">
72+ <h2><img alt="" class="title-icon" src="https://gw.alipayobjects.com/zos/rmsportal/nBVXkrFdWHxbZlmMbsaH.svg"><span>更多产品</span></h2>
73+ <div><a href="https://yuque.com/" target="_blank "><i nz-icon="" nztheme="fill" nztype="yuque" style="margin-right: 4px; color: rgb(37, 184, 100);" class="anticon anticon-yuque"><svg viewBox="64 64 896 896" fill="currentColor" width="1em" height="1em" data-icon="yuque" aria-hidden="true"><path d="M854.6 370.6c-9.9-39.4 9.9-102.2 73.4-124.4l-67.9-3.6s-25.7-90-143.6-98c-117.9-8.1-195-3-195-3s87.4 55.6 52.4 154.7c-25.6 52.5-65.8 95.6-108.8 144.7-1.3 1.3-2.5 2.6-3.5 3.7C319.4 605 96 860 96 860c245.9 64.4 410.7-6.3 508.2-91.1 20.5-.2 35.9-.3 46.3-.3 135.8 0 250.6-117.6 245.9-248.4-3.2-89.9-31.9-110.2-41.8-149.6z"></path></svg></i> 语雀</a><span> - </span><span>知识创作与分享工具</span></div>
74+ <div><a href="https://yunfengdie.com/" target="_blank "><span>云凤蝶</span></a><span> - </span><span>移动建站平台</span></div>
75+ <div><a href="https://antv.alipay.com/" rel="noopener noreferrer" target="_blank">AntV</a><span> - </span><span>数据可视化</span></div>
76+ <div><a href="https://eggjs.org/" rel="noopener noreferrer" target="_blank">Egg</a><span> - </span><span>企业级 Node 开发框架</span></div>
77+ <div><a href="http://xtech.antfin.com/" target="_blank "><span>蚂蚁体验科技</span></a></div>
78+ </div>
79+ </s-col>
80+ </s-row>
81+ </div>
82+ </footer>
4683 </s-col>
4784 </s-row>
4885 </div>
@@ -55,9 +92,37 @@ class Index extends Component {
5592 'doc-navigator' : Navigator ,
5693 's-col' : Col ,
5794 's-row' : Row ,
58- 's-affix' : Affix
95+ 's-affix' : Affix ,
96+ 's-icon' : Icon
5997 } ;
6098
99+ static computed = {
100+ leftNav ( ) {
101+ const currentPath = this . data . get ( 'currentPath' ) ;
102+ const flattenRouter = this . data . get ( 'flattenRouter' ) || [ ] ;
103+ let leftNav ;
104+ flattenRouter . forEach ( ( router , index ) => {
105+ if ( router . key === currentPath ) {
106+ leftNav = flattenRouter [ index - 1 ] ;
107+ }
108+ } ) ;
109+
110+ return leftNav ;
111+ } ,
112+ rightNav ( ) {
113+ const currentPath = this . data . get ( 'currentPath' ) ;
114+ const flattenRouter = this . data . get ( 'flattenRouter' ) || [ ] ;
115+ let rightNav ;
116+ flattenRouter . forEach ( ( router , index ) => {
117+ if ( router . key === currentPath ) {
118+ rightNav = flattenRouter [ index + 1 ] ;
119+ }
120+ } ) ;
121+
122+ return rightNav ;
123+ }
124+ }
125+
61126 initData ( ) {
62127 return {
63128 routerMap : { } ,
@@ -67,19 +132,25 @@ class Index extends Component {
67132
68133 inited ( ) {
69134 let routerMap = { } ;
135+ let flattenRouter = [ ] ;
70136 const routes = this . data . get ( 'routes' ) ;
71137 routes . forEach ( item => {
72138 routerMap [ item . key ] = { } ;
73- item . leaf && item . leaf . forEach ( subItem => (
74- routerMap [ item . key ] [ subItem . path ] = true
75- ) ) ;
76- item . list && item . list . forEach ( listItem => (
77- listItem . leaf && listItem . leaf . forEach ( subItem => (
78- routerMap [ item . key ] [ subItem . path ] = true
79- ) )
80- ) ) ;
139+ if ( ! item . list ) {
140+ flattenRouter . push ( item ) ;
141+ }
142+ item . leaf && item . leaf . forEach ( subItem => {
143+ routerMap [ item . key ] [ subItem . path ] = true ;
144+ } ) ;
145+ item . list && item . list . forEach ( listItem => {
146+ listItem . leaf && listItem . leaf . forEach ( subItem => {
147+ flattenRouter . push ( subItem ) ;
148+ routerMap [ item . key ] [ subItem . path ] = true ;
149+ } ) ;
150+ } ) ;
81151 } ) ;
82152 this . data . set ( 'routerMap' , routerMap ) ;
153+ this . data . set ( 'flattenRouter' , flattenRouter ) ;
83154 }
84155
85156 attached ( ) {
0 commit comments