Skip to content
This repository has been archived by the owner on May 29, 2022. It is now read-only.

cheironz/vue2-ios-picker

Repository files navigation

vue2-ios-picker

iOS style picker component for vue2.0

Thanks for picker by ustbhuangyi

Props

themeColor: '#000000' // define the color of confirm button text
title: 'Picker' // display in center of picker head
items: [
            [
                {
                    text: 'display',
                    value: 'for code'
                },
                {
                    text: 'display',
                    value: 'for code'
                }
            ],
            [
                {
                    text: 'display',
                    value: 'for code'
                },
                {
                    text: 'display',
                    value: 'for code'
                }
            ]
        ]  // require
selectedIndex: [0, 2, 3] // index of default select, default: [0, 0, 0]

Event

change // column stop scroll. params: column index, item index of this column
select // click confirm button. params: value array of all column, index array of all column
cancel // user close picker
value-change // click confirm button and this value is different from the previous one. params: value array of all column, index array of all column

Methods

show(next) // next a function, callback after showing picker. NOT require
hide() // close picker
scrollColumn(index, dist) // index is the index of target column, dist is the index of item you want to scroll to.

Demo

# install dependencies
yarn install

# serve with hot reload at localhost:8080
yarn run dev