Skip to content

Instantly share code, notes, and snippets.

@paolooo
Last active August 12, 2019 12:45
Show Gist options
  • Save paolooo/48f0cfa694ebdb2767fbbbc96f68f6b8 to your computer and use it in GitHub Desktop.
Save paolooo/48f0cfa694ebdb2767fbbbc96f68f6b8 to your computer and use it in GitHub Desktop.
ionic/vue picker
<script>
export default {
data() {
return {
pickerController: null
};
},
mounted() {
this.pickerController = document.querySelector('ion-picker-controller');
},
methods: {
openPicker() {
this.pickerController
.create({
columns: [
{
name: 'colour',
options: [
{ value: 0, text: 'red' },
{ value: 1, text: 'green' },
{ value: 2, text: 'blue' }
]
}
],
buttons: [
{
text: 'Cancel',
role: 'cancel'
},
{
text: 'Done',
handler: value => console.log(value)
}
]
})
.then(picker => picker.present());
}
}
};
</script>
<template>
<ion-page>
<ion-button @click="openPicker">Open Picker</ion-button>
<ion-picker-controller />
</ion-page>
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment