add dayjs plugin

This commit is contained in:
AceDataCloud committed 2021-09-19 22:18:26 +08:00
1 parent 57b44f1d28
commit 74f62354a2
7 files changed
+49 -2

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
import dayjs from 'dayjs';
import { App } from 'vue';
export interface IDayJS {
format: (v: string, formatString?: string) => string;
}
interface IOptions {
formatString: string;
}
export default {
install: (app: App, options: IOptions) => {
app.config.globalProperties.$dayjs = {
format(v: string, formatString: string = '') {
return dayjs(v).format(formatString || options.formatString);
}
};
}
};
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
$dayjs: IDayJS;
}
}