张延森 3 anos atrás
pai
commit
18c50aaf96

+ 12
- 1
src/pages/index/index.jsx Ver arquivo

1
-import React, { useState } from 'react'
1
+import React, { Suspense, useState, lazy } from 'react'
2
 import { View, Text } from '@tarojs/components'
2
 import { View, Text } from '@tarojs/components'
3
 import CustomNav from '@/components/CustomNav'
3
 import CustomNav from '@/components/CustomNav'
4
 import logo from '@/assets/icons/comm/logo_small.png'
4
 import logo from '@/assets/icons/comm/logo_small.png'
5
 import tabList from './tabbar'
5
 import tabList from './tabbar'
6
 import './index.less'
6
 import './index.less'
7
 
7
 
8
+const Recommend = lazy(() => import('./tabs/Recommend'))
9
+const Guide = lazy(() => import('./tabs/Guide'))
10
+const Strategy = lazy(() => import('./tabs/Strategy'))
11
+const Mine = lazy(() => import('./tabs/Mine'))
12
+
8
 export default (props) => {
13
 export default (props) => {
9
   const [currentTab, setCurrentTab] = useState(0)
14
   const [currentTab, setCurrentTab] = useState(0)
10
 
15
 
19
         <CustomNav logo={logo} title='首页' />
24
         <CustomNav logo={logo} title='首页' />
20
       </view>
25
       </view>
21
       <view className='index-container'>
26
       <view className='index-container'>
27
+        <Suspense fallback='loading...'>
28
+          {currentTab === 0 && <Recommend />}
29
+          {currentTab === 1 && <Guide />}
30
+          {currentTab === 2 && <Strategy />}
31
+          {currentTab === 3 && <Mine />}
32
+        </Suspense>
22
       </view>
33
       </view>
23
       <view className='index-tabbar'>
34
       <view className='index-tabbar'>
24
         <mp-tabbar extClass='custom-tabbar' current={currentTab} list={tabList} onChange={handleTabChange}></mp-tabbar>
35
         <mp-tabbar extClass='custom-tabbar' current={currentTab} list={tabList} onChange={handleTabChange}></mp-tabbar>

+ 3
- 0
src/pages/index/index.less Ver arquivo

20
 }
20
 }
21
 
21
 
22
 .custom-tabbar {
22
 .custom-tabbar {
23
+  background: #FFFFFF;
24
+  box-shadow: 0px -4px 6px 0px rgba(0, 0, 0, 0.08);
25
+
23
   .weui-tabbar__label {
26
   .weui-tabbar__label {
24
     color: #C0C8D3;
27
     color: #C0C8D3;
25
   }
28
   }

+ 7
- 0
src/pages/index/tabs/Guide.jsx Ver arquivo

1
+import React from 'react'
2
+
3
+export default (props) => {
4
+  return (
5
+    <view>入住指引</view>
6
+  )
7
+}

+ 7
- 0
src/pages/index/tabs/Mine.jsx Ver arquivo

1
+import React from 'react'
2
+
3
+export default (props) => {
4
+  return (
5
+    <view>个人中心</view>
6
+  )
7
+}

+ 7
- 0
src/pages/index/tabs/Recommend.jsx Ver arquivo

1
+import React from 'react'
2
+
3
+export default (props) => {
4
+  return (
5
+    <view>房东推荐</view>
6
+  )
7
+}

+ 7
- 0
src/pages/index/tabs/Strategy.jsx Ver arquivo

1
+import React from 'react'
2
+
3
+export default (props) => {
4
+  return (
5
+    <view>定制攻略</view>
6
+  )
7
+}