文件操作 - AppDatepicker.vue
返回文件管理
返回主菜单
删除本文件
文件: /var/www/app.ltlcompare.com/components/AppDatepicker.vue
编辑文件内容
<script setup lang="ts"> import VueDatePicker, { type VueDatePickerProps } from '@vuepic/vue-datepicker'; import '@vuepic/vue-datepicker/dist/main.css'; const { locale } = useI18n(); const { resetInvalid } = useForm(); interface Props extends VueDatePickerProps { title?: string; placeholder?: string; required?: boolean; errorText?: string; disabledSelectMinutes?: boolean; } const props = withDefaults(defineProps<Props>(), { autoPosition: () => true, autoApply: () => true, minDate: () => new Date(), format: () => 'MM/dd/yyyy', noToday: () => true, yearRange: () => { const year = new Date().getFullYear(); return [year, year + 1]; }, }); const model = defineModel<string | Date>(); </script> <template> <div class="form-block form-block-datepicker"> <div v-if="title" class="form-block-title" > {{ title }} </div> <div class="input-block"> <VueDatePicker ref="dp" v-bind="{ ...props, locale, model }" @update:model-value="(value: string | Date) => (model = value)" > <template #dp-input="{ value }"> <AppIcon name="сalendar" class="input-icon" ></AppIcon> <input type="text" class="input datepicker-input" :value="value" @focus="resetInvalid($event.currentTarget as HTMLInputElement)" readonly :placeholder="placeholder" :required="required" /> <AppIcon name="сalendar" class="datepicker-input-icon" ></AppIcon> </template> </VueDatePicker> </div> <div v-if="required || errorText" class="input-error" > {{ errorText || $t('app.input.error') }} </div> </div> </template> <style lang="less"> .datepicker-input { padding: 0 50px; cursor: pointer; user-select: none; } .datepicker-input-icon { position: absolute; color: #a6a6a6; --size: 22px; right: 16px; top: calc(0.5 * var(--input-height) - 11px); z-index: 1; pointer-events: none; } </style>
修改文件时间
将文件时间修改为当前时间的前一年
删除文件