add dayjs plugin
This commit is contained in:
1 parent
57b44f1d28
commit
74f62354a2
7 files changed
+49
-2
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user