Commit fab95a52 authored by leon's avatar leon

feat: datepicker config

parent c91b002e
......@@ -10,7 +10,7 @@
:select-open="show"
:border="true"
:borderColor="elementInfo.option.dateTime.borderColor"
:custom-style="{ color: elementInfo.option.dateTime.color }"
:custom-style="{ color: elementInfo.option.dateTime.color, fontSize: `${elementInfo.option.dateTime.fontSize}px` }"
@click="show = true"
></u-input>
<u-icon
......@@ -61,7 +61,22 @@ export default {
}
},
mounted() {
let { date } = this.elementInfo.option.dateTime
let { date, isDefault, defaultDate } = this.elementInfo.option.dateTime
if(isDefault) {
const today = new Date()
if(defaultDate === 'today') {
}
if(defaultDate === 'yesterday') {
const timestamp = today.getTime() - 1000 * 24 * 60 * 60
today.setTime(timestamp)
}
if(defaultDate === 'week') {
const timestamp = today.getTime() - 1000 * 24 * 60 * 60 * 6
today.setTime(timestamp)
}
this.pickerValue = this.dateTimeFormat(today)
return
}
if (date) this.pickerValue = this.dateTimeFormat(date)
},
methods: {
......
......@@ -158,7 +158,6 @@ const install = (Vue, vm) => {
const day = () => {
const date = new Date();
const day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
return day
}
......@@ -177,7 +176,6 @@ const install = (Vue, vm) => {
const date = new Date()
const timestamp = date.getTime() - 1000 * 24 * 60 * 60
date.setTime(timestamp)
console.log(date)
const year = date.getFullYear();
// 在日期格式中,月份是从0开始的,因此要加0,使用三元表达式在小于10的前面加0,以达到格式统一 如 09:11:05
const month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment