zhangdaiscott 2022-09-27 19:31:09 +08:00
parent efb850693e
commit ee0432fc09
3 changed files with 8 additions and 11 deletions

View File

@ -42,6 +42,7 @@
const [register, { closeModal }] = useModalInner(); const [register, { closeModal }] = useModalInner();
const [registerForm, { validateFields, resetFields }] = useForm({ const [registerForm, { validateFields, resetFields }] = useForm({
labelWidth: 100,
showActionButtonGroup: false, showActionButtonGroup: false,
schemas: [ schemas: [
{ {

View File

@ -3,15 +3,14 @@
*/ */
import dayjs from 'dayjs'; import dayjs from 'dayjs';
const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm'; const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss';
const DATE_FORMAT = 'YYYY-MM-DD'; const DATE_FORMAT = 'YYYY-MM-DD';
//TODO dayjs.ConfigType不知是否用对 export function formatToDateTime(date: dayjs.Dayjs | undefined = undefined, format = DATE_TIME_FORMAT): string {
export function formatToDateTime(date: dayjs.ConfigType = undefined, format = DATE_TIME_FORMAT): string {
return dayjs(date).format(format); return dayjs(date).format(format);
} }
export function formatToDate(date: dayjs.ConfigType = undefined, format = DATE_FORMAT): string { export function formatToDate(date: dayjs.Dayjs | undefined = undefined, format = DATE_FORMAT): string {
return dayjs(date).format(format); return dayjs(date).format(format);
} }

View File

@ -1,11 +1,8 @@
import { dateUtil } from '/@/utils/dateUtil'; import { dateUtil } from '/@/utils/dateUtil';
import { reactive, toRefs } from 'vue'; import { reactive, toRefs } from 'vue';
import { useLocaleStore } from '/@/store/modules/locale';
import { tryOnMounted, tryOnUnmounted } from '@vueuse/core'; import { tryOnMounted, tryOnUnmounted } from '@vueuse/core';
export function useNow(immediate = true) { export function useNow(immediate = true) {
const localeStore = useLocaleStore();
const localData = dateUtil.localeData(localeStore.getLocale);
let timer: IntervalHandle; let timer: IntervalHandle;
const state = reactive({ const state = reactive({
@ -28,13 +25,13 @@ export function useNow(immediate = true) {
state.year = now.get('y'); state.year = now.get('y');
state.month = now.get('M') + 1; state.month = now.get('M') + 1;
state.week = localData.weekdays()[now.day()]; state.week = '星期' + ['日', '一', '二', '三', '四', '五', '六'][now.day()];
state.day = now.get('D'); state.day = now.get('date');
state.hour = h; state.hour = h;
state.minute = m; state.minute = m;
state.second = s; state.second = s;
state.meridiem = localData.meridiem(Number(h), Number(h), true); state.meridiem = now.format('A');
}; };
function start() { function start() {