forked from github/dataease
Merge pull request #1483 from dataease/pr@dev@feat_时间组件增加时间格式
feat: 时间组件增加时间格式'无'
This commit is contained in:
commit
342b797871
@ -97,7 +97,8 @@ export default {
|
||||
timeOptions: [
|
||||
|
||||
{ value: 'hh:mm:ss', label: 'hh:mm:ss' },
|
||||
{ value: 'hh时mm分ss秒', label: 'hh时mm分ss秒' }
|
||||
{ value: 'hh时mm分ss秒', label: 'hh时mm分ss秒' },
|
||||
{ value: '', label: '无' }
|
||||
],
|
||||
dateOptions: [
|
||||
{ value: 'yyyy-MM-dd', label: 'yyyy-MM-dd' },
|
||||
|
@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<div style="height: 100%">
|
||||
<time-default v-if="element.formatInfo.openMode === '0'" :ref="element.id" :element="element" />
|
||||
<time-default v-if="element.formatInfo.openMode === '0'" :ref="element.id" :element="element" />
|
||||
|
||||
<time-elec v-if="element.formatInfo.openMode === '1'" :ref="element.id" :element="element" />
|
||||
<time-elec v-if="element.formatInfo.openMode === '1'" :ref="element.id" :element="element" />
|
||||
|
||||
<time-simple v-if="element.formatInfo.openMode === '2'" :ref="element.id" :element="element" />
|
||||
<time-simple v-if="element.formatInfo.openMode === '2'" :ref="element.id" :element="element" />
|
||||
|
||||
<time-complex v-if="element.formatInfo.openMode === '3'" :ref="element.id" :element="element" />
|
||||
<time-complex v-if="element.formatInfo.openMode === '3'" :ref="element.id" :element="element" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -44,7 +44,7 @@ export default {
|
||||
},
|
||||
formatDate() {
|
||||
const weekArr = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
|
||||
let timeFormat = this.element.formatInfo.timeFormat || 'hh:mm:ss'
|
||||
let timeFormat = this.element.formatInfo.timeFormat
|
||||
const showWeek = this.element.formatInfo.showWeek
|
||||
const showDate = this.element.formatInfo.showDate
|
||||
const dateFormat = this.element.formatInfo.dateFormat || 'yyyy-MM-dd'
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div id="clock" :style="{'--varBg': varBg}">
|
||||
<p class="date">{{ date }}</p>
|
||||
<p class="time" :style="{'fontSize': (parseInt(element.style.fontSize) * 3) + 'px'}">{{ time }}</p>
|
||||
<p v-if="time" class="time" :style="{'fontSize': (parseInt(element.style.fontSize) * 3) + 'px'}">{{ time }}</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -66,7 +66,7 @@ export default {
|
||||
},
|
||||
updateTime() {
|
||||
var cd = new Date()
|
||||
const timeFormat = this.element.formatInfo.timeFormat || 'hh:mm:ss'
|
||||
const timeFormat = this.element.formatInfo.timeFormat
|
||||
const showWeek = this.element.formatInfo.showWeek
|
||||
const showDate = this.element.formatInfo.showDate
|
||||
const dateFormat = this.element.formatInfo.dateFormat || 'yyyy-MM-dd'
|
||||
@ -75,8 +75,12 @@ export default {
|
||||
nowDate = cd.format(dateFormat)
|
||||
}
|
||||
const nowWeek = this.week[cd.getDay()]
|
||||
if (timeFormat) {
|
||||
this.time = cd.format(timeFormat)
|
||||
} else {
|
||||
this.time = null
|
||||
}
|
||||
|
||||
this.time = cd.format(timeFormat)
|
||||
this.date = showWeek ? (nowDate + ' ' + nowWeek) : nowDate
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ export default {
|
||||
this.timer = setInterval(this.canvass, 500)
|
||||
},
|
||||
canvass() {
|
||||
const timeFormat = this.element.formatInfo.timeFormat || 'hh:mm:ss'
|
||||
const timeFormat = this.element.formatInfo.timeFormat
|
||||
const dateFormat = this.element.formatInfo.dateFormat || 'yyyy-MM-dd'
|
||||
const showWeek = this.element.formatInfo.showWeek
|
||||
const showDate = this.element.formatInfo.showDate
|
||||
@ -110,8 +110,10 @@ export default {
|
||||
} else {
|
||||
englishWeek = 'Saturday'
|
||||
}
|
||||
|
||||
const simpleTime = time.format(timeFormat)
|
||||
let simpleTime = ''
|
||||
if (timeFormat) {
|
||||
simpleTime = time.format(timeFormat)
|
||||
}
|
||||
let nowDate = ''
|
||||
if (showDate && dateFormat) {
|
||||
nowDate = time.format(dateFormat)
|
||||
|
Loading…
Reference in New Issue
Block a user