Browse Source

优化日期组件

master
LiLongLong 3 months ago
parent
commit
616959150d
  1. 6
      src/pages/Index/Settings/Device.vue

6
src/pages/Index/Settings/Device.vue

@ -5,6 +5,7 @@
<el-date-picker <el-date-picker
class="date-input" class="date-input"
v-model="time" v-model="time"
:key="pickerKey"
type="datetime" type="datetime"
placeholder="修改日期与时间" placeholder="修改日期与时间"
format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"
@ -233,6 +234,7 @@ const settings = ref<Settings>({
// //
const currentDate = ref(new Date()) const currentDate = ref(new Date())
const time = ref('00:00:00') const time = ref('00:00:00')
let pickerKey = ref(0)
// const dateFormats = ['MM.dd.yyyy', 'dd.MM.yyyy', 'yyyy.MM.dd'] // const dateFormats = ['MM.dd.yyyy', 'dd.MM.yyyy', 'yyyy.MM.dd']
// const selectedDateFormat = ref(dateFormats[2]) // const selectedDateFormat = ref(dateFormats[2])
@ -294,6 +296,8 @@ const updateSetting = async (key: string, value: any) => {
// //
clearInterval(intervalId.value) clearInterval(intervalId.value)
res = await setDateAndTime(value) res = await setDateAndTime(value)
//KEYdate-pickerfocus
pickerKey.value = new Date().getTime()
// //
startTimer() startTimer()
break break
@ -482,7 +486,7 @@ const resumeTimer = () => {
<style scoped lang="less"> <style scoped lang="less">
.device-management { .device-management {
width: 100%; width: 100%;
height: 87vh;
height: 91.5vh;
padding: 20px; padding: 20px;
box-sizing: border-box; box-sizing: border-box;
background-color: #f5f7fa; background-color: #f5f7fa;

Loading…
Cancel
Save