-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- https://nutui.jd.com/taro/react/2x/#/zh-CN/guide/start-react - https://docs.taro.zone/docs/use-h5 - jdf2e/nutui-icons#16
- Loading branch information
Showing
7 changed files
with
89 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
packages/taro-demo-react/src/pages/index/index.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
.index { | ||
height: 100%; | ||
width: 100%; | ||
|
||
&__header { | ||
display: flex; | ||
align-items: center; | ||
padding: 0 34px; | ||
height: 117px; | ||
> image { | ||
width: 67px; | ||
height: 67px; | ||
margin-right: 18px; | ||
flex-shrink: 0; | ||
} | ||
&__info { | ||
display: flex; | ||
flex-direction: column; | ||
h1 { | ||
height: 48px; | ||
line-height: 48px; | ||
font-size: 34px; | ||
color: rgb(51 51 51 / 100%); | ||
font-weight: 500; | ||
} | ||
p { | ||
height: 18px; | ||
line-height: 18px; | ||
font-size: 12px; | ||
color: rgb(154 155 157 / 100%); | ||
} | ||
} | ||
} | ||
&__navs { | ||
background: #f7f8fa; | ||
border-radius: 30px 30px 0 0; | ||
overflow: hidden; | ||
padding: 30px 25px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,34 @@ | ||
import { Text, View } from '@tarojs/components'; | ||
import { useLoad } from '@tarojs/taro'; | ||
import { Image, View } from '@tarojs/components'; | ||
import Taro from '@tarojs/taro'; | ||
import { ArrowRight } from '@nutui/icons-react-taro'; | ||
import { Cell, CellGroup } from '@nutui/nutui-react-taro'; | ||
import { navs, NUT_UI_LOGO } from './constants'; | ||
import styles from './index.module.scss'; | ||
|
||
export default function Index() { | ||
useLoad(() => { | ||
console.log('Page loaded.'); | ||
}); | ||
async function navigateTo(group: string, path: string) { | ||
await Taro.navigateTo({ url: `/pages/${group}/${path}` }); | ||
} | ||
|
||
export default function Index() { | ||
return ( | ||
<View className="index"> | ||
<Text>Hello world!</Text> | ||
<View className={styles.index}> | ||
<View className={styles.index__header}> | ||
<Image src={NUT_UI_LOGO} /> | ||
<View className={styles.index__header__info}> | ||
<h1>NutUI React</h1> | ||
<p>京东风格的轻量级小程序组件库 React 版</p> | ||
</View> | ||
</View> | ||
<View className={styles.index__navs}> | ||
{navs.map((group) => ( | ||
<CellGroup key={group.path} title={group.name}> | ||
{group.children.map(({ name, path }) => { | ||
const onClick = () => navigateTo(group.path, path); | ||
return <Cell key={path} title={name} extra={<ArrowRight />} onClick={onClick} />; | ||
})} | ||
</CellGroup> | ||
))} | ||
</View> | ||
</View> | ||
); | ||
} |