-
-
Notifications
You must be signed in to change notification settings - Fork 34
/
index.vue
56 lines (54 loc) · 1.29 KB
/
index.vue
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
<template>
<div class="example-page">
<smooth-picker v-show="showPicker" ref="smoothPicker" :data="data" :change="dataChange" />
<button class="button" type="button" @click="confirm">Confirm</button>
</div>
</div>
</template>
<script>
export default {
name: 'example-page',
data () {
return {
showPicker: false,
data: [
{
currentIndex: 1,
flex: 3,
list: ['Secret', 'Male', 'Female'],
onClick: this.clickOnGender,
textAlign: 'center',
className: 'row-group'
}
]
}
},
methods: {
clickOnGender () {
const ciList = this.$refs.smoothPicker.getCurrentIndexList()
window.alert('Clicked index:' + ciList[0])
},
dataChange (gIndex, iIndex) {
console.info('list', gIndex, iIndex)
},
confirm () {
const ciList = this.$refs.smoothPicker.getCurrentIndexList()
window.alert('Selected: ' + this.data[0].list[ciList[0]])
}
},
mounted () {
setTimeout(() => {
this.showPicker = true
}, 200)
}
}
</script>
<style lang="stylus">
body
background-color: #f0f0f0
.button
margin 10px 0 0
background-color black
color white
padding 5px
</style>