app-timer.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <view>
  3. <tui-list-cell class="line-cell" :hover="false" :arrow="true" @click="timeVisible = true">
  4. <div class="tui-title">{{ timeLabel }}</div>
  5. <div v-if="sendTime" class="tui-placeholder" style="color:#333;">{{value}}</div>
  6. <div class="tui-placeholder" v-else>{{ placeholder }}</div>
  7. <w-picker
  8. :visible.sync="timeVisible"
  9. mode="time"
  10. :current="true"
  11. :second="false"
  12. @confirm="onConfirm"
  13. @cancel="onCancel">
  14. </w-picker>
  15. </tui-list-cell>
  16. </view>
  17. </template>
  18. <script>
  19. import Wpicker from '@/components/w-picker/w-picker.vue'
  20. import TuiListCell from "@/components/plugin/list-cell";
  21. export default{
  22. components: {
  23. Wpicker,
  24. TuiListCell
  25. },
  26. props: {
  27. timeLabel: {
  28. type: String,
  29. default: "发单时间"
  30. },
  31. placeholder: {
  32. type: String,
  33. default: "默认立即发单"
  34. },
  35. sendTime: {
  36. type: String,
  37. default: ""
  38. },
  39. },
  40. data() {
  41. return {
  42. timeVisible: false,
  43. value: ''
  44. }
  45. },
  46. watch: {
  47. sendTime(val) {
  48. if (val) {
  49. this.value = val
  50. }
  51. }
  52. },
  53. methods: {
  54. onConfirm(val) {
  55. this.$emit('confirm', val.result)
  56. },
  57. onCancel() {
  58. this.timeVisible = false
  59. this.$emit('cancel')
  60. }
  61. }
  62. }
  63. </script>