app-timer.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. :themeColor="'#3385ff'">
  15. </w-picker>
  16. </tui-list-cell>
  17. </view>
  18. </template>
  19. <script>
  20. import Wpicker from '@/components/w-picker/w-picker.vue'
  21. import TuiListCell from "@/components/plugin/list-cell";
  22. export default{
  23. components: {
  24. Wpicker,
  25. TuiListCell
  26. },
  27. props: {
  28. timeLabel: {
  29. type: String,
  30. default: "配送时间"
  31. },
  32. placeholder: {
  33. type: String,
  34. default: "请选择具体时间"
  35. },
  36. sendTime: {
  37. type: String,
  38. default: ""
  39. },
  40. },
  41. data() {
  42. return {
  43. timeVisible: false,
  44. value: ''
  45. }
  46. },
  47. watch: {
  48. sendTime(val) {
  49. if (val) {
  50. this.value = val
  51. }
  52. }
  53. },
  54. methods: {
  55. onConfirm(val) {
  56. this.$emit('confirm', val.result)
  57. },
  58. onCancel() {
  59. this.timeVisible = false
  60. this.$emit('cancel')
  61. }
  62. }
  63. }
  64. </script>