time1.js 908 B

1234567891011121314151617181920212223242526272829303132333435
  1. var Main = {
  2. data() {
  3. return {
  4. pickerOptions: {
  5. disabledDate(time) {
  6. return time.getTime() > Date.now();
  7. },
  8. shortcuts: [{
  9. text: '今天',
  10. onClick(picker) {
  11. picker.$emit('pick', new Date());
  12. }
  13. }, {
  14. text: '昨天',
  15. onClick(picker) {
  16. const date = new Date();
  17. date.setTime(date.getTime() - 3600 * 1000 * 24);
  18. picker.$emit('pick', date);
  19. }
  20. }, {
  21. text: '一周前',
  22. onClick(picker) {
  23. const date = new Date();
  24. date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
  25. picker.$emit('pick', date);
  26. }
  27. }]
  28. },
  29. value1: '',
  30. value2: '',
  31. };
  32. }
  33. };
  34. var Ctor = Vue.extend(Main)
  35. new Ctor().$mount('#app')