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

+1
View File
@@ -9,6 +9,7 @@
"dependencies": {
"@element-plus/icons": "^0.0.11",
"axios": "^0.21.1",
"dayjs": "^1.10.7",
"diff-match-patch": "^1.0.5",
"element-plus": "^1.1.0-beta.7",
"eslint": "^7.32.0",
Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 17 KiB

+11 -1
View File
@@ -6,5 +6,15 @@ import ElementPlus from 'element-plus';
import i18n from './i18n/index';
import './assets/css/tailwind.css';
import './assets/scss/style.scss';
import dayjs from './plugins/dayjs';
createApp(App).use(router).use(store).use(ElementPlus).use(i18n).mount('#app');
const app = createApp(App);
app.use(router);
app.use(store);
app.use(ElementPlus);
app.use(i18n);
app.use(dayjs, {
formatString: 'YYYY-MM-DD HH:mm:ss'
});
app.mount('#app');
+5 -1
View File
@@ -11,7 +11,11 @@
>
<el-table :data="items" v-loading="loading">
<el-table-column prop="title" :label="$t('common.entity.title')"> </el-table-column>
<el-table-column prop="updated_at" :label="$t('common.entity.updatedAt')"> </el-table-column>
<el-table-column prop="updated_at" :label="$t('common.entity.updatedAt')">
<template #default="scope">
{{ $dayjs.format(scope.row.updated_at) }}
</template>
</el-table-column>
<el-table-column :label="$t('common.entity.operation')">
<template #default="scope">
<el-button @click="onEdit(scope.row)" round type="primary" size="mini">
+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;
}
}
+1
View File
@@ -1 +1,2 @@
export const DEFAULT_LIMIT = 10;
export const DATE_FORMAT = 'yyyy-MM-dd HH:mm:ss';
+5
View File
@@ -731,6 +731,11 @@ dayjs@1.x:
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.10.6.tgz#288b2aa82f2d8418a6c9d4df5898c0737ad02a63"
integrity sha512-AztC/IOW4L1Q41A86phW5Thhcrco3xuAA+YX/BLpLWWjRcTj5TOt/QImBLmCKlrF7u7k47arTnOyL6GnbG8Hvw==
dayjs@^1.10.7:
version "1.10.7"
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.10.7.tgz#2cf5f91add28116748440866a0a1d26f3a6ce468"
integrity sha512-P6twpd70BcPK34K26uJ1KT3wlhpuOAPoMwJzpsIWUxHZ7wpmbdZL/hQqBDfz7hGurYSa5PhzdhDHtt319hL3ig==
debug@^4.0.1, debug@^4.1.1:
version "4.3.2"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b"