Skip to content

Commit 2407b33

Browse files
committed
fix: some error
1 parent 9abf176 commit 2407b33

File tree

28 files changed

+359
-101
lines changed

28 files changed

+359
-101
lines changed

CHANGELOG.zh_CN.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@
2222
- 添加部分注释
2323
- pwa 图标补充
2424
- types 类型调整
25+
- 升级`ant-design-vue``beta.11`,并修改带来的已知问题
2526

2627
### 🐛 Bug Fixes
2728

2829
- 修复本地代理 post 接口到 https 地址超时错误
2930
- 修复 modal 在不显示 footer 的时候全屏高度计算问题
3031
- 修复表单重置未删除校验信息错误
32+
- 修复顶部菜单分割模式样式问题
3133

3234
## 2.0.0-rc.6 (2020-10-28)
3335

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
"dependencies": {
2424
"@iconify/iconify": "^2.0.0-rc.1",
25-
"ant-design-vue": "^2.0.0-beta.10",
25+
"ant-design-vue": "^2.0.0-beta.11",
2626
"apexcharts": "^3.22.0",
2727
"axios": "^0.21.0",
2828
"echarts": "^4.9.0",

src/components/Drawer/src/BasicDrawer.tsx

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
11
import { Drawer, Row, Col, Button } from 'ant-design-vue';
2-
import {
3-
defineComponent,
4-
ref,
5-
computed,
6-
watchEffect,
7-
watch,
8-
unref,
9-
// getCurrentInstance,
10-
nextTick,
11-
toRaw,
12-
} from 'vue';
2+
import { defineComponent, ref, computed, watchEffect, watch, unref, nextTick, toRaw } from 'vue';
133
import { BasicTitle } from '/@/components/Basic';
14-
// import { ScrollContainer, ScrollContainerOptions } from '/@/components/Container/index';
154
import { FullLoading } from '/@/components/Loading/index';
165

176
import { getSlot } from '/@/utils/helper/tsxHelper';
@@ -21,8 +10,6 @@ import { DrawerInstance, DrawerProps } from './types';
2110
import { basicProps } from './props';
2211
import { isFunction, isNumber } from '/@/utils/is';
2312
import { LeftOutlined } from '@ant-design/icons-vue';
24-
// import { appStore } from '/@/store/modules/app';
25-
// import { useRouter } from 'vue-router';
2613
import { buildUUID } from '/@/utils/uuid';
2714
import { deepMerge } from '/@/utils';
2815
import './index.less';
@@ -38,7 +25,6 @@ export default defineComponent({
3825
const visibleRef = ref(false);
3926
const propsRef = ref<Partial<DrawerProps> | null>(null);
4027

41-
// 自定义title组件:获得title
4228
const getMergeProps = computed((): any => {
4329
return deepMerge(toRaw(props), unref(propsRef));
4430
});
@@ -68,9 +54,11 @@ export default defineComponent({
6854
}
6955
return opt;
7056
});
57+
7158
watchEffect(() => {
7259
visibleRef.value = props.visible;
7360
});
61+
7462
watch(
7563
() => visibleRef.value,
7664
(visible) => {
@@ -83,6 +71,15 @@ export default defineComponent({
8371
}
8472
);
8573

74+
// 底部按钮自定义实现,
75+
const getFooterHeight = computed(() => {
76+
const { footerHeight, showFooter }: DrawerProps = unref(getProps);
77+
if (showFooter && footerHeight) {
78+
return isNumber(footerHeight) ? `${footerHeight}px` : `${footerHeight.replace('px', '')}px`;
79+
}
80+
return `0px`;
81+
});
82+
8683
// 取消事件
8784
async function onClose(e: any) {
8885
const { closeFunc } = unref(getProps);
@@ -103,14 +100,6 @@ export default defineComponent({
103100
}
104101
}
105102

106-
// 底部按钮自定义实现,
107-
const getFooterHeight = computed(() => {
108-
const { footerHeight, showFooter }: DrawerProps = unref(getProps);
109-
if (showFooter && footerHeight) {
110-
return isNumber(footerHeight) ? `${footerHeight}px` : `${footerHeight.replace('px', '')}px`;
111-
}
112-
return `0px`;
113-
});
114103
function renderFooter() {
115104
const {
116105
showCancelBtn,
@@ -171,11 +160,13 @@ export default defineComponent({
171160
)}
172161
</Col>
173162
)}
163+
174164
{title && (
175165
<Col style="flex:1" class={[`${prefixCls}__detail-title`, 'ellipsis', 'px-2']}>
176166
{() => title}
177167
</Col>
178168
)}
169+
179170
{getSlot(slots, 'titleToolbar')}
180171
</>
181172
)}
@@ -208,22 +199,22 @@ export default defineComponent({
208199
title: () => renderHeader(),
209200
default: () => (
210201
<>
211-
<FullLoading
212-
absolute
213-
class={[!unref(getProps).loading ? 'hidden' : '']}
214-
tip="加载中..."
215-
/>
216202
<div
217203
ref={scrollRef}
218204
{...attrs}
219-
data-id="123"
220205
style={{
206+
position: 'relative',
221207
height: `calc(100% - ${footerHeight})`,
222208
overflow: 'auto',
223209
padding: '16px',
224210
paddingBottom: '30px',
225211
}}
226212
>
213+
<FullLoading
214+
absolute
215+
tip="加载中..."
216+
class={[!unref(getProps).loading ? 'hidden' : '']}
217+
/>
227218
{getSlot(slots, 'default')}
228219
</div>
229220
{renderFooter()}

src/components/Drawer/src/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Button } from 'ant-design-vue/types/button/button';
1+
import type { ButtonProps } from 'ant-design-vue/lib/button/buttonTypes';
22
import type { CSSProperties, VNodeChild } from 'vue';
33
import type { ScrollContainerOptions } from '/@/components/Container/index';
44

@@ -47,13 +47,13 @@ export interface DrawerFooterProps {
4747
* The ok button props, follow jsx rules
4848
* @type object
4949
*/
50-
okButtonProps: { props: Button; on: {} };
50+
okButtonProps: { props: ButtonProps; on: {} };
5151

5252
/**
5353
* The cancel button props, follow jsx rules
5454
* @type object
5555
*/
56-
cancelButtonProps: { props: Button; on: {} };
56+
cancelButtonProps: { props: ButtonProps; on: {} };
5757
/**
5858
* Whether to apply loading visual effect for OK button or not
5959
* @default false

src/components/Form/src/hooks/useForm.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import { isInSetup } from '/@/utils/helper/vueHelper';
44
import { isProdMode } from '/@/utils/env';
55

66
import type { FormProps, FormActionType, UseFormReturnType, FormSchema } from '../types/form';
7-
import type { NamePath } from 'ant-design-vue/types/form/form-item';
8-
import type { ValidateFields } from 'ant-design-vue/types/form/form';
7+
import type { NamePath } from 'ant-design-vue/lib/form/interface';
8+
9+
export declare type ValidateFields = (nameList?: NamePath[]) => Promise<any>;
910

1011
export function useForm(props?: Partial<FormProps>): UseFormReturnType {
1112
isInSetup();

src/components/Form/src/hooks/useFormAction.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { ComputedRef, Ref } from 'vue';
2-
import type { FormProps, FormSchema } from '../types/form';
3-
import type { Form as FormType } from 'ant-design-vue/types/form/form';
4-
import type { NamePath } from 'ant-design-vue/types/form/form-item';
2+
import type { FormProps, FormSchema, FormActionType } from '../types/form';
3+
import type { NamePath } from 'ant-design-vue/lib/form/interface';
54

65
import { unref, toRaw } from 'vue';
76

@@ -17,7 +16,7 @@ interface UseFormActionContext {
1716
getSchema: ComputedRef<FormSchema[]>;
1817
formModel: any;
1918
defaultValueRef: Ref<any>;
20-
formElRef: Ref<FormType>;
19+
formElRef: Ref<FormActionType>;
2120
schemaRef: Ref<FormSchema[]>;
2221
handleFormValues: Fn;
2322
actionState: {

src/components/Form/src/types/form.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Form, NamePath, ValidationRule } from 'ant-design-vue/types/form/form';
1+
import type { NamePath, RuleObject } from 'ant-design-vue/lib/form/interface';
22
import type { VNode } from 'vue';
33
import type { BasicButtonProps } from '/@/components/Button/types';
44
import type { FormItem } from './formItem';
@@ -17,7 +17,7 @@ export interface ButtonProps extends BasicButtonProps {
1717
text?: string;
1818
}
1919

20-
export interface FormActionType extends Form {
20+
export interface FormActionType {
2121
submit: () => Promise<void>;
2222
setFieldsValue: <T>(values: T) => void;
2323
resetFields: () => Promise<any>;
@@ -29,6 +29,7 @@ export interface FormActionType extends Form {
2929
appendSchemaByField: (schema: FormSchema, prefixField?: string) => void;
3030
validateFields: (nameList?: NamePath[]) => Promise<any>;
3131
validate: (nameList?: NamePath[]) => Promise<any>;
32+
scrollToField: (name: NamePath, options?: ScrollOptions) => void;
3233
}
3334
export type RegisterFn = (formInstance: FormActionType) => void;
3435

@@ -113,7 +114,7 @@ export interface FormSchema {
113114
componentProps?: any;
114115

115116
// 校验规则
116-
rules?: ValidationRule[];
117+
rules?: RuleObject[];
117118
// 校验信息是否加入label
118119
rulesMessageJoinLabel?: boolean;
119120

@@ -150,7 +151,7 @@ export interface FormSchema {
150151

151152
dynamicDisabled?: boolean | ((renderCallbackParams: RenderCallbackParams) => boolean);
152153

153-
dynamicRules?: (renderCallbackParams: RenderCallbackParams) => ValidationRule[];
154+
dynamicRules?: (renderCallbackParams: RenderCallbackParams) => RuleObject[];
154155
}
155156
export interface HelpComponentProps {
156157
maxWidth: string;

src/components/Form/src/types/formItem.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { NamePath } from 'ant-design-vue/types/form/form-item';
2-
import type { Col } from 'ant-design-vue/types/grid/col';
1+
import type { NamePath } from 'ant-design-vue/lib/form/interface';
2+
import type { ColProps } from 'ant-design-vue/lib/grid/Col';
33
import type { VNodeChild } from 'vue';
44

55
export interface FormItem {
@@ -39,7 +39,7 @@ export interface FormItem {
3939
* The layout of label. You can set span offset to something like {span: 3, offset: 12} or sm: {span: 3, offset: 12} same as with <Col>
4040
* @type Col
4141
*/
42-
labelCol?: Col;
42+
labelCol?: ColProps;
4343

4444
/**
4545
* Whether provided or not, it will be generated by the validation rule.
@@ -58,7 +58,7 @@ export interface FormItem {
5858
* The layout for input controls, same as labelCol
5959
* @type Col
6060
*/
61-
wrapperCol?: Col;
61+
wrapperCol?: ColProps;
6262
/**
6363
* Set sub label htmlFor.
6464
*/

src/components/Form/src/types/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { ColSpanType } from 'ant-design-vue/types/grid/col';
2-
1+
type ColSpanType = number | string;
32
export interface ColEx {
43
style?: any;
54
/**

src/components/Menu/src/SearchInput.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@
6969
margin: 12px 9px;
7070
7171
&__search--dark {
72-
// .setPlaceholder('.ant-input',#fff);
73-
72+
.ant-input-affix-wrapper,
7473
.ant-input {
7574
.set-bg();
7675
@@ -91,6 +90,7 @@
9190
}
9291
9392
&__search--light {
93+
.ant-input-affix-wrapper,
9494
.ant-input {
9595
color: @text-color-base;
9696
background: #fff;

0 commit comments

Comments
 (0)