DateTimeExample.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <div>
  3. <h1>日期时间控件</h1>
  4. <h2>基本表单</h2>
  5. <div>
  6. <div class="form-group">
  7. <label for="datetime">日期时间</label>
  8. <DateTime :dateValue="dateValue1"
  9. v-on:on-value-change="dateValue1 = $event"></DateTime>
  10. </div>
  11. </div>
  12. {{ dateValue1 }}
  13. <h2>内联表单</h2>
  14. <div class="form-inline">
  15. <div class="form-group">
  16. <label class="control-label"
  17. for="inputGroupSuccess3">日期时间</label>
  18. <DateTime :dateValue="dateValue2"
  19. v-on:on-value-change="dateValue2 = $event"></DateTime>
  20. </div>
  21. </div>
  22. {{ dateValue2 }}
  23. <h2>只读</h2>
  24. <div class="form-inline">
  25. <div class="form-group">
  26. <label class="control-label"
  27. for="inputGroupSuccess3">日期时间</label>
  28. <DateTime :dateValue="dateValue3"
  29. :readonly="true"></DateTime>
  30. </div>
  31. </div>
  32. {{ dateValue3 }}
  33. </div>
  34. </template>
  35. <script>
  36. import DateTime from "@/datetime/index.js";
  37. export default {
  38. name: 'date-example',
  39. data: function () {
  40. return {
  41. dateValue1: '2021-10-09 12:00:01',
  42. dateValue2: '2021-10-09 14:02:00',
  43. dateValue3: '2022-10-09 14:02:00',
  44. }
  45. },
  46. components: {
  47. DateTime,
  48. },
  49. methods: {
  50. }
  51. }
  52. </script>
  53. <style>
  54. </style>