timeyear.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <view class="alldata flexc">
  3. <!-- :start="startDate" :end="endDate" -->
  4. <picker mode="date" class="flexc" :value="date" @change="bindDateChange" :fields="fields">
  5. <view class="alldatain f15 cofe f500" :style="'text-align:'+textAlign">{{date||timetxt}}</view>
  6. </picker>
  7. <image :src="upimg"></image>
  8. </view>
  9. </template>
  10. <script>
  11. export default{
  12. props:{
  13. textAlign:{
  14. type: String,
  15. default () {
  16. return 'left'
  17. }
  18. },
  19. fields:{
  20. type: String,
  21. default () {
  22. return 'year'
  23. }
  24. },
  25. timetxt:{
  26. type: String,
  27. default () {
  28. return '选择年份'
  29. }
  30. },
  31. timedate:{
  32. type: String,
  33. default () {
  34. return ''
  35. }
  36. }
  37. },
  38. data(){
  39. return{
  40. upimg:require("@/static/images/index/up.png"),
  41. date:''
  42. }
  43. },
  44. mounted() {
  45. if(this.timedate){
  46. this.date=this.timedate;
  47. }
  48. },
  49. methods:{
  50. bindDateChange(e){
  51. var val=e.detail.value
  52. this.date=e.detail.value;
  53. this.$emit("bindDateChange",val)
  54. }
  55. }
  56. }
  57. </script>
  58. <style lang="scss" scoped>
  59. // 选择年份
  60. .alldata{padding: 20rpx;height: 80rpx;box-sizing: border-box;
  61. image{width: 22rpx;height: 16rpx;margin-left: 14rpx;}
  62. .alldatain{min-width: 124rpx;}
  63. }
  64. </style>