signal-source.js 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. Vue.component('signal-source', {
  2. template:
  3. '<div><div class="c-f16 c-border-b pb5">号&emsp;&emsp;源</div>\
  4. <ul class="clearfix pl40">\
  5. <li v-for="(list, index) in detailtime" class="fl mr30 mb20" >\
  6. <a v-show="list.max - list.used > 0" class="fc-12b7f5 bd1 h38" title="预约时间段" @click="looking(list)">{{handleTime(list.startTime)}}&nbsp;-&nbsp;{{handleTime(list.endTime)}}</a>\
  7. <a v-show="list.max - list.used <= 0" class="fc-fff bgc-d7dce6 bd1 h38">{{handleTime(list.startTime)}}&nbsp;-&nbsp;{{handleTime(list.endTime)}}</a>\
  8. </li>\
  9. </ul>\
  10. </div>',
  11. props: ['detailtime'],
  12. data: function () {
  13. return {}
  14. },
  15. mounted: function () {},
  16. methods: {
  17. looking: function (list) {
  18. this.$emit('booking', list)
  19. },
  20. handleTime: function (data) {
  21. var time = data.split(' ')[1],
  22. str = this.add0(time.split(':')[0]) + ':' + time.split(':')[1]
  23. return str
  24. },
  25. add0: function (num) {
  26. if (num < 10) {
  27. return '0' + num
  28. }
  29. return num
  30. }
  31. }
  32. })