/
index.js
62 lines (59 loc) · 1.76 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import Taro from '@tarojs/taro'
import { View } from '@tarojs/components'
import { AtSwitch, AtForm } from 'taro-ui'
import DocsHeader from '../../components/doc-header'
import './index.scss'
export default class Index extends Taro.Component {
config = {
navigationBarTitleText: 'Taro UI'
}
constructor () {
super(...arguments)
this.state = {
switchValue: false,
}
}
handleChange (value) {
console.log(this.state.switchValue)
this.setState({
switchValue: value
})
}
render () {
return (
<View className='page'>
{/* S Header */}
<DocsHeader title='Switch 开关'></DocsHeader>
{/* E Header */}
{/* S Body */}
<View className='doc-body'>
{/* 基础用法 */}
<View className='panel'>
<View className='panel__title'>基础用法</View>
<View className='panel__content no-padding'>
<View className='example-item'>
<AtForm>
<AtSwitch title='开启中' checked onChange={this.handleChange.bind(this)} />
<AtSwitch title='已关闭' border={false} />
</AtForm>
</View>
</View>
</View>
{/* 禁用状态 */}
<View className='panel'>
<View className='panel__title'>禁用状态</View>
<View className='panel__content no-padding'>
<View className='example-item'>
<AtForm>
<AtSwitch title='不可点击' checked disabled />
<AtSwitch title='不可点击' border={false} disabled />
</AtForm>
</View>
</View>
</View>
</View>
{/* E Body */}
</View>
)
}
}