Skip to content

Commit 3509ebe

Browse files
committed
fix: mock plugin error #171
1 parent 8bd20c6 commit 3509ebe

File tree

14 files changed

+54
-78
lines changed

14 files changed

+54
-78
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ indent_size = 2
1313

1414
[*.md]
1515
trim_trailing_whitespace = false
16+
17+
[Makefile]
18+
indent_style = tab

.env.production

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
VITE_USE_MOCK = true
33

44
# public path
5-
VITE_PUBLIC_PATH = ./
5+
VITE_PUBLIC_PATH = /
66

77
# Delete console
88
VITE_DROP_CONSOLE = true
99

1010
# Whether to output gz file for packaging
11-
VITE_BUILD_GZIP = true
11+
VITE_BUILD_GZIP = false
1212

1313
# Basic interface address SPA
1414
VITE_GLOB_API_URL=/api

build/script/hackXlsx.ts

Lines changed: 0 additions & 17 deletions
This file was deleted.

build/vite/optimizer.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import type { GetManualChunk, GetManualChunkApi } from 'rollup';
22

33
//
44
const vendorLibs: { match: string[]; output: string }[] = [
5-
{
6-
match: ['xlsx'],
7-
output: 'xlsx',
8-
},
5+
// {
6+
// match: ['xlsx'],
7+
// output: 'xlsx',
8+
// },
99
];
1010

1111
// @ts-ignore

build/vite/plugin/gzip.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import gzipPlugin from 'rollup-plugin-gzip';
22
import { isBuildGzip } from '../../utils';
33
import { Plugin } from 'vite';
44
export function configGzipPlugin(isBuild: boolean): Plugin | Plugin[] {
5-
const useGzip = isBuild && isBuildGzip;
5+
const useGzip = isBuild && isBuildGzip();
66

77
if (useGzip) {
88
return gzipPlugin();

package.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vben-admin",
3-
"version": "2.0.0-rc.16",
3+
"version": "2.0.0-rc.15",
44
"scripts": {
55
"bootstrap": "yarn install",
66
"serve": "vite",
@@ -15,9 +15,7 @@
1515
"lint:eslint": "eslint --fix --ext \"src/**/*.{vue,less,css,scss}\"",
1616
"lint:prettier": "prettier --write --loglevel warn \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"",
1717
"lint:stylelint": "stylelint --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
18-
"reinstall": "rimraf yarn.lock && rimraf package.lock.json && rimraf node_modules && npm run bootstrap",
19-
"hack-esm:xlsx": "esno ./build/script/hackXlsx",
20-
"postinstall": "npm run hack-esm:xlsx"
18+
"reinstall": "rimraf yarn.lock && rimraf package.lock.json && rimraf node_modules && npm run bootstrap"
2119
},
2220
"dependencies": {
2321
"@iconify/iconify": "^2.0.0-rc.5",
@@ -98,11 +96,11 @@
9896
"stylelint-order": "^4.1.0",
9997
"ts-node": "^9.1.0",
10098
"typescript": "^4.1.3",
101-
"vite": "^2.0.0-beta.19",
99+
"vite": "^2.0.0-beta.21",
102100
"vite-plugin-html": "^2.0.0-beta.5",
103-
"vite-plugin-mock": "^2.0.0-beta.1",
101+
"vite-plugin-mock": "^2.0.0-beta.3",
104102
"vite-plugin-purge-icons": "^0.5.0",
105-
"vite-plugin-pwa": "^0.3.3",
103+
"vite-plugin-pwa": "^0.3.5",
106104
"vue-eslint-parser": "^7.3.0",
107105
"yargs": "^16.2.0"
108106
},

src/components/Form/src/BasicForm.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
import FormAction from './components/FormAction.vue';
4242
4343
import { dateItemType } from './helper';
44-
import moment from 'moment';
44+
import { dateUtil } from '/@/utils/dateUtil';
45+
4546
// import { cloneDeep } from 'lodash-es';
4647
import { deepMerge } from '/@/utils';
4748
@@ -108,11 +109,11 @@
108109
// handle date type
109110
if (defaultValue && dateItemType.includes(component)) {
110111
if (!Array.isArray(defaultValue)) {
111-
schema.defaultValue = moment(defaultValue);
112+
schema.defaultValue = dateUtil(defaultValue);
112113
} else {
113114
const def: moment.Moment[] = [];
114115
defaultValue.forEach((item) => {
115-
def.push(moment(item));
116+
def.push(dateUtil(item));
116117
});
117118
schema.defaultValue = def;
118119
}

src/components/Form/src/hooks/useFormEvents.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { unref, toRaw } from 'vue';
77
import { isArray, isFunction, isObject, isString } from '/@/utils/is';
88
import { deepMerge, unique } from '/@/utils';
99
import { dateItemType, handleInputNumberValue } from '../helper';
10-
import moment from 'moment';
10+
import { dateUtil } from '/@/utils/dateUtil';
1111
import { cloneDeep } from 'lodash-es';
1212
import { error } from '/@/utils/log';
1313

@@ -67,11 +67,11 @@ export function useFormEvents({
6767
if (Array.isArray(value)) {
6868
const arr: moment.Moment[] = [];
6969
for (const ele of value) {
70-
arr.push(moment(ele));
70+
arr.push(dateUtil(ele));
7171
}
7272
formModel[key] = arr;
7373
} else {
74-
formModel[key] = moment(value);
74+
formModel[key] = dateUtil(value);
7575
}
7676
} else {
7777
formModel[key] = value;

src/components/Form/src/hooks/useFormValues.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { isArray, isFunction, isObject, isString } from '/@/utils/is';
2-
import moment from 'moment';
2+
import { dateUtil } from '/@/utils/dateUtil';
3+
34
import { unref, nextTick } from 'vue';
45
import type { Ref, ComputedRef } from 'vue';
56
import type { FieldMapToTime, FormSchema } from '../types/form';
@@ -65,8 +66,8 @@ export function useFormValues({
6566

6667
const [startTime, endTime]: string[] = values[field];
6768

68-
values[startTimeKey] = moment(startTime).format(format);
69-
values[endTimeKey] = moment(endTime).format(format);
69+
values[startTimeKey] = dateUtil(startTime).format(format);
70+
values[endTimeKey] = dateUtil(endTime).format(format);
7071
Reflect.deleteProperty(values, field);
7172
}
7273

src/locales/setupI18n.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import type { I18n, I18nOptions } from 'vue-i18n';
33

44
import { createI18n } from 'vue-i18n';
55

6-
import 'moment/dist/locale/zh-cn';
7-
86
import projectSetting from '/@/settings/projectSetting';
97

108
import messages from './getMessage';

0 commit comments

Comments
 (0)