|
1 |
| -import { AtGrid } from 'taro-ui'; |
2 |
| -import { AtIconProps } from 'types/icon'; |
3 |
| - |
4 |
| -import { View } from '@tarojs/components'; |
5 |
| -import Taro from '@tarojs/taro'; |
6 |
| - |
7 |
| -import DocsHeader from '../../components/doc-header'; |
| 1 | +import { AtGrid } from 'taro-ui' |
| 2 | +import { AtGridItem } from 'types/grid' |
| 3 | +import { View } from '@tarojs/components' |
| 4 | +import Taro from '@tarojs/taro' |
| 5 | +import DocsHeader from '../../components/doc-header' |
8 | 6 | import './index.scss'
|
9 | 7 |
|
10 |
| -type DataItem = { |
11 |
| - value: string |
12 |
| - image?: string |
13 |
| - iconInfo?: AtIconProps |
14 |
| -} |
15 |
| - |
16 | 8 | interface GridPageState {
|
17 |
| - data: DataItem[] |
| 9 | + data: AtGridItem[] |
18 | 10 | }
|
19 | 11 |
|
20 | 12 | export default class GridPage extends Taro.Component<{}, GridPageState> {
|
21 |
| - public config: Taro.PageConfig = { |
22 |
| - navigationBarTitleText: 'Taro UI' |
23 |
| - } |
24 |
| - |
25 |
| - public constructor () { |
| 13 | + public constructor() { |
26 | 14 | super(...arguments)
|
27 | 15 | this.state = {
|
28 | 16 | data: [
|
@@ -57,17 +45,26 @@ export default class GridPage extends Taro.Component<{}, GridPageState> {
|
57 | 45 | size: 30,
|
58 | 46 | color: 'red',
|
59 | 47 | value: 'bookmark'
|
60 |
| - } |
| 48 | + }, |
| 49 | + url: '支持自定义字段' |
61 | 50 | }
|
62 | 51 | ]
|
63 | 52 | }
|
64 | 53 | }
|
65 | 54 |
|
66 |
| - private handleClick = (value: DataItem, index: number): void => { |
67 |
| - console.log(value, index) |
| 55 | + public config: Taro.PageConfig = { |
| 56 | + navigationBarTitleText: 'Taro UI' |
| 57 | + } |
| 58 | + |
| 59 | + private handleClick = (value: AtGridItem, index: number): void => { |
| 60 | + Taro.showModal({ |
| 61 | + title: '提示', |
| 62 | + content: `Value: ${value}, Index: ${index}`, |
| 63 | + showCancel: false |
| 64 | + }) |
68 | 65 | }
|
69 | 66 |
|
70 |
| - public render (): JSX.Element { |
| 67 | + public render(): JSX.Element { |
71 | 68 | return (
|
72 | 69 | <View className='page'>
|
73 | 70 | <DocsHeader title='Grid 栅格' />
|
|
0 commit comments