From 2d445a7f255343099b4647ea5ce51d2980768003 Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Thu, 28 Sep 2023 16:45:41 +0800
Subject: [PATCH] fix:立行立改
---
src/components/Form/HourPicker1.vue | 60 ++++++++++++++++++++++++++++++++++++++----------------------
1 files changed, 38 insertions(+), 22 deletions(-)
diff --git a/src/components/Form/HourPicker1.vue b/src/components/Form/HourPicker1.vue
index 3d64e4f..d740441 100644
--- a/src/components/Form/HourPicker1.vue
+++ b/src/components/Form/HourPicker1.vue
@@ -5,17 +5,16 @@
placeholder="������������"
value-format="yyyy-MM-dd"
/> -->
- <el-time-picker
- is-range
+ <el-date-picker
v-model="value1"
+ type="datetimerange"
range-separator="���"
- start-placeholder="������������"
- end-placeholder="������������"
- placeholder="������������������"
- size="inputSize"
- value-format="yyyy-MM-dd HH"
+ start-placeholder="������������"
+ value-format="yyyy-MM-dd HH:mm:ss"
+ end-placeholder="������������"
+ :picker-options="pickerOptions"
>
- </el-time-picker>
+ </el-date-picker>
</template>
<script>
@@ -23,16 +22,37 @@
// ���������import������������������from'������������������';
export default {
-// import ���������������������������������������������������
+ // import ���������������������������������������������������
components: {},
props: {
- value1: String
+ // value1: String
},
data() {
// ������������������
return {
// newValue1: ''
- newValue1: ''
+ value1: '',
+ timeOne: '',
+ pickerOptions: {
+ onPick: ({ maxDate, minDate }) => {
+
+ // ������������ ������������
+ this.timeOne = minDate.getTime() // ��������������������� ������������������
+ // // ������������������������������������������������������������
+ ��if (maxDate) this.timeOne = ''
+
+ },
+ disabledDate: time => {
+ if (this.timeOne) {
+ const WEEK = 7 * 24 * 3600 * 1000 - 1 // ������������6��������� ������7���������
+ const minTime = this.timeOne // ������������
+ const maxTime = this.timeOne + WEEK // ������������
+ return time.getTime() < minTime || time.getTime() > maxTime || time.getTime() > new Date()
+ } else {
+ return time.getTime() > new Date()
+ }
+ }
+ },
}
},
// ������������ ���������data������
@@ -40,18 +60,15 @@
// ������data������������������
watch: {
value1(nv, ov) {
- this.newValue1 = nv
+ // this.newValue1 = nv
this.sendPicker()
- }
+ },
},
// ������������ - ��������������������������������� this ���������
- created() {
-
- },
+ created() {},
// ������������ - ��������������������������� DOM ���������
- mounted() {
+ mounted() {},
- },
beforeCreate() {}, // ������������ - ������������
beforeMount() {}, // ������������ - ������������
beforeUpdate() {}, // ������������ - ������������
@@ -62,11 +79,10 @@
// ������������
methods: {
sendPicker() {
- this.$emit('sendPickerChild', this.newValue1)
- }
- } // ���������������keep-alive������������������������������������
+ this.$emit('sendPickerChild', this.value1)
+ },
+ }, // ���������������keep-alive������������������������������������
}
</script>
<style scoped>
-
</style>
--
Gitblit v1.8.0