-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
182 additions
and
528 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react'; | ||
|
||
export interface DataItem { | ||
icon?: any; | ||
text?: any; | ||
[key: string]: any; | ||
} | ||
|
||
export interface GridProps { | ||
data?: Array<DataItem | undefined>; | ||
hasLine?: boolean; | ||
columnNum?: number; | ||
isCarousel?: boolean; | ||
carouselMaxRow?: number; | ||
onClick?: (dataItem: DataItem | undefined, itemIndex: number) => void; | ||
/** web only */ | ||
renderItem?: (dataItem: DataItem | undefined, itemIndex: number) => React.ReactElement<any>; | ||
prefixCls?: string; | ||
className?: string; | ||
style?: React.CSSProperties; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,22 @@ | ||
import React from 'react'; | ||
import { View, Text } from 'react-native'; | ||
import { Grid } from 'antd-mobile'; | ||
|
||
const data1 = [ | ||
{ | ||
icon: 'https://os.alipayobjects.com/rmsportal/IptWdCkrtkAUfjE.png', | ||
text: '名字', | ||
link: 'hehe', | ||
}, { | ||
icon: 'https://os.alipayobjects.com/rmsportal/IptWdCkrtkAUfjE.png', | ||
text: '名字', | ||
link: 'hehe', | ||
}, { | ||
icon: 'https://os.alipayobjects.com/rmsportal/IptWdCkrtkAUfjE.png', | ||
text: '名字', | ||
link: 'hehe', | ||
}, { | ||
icon: 'https://os.alipayobjects.com/rmsportal/IptWdCkrtkAUfjE.png', | ||
text: '名字', | ||
link: 'hehe', | ||
}, { | ||
icon: 'https://os.alipayobjects.com/rmsportal/IptWdCkrtkAUfjE.png', | ||
text: '名字', | ||
link: 'hehe', | ||
}, { | ||
icon: 'https://os.alipayobjects.com/rmsportal/IptWdCkrtkAUfjE.png', | ||
text: '名字', | ||
link: 'hehe', | ||
}, { | ||
icon: 'https://os.alipayobjects.com/rmsportal/IptWdCkrtkAUfjE.png', | ||
text: '名字', | ||
link: 'hehe', | ||
}, { | ||
icon: 'https://os.alipayobjects.com/rmsportal/IptWdCkrtkAUfjE.png', | ||
text: '名字', | ||
link: 'hehe', | ||
}, { | ||
icon: 'https://os.alipayobjects.com/rmsportal/IptWdCkrtkAUfjE.png', | ||
text: '名字', | ||
link: 'hehe', | ||
}, { | ||
icon: 'https://os.alipayobjects.com/rmsportal/IptWdCkrtkAUfjE.png', | ||
text: '名字', | ||
link: 'hehe', | ||
}, | ||
]; | ||
const data = Array.from(new Array(9)).map((_val, i) => ({ | ||
icon: 'https://os.alipayobjects.com/rmsportal/IptWdCkrtkAUfjE.png', | ||
text: `名字${i}`, | ||
})); | ||
|
||
export default class BasicGridExample extends React.Component<any, any> { | ||
render() { | ||
return ( | ||
<Grid data={data1} /> | ||
); | ||
return (<View> | ||
<View style={[{ margin: 10 }]}><Text>简单示例</Text></View> | ||
<View style={[{ padding: 10 }]}> | ||
<Grid data={data} hasLine={false} /> | ||
</View> | ||
|
||
<View style={[{ margin: 10 }]}><Text>走马灯</Text></View> | ||
<Grid data={data} columnNum={3} isCarousel onClick={(_el, index) => alert(index)} /> | ||
</View>); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.