<template> <div> <mt-picker :slots="slots" @change="onValuesChange" :visible-item-count="1"></mt-picker> <router-view></router-view> </div> </template> <script> export default { name: 'app', data () { return { value:'', slots: [ { values: ['年假', '事假', '病假', '婚假', '其他', '婚假'] } ], } }, mounted:function(){ }, methods: { onValuesChange(picker, values) { this.value = values[0]; console.log(this.value) } } } </script> <style> </style>
show:
使用了:visible-item-count="1"之后,picker的可显示个数就变成了1个