element-admin中使用el-date-picker


pickerOptions: {
        shortcuts: [{
          text: '当天',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime());
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '最近一周',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '最近一个月',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '最近一年',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 365);
            picker.$emit('pick', [start, end]);
          }
        }]
      },

value-format="yyyy-MM-dd HH:mm:ss"不能少,否则传递的时间不正确

使用:picker-options="pickerOptions",不要使用:shortcuts="shortcuts",后者没有效果,因为element-admin中vue的版本低

你可能感兴趣的:(web前端,git,gitee,python,前端)