half.vue 709 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <template>
  2. <view>
  3. <view class="item" @tap="halfVisible=true">上下午</view>
  4. <view class="result">选择结果:{{result.result}}</view>
  5. <w-picker
  6. :visible.sync="halfVisible"
  7. mode="half"
  8. startYear="2017"
  9. endYear="2030"
  10. value="2018-02-11 下午"
  11. :current="true"
  12. @confirm="onConfirm($event,'half')"
  13. @cancel="onCancel"
  14. :disabled-after="false"
  15. ref="half"
  16. ></w-picker>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. data() {
  22. return {
  23. halfVisible:false,
  24. result:{
  25. result:""
  26. }
  27. };
  28. },
  29. methods:{
  30. onConfirm(res,type){
  31. this.result=res;
  32. console.log(res)
  33. },
  34. onCancel(){
  35. }
  36. }
  37. }
  38. </script>
  39. <style lang="scss">
  40. </style>