From e8e74b639c94864d603822f7be8f6a5df1983f55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Fri, 4 Nov 2022 14:35:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96datepicker=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/public/js/components/common/datepicker.js | 7 +++++++ web/public/js/utils.js | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/web/public/js/components/common/datepicker.js b/web/public/js/components/common/datepicker.js index bc8b4095..9ed59ee1 100644 --- a/web/public/js/components/common/datepicker.js +++ b/web/public/js/components/common/datepicker.js @@ -38,6 +38,13 @@ Vue.component("datepicker", { watch: { value: function (v) { this.day = v + + let picker = this.$refs.dayInput.picker + if (picker != null) { + if (v != null && /^\d+-\d+-\d+$/.test(v)) { + picker.setDate(v) + } + } } }, methods: { diff --git a/web/public/js/utils.js b/web/public/js/utils.js index 25d25425..5605bdd7 100644 --- a/web/public/js/utils.js +++ b/web/public/js/utils.js @@ -85,7 +85,6 @@ window.teaweb = { return } - if (typeof (element) == "string") { element = document.getElementById(element); } @@ -112,6 +111,8 @@ window.teaweb = { }, reposition: !bottomLeft }) + + element.picker = picker }, formatBytes: function (bytes) { bytes = Math.ceil(bytes);