1/* 2 * Copyright (c) 2022-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15import { TOPRECTHEIGHT, BOTTOMRECTHEIGHT } from '../../../../util/AttributeData'; 16 17export default { 18 data() { 19 return { 20 datePickerTitle: '', 21 dateValue: '2022-10-22', 22 dateSelected: '2022-10-22', 23 // 防止沉浸,添加两个变量距离顶层和底层的距离为72 24 topRectHeight: TOPRECTHEIGHT, 25 bottomRectHeight: BOTTOMRECTHEIGHT 26 } 27 }, 28 29 onInit() { 30 this.datePickerTitle = this.$t('strings.date_picker_title') 31 }, 32 33 changeDate(dateObj) { 34 if (dateObj) { 35 var month = `${Number(dateObj.month + 1)}` 36 var day = `${Number(dateObj.day)}` 37 if (Number(dateObj.month) < 9) { 38 month = `0${Number(dateObj.month) + 1}` 39 } 40 if (Number(dateObj.day) < 10) { 41 day = `0${Number(dateObj.day)}` 42 } 43 if (dateObj.month) 44 this.dateValue = dateObj.year + "-" + month + "-" + day 45 } 46 }, 47}