Skip to content

Commit

Permalink
picker
Browse files Browse the repository at this point in the history
  • Loading branch information
szuprefix committed Feb 23, 2021
1 parent de94eb4 commit 929d8fa
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions src/components/vant/model/Picker.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<template>
<field readonly clickable v-bind="[field]" :value="value" @click="showPicker = true">
<template #input>
<popup v-model="showPicker" position="bottom">
<picker
show-toolbar
:columns="columns"
@change="onPopupChange"
@cancel="showPicker = false"
/>
</popup>
</template>
</field>
</template>
<script>
export default{
props: {
field: Object,
value: String,
context: Object
},
data () {
return {
showPicker,
options:[]
}
},
components: {},
methods: {
onPopupChange(picker, value, index) {
},
load(){
let model = this.field.model
this.$http.get(`/${model.replace('.','/')}/`).then(({data}) => {
this.options = data.results
})
}
},
computed: {
columns () {
return this.options.map(a => a.name || a.title)
}
}
}
</script>

0 comments on commit 929d8fa

Please sign in to comment.