Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-vue-admin
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-vue-admin
Commits
c7cfeb54
提交
c7cfeb54
authored
10月 23, 2020
作者:
vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: form reset logic modification
上级
e034d1ba
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
40 行增加
和
25 行删除
+40
-25
CHANGELOG.zh_CN.md
CHANGELOG.zh_CN.md
+1
-0
BasicForm.vue
src/components/Form/src/BasicForm.vue
+4
-4
FormItem.tsx
src/components/Form/src/FormItem.tsx
+14
-1
index.tsx
src/layouts/default/multitabs/index.tsx
+21
-18
tableData.tsx
src/views/demo/table/tableData.tsx
+0
-2
没有找到文件。
CHANGELOG.zh_CN.md
浏览文件 @
c7cfeb54
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
### 🎫 Chores
### 🎫 Chores
-
删除代码内的可选链语法
-
删除代码内的可选链语法
-
表单重置逻辑修改
### 🐛 Bug Fixes
### 🐛 Bug Fixes
...
...
src/components/Form/src/BasicForm.vue
浏览文件 @
c7cfeb54
...
@@ -194,7 +194,7 @@
...
@@ -194,7 +194,7 @@
model
:
formModel
,
model
:
formModel
,
field
:
schema
.
field
,
field
:
schema
.
field
,
values
:
{
values
:
{
...
un
er
f
(
defaultValueRef
),
...
un
re
f
(
defaultValueRef
),
...
formModel
,
...
formModel
,
},
},
});
});
...
@@ -271,11 +271,11 @@
...
@@ -271,11 +271,11 @@
const
formEl
=
unref
(
formElRef
);
const
formEl
=
unref
(
formElRef
);
if
(
!
formEl
)
return
;
if
(
!
formEl
)
return
;
Object
.
keys
(
formModel
).
forEach
((
key
)
=>
{
Object
.
keys
(
formModel
).
forEach
((
key
)
=>
{
(
formModel
as
any
)[
key
]
=
undefined
;
(
formModel
as
any
)[
key
]
=
defaultValueRef
.
value
[
key
]
;
});
});
const
values
=
formEl
.
resetFields
();
//
const values = formEl.resetFields();
emit
(
'reset'
,
toRaw
(
formModel
));
emit
(
'reset'
,
toRaw
(
formModel
));
return
values
;
//
return values;
}
}
/**
/**
...
...
src/components/Form/src/FormItem.tsx
浏览文件 @
c7cfeb54
...
@@ -139,6 +139,7 @@ export default defineComponent({
...
@@ -139,6 +139,7 @@ export default defineComponent({
}
}
return
rules
;
return
rules
;
}
}
function
renderComponent
()
{
function
renderComponent
()
{
const
{
const
{
componentProps
,
componentProps
,
...
@@ -163,7 +164,6 @@ export default defineComponent({
...
@@ -163,7 +164,6 @@ export default defineComponent({
}
}
},
},
};
};
const
Comp
=
componentMap
.
get
(
component
);
const
Comp
=
componentMap
.
get
(
component
);
const
{
autoSetPlaceHolder
,
size
}
=
props
.
formProps
;
const
{
autoSetPlaceHolder
,
size
}
=
props
.
formProps
;
...
@@ -189,9 +189,22 @@ export default defineComponent({
...
@@ -189,9 +189,22 @@ export default defineComponent({
const
bindValue
=
{
const
bindValue
=
{
[
isCheck
?
'checked'
:
'value'
]:
(
props
.
formModel
as
any
)[
field
],
[
isCheck
?
'checked'
:
'value'
]:
(
props
.
formModel
as
any
)[
field
],
};
};
// TODO先兼容antd的警告,后面官方修复后删除
if
(
component
===
'Select'
)
{
if
(
Reflect
.
has
(
propsData
,
'options'
))
{
propsData
.
options
=
propsData
.
options
.
map
((
item
:
any
)
=>
{
return
{
key
:
item
.
value
,
...
item
,
};
});
}
}
if
(
!
renderComponentContent
)
{
if
(
!
renderComponentContent
)
{
return
<
Comp
{
...
propsData
}
{
...
on
}
{
...
bindValue
}
/>;
return
<
Comp
{
...
propsData
}
{
...
on
}
{
...
bindValue
}
/>;
}
}
return
(
return
(
<
Comp
{
...
propsData
}
{
...
on
}
{
...
bindValue
}
>
<
Comp
{
...
propsData
}
{
...
on
}
{
...
bindValue
}
>
{
{
{
{
...
...
src/layouts/default/multitabs/index.tsx
浏览文件 @
c7cfeb54
...
@@ -8,7 +8,7 @@ import {
...
@@ -8,7 +8,7 @@ import {
computed
,
computed
,
// ref,
// ref,
unref
,
unref
,
onMounted
,
//
onMounted,
toRaw
,
toRaw
,
}
from
'vue'
;
}
from
'vue'
;
import
{
Tabs
}
from
'ant-design-vue'
;
import
{
Tabs
}
from
'ant-design-vue'
;
...
@@ -24,7 +24,7 @@ import { tabStore } from '/@/store/modules/tab';
...
@@ -24,7 +24,7 @@ import { tabStore } from '/@/store/modules/tab';
import
{
closeTab
}
from
'./useTabDropdown'
;
import
{
closeTab
}
from
'./useTabDropdown'
;
import
router
from
'/@/router'
;
import
router
from
'/@/router'
;
import
{
useTabs
}
from
'/@/hooks/web/useTabs'
;
import
{
useTabs
}
from
'/@/hooks/web/useTabs'
;
import
{
PageEnum
}
from
'/@/enums/pageEnum'
;
//
import { PageEnum } from '/@/enums/pageEnum';
import
'./index.less'
;
import
'./index.less'
;
export
default
defineComponent
({
export
default
defineComponent
({
...
@@ -33,14 +33,17 @@ export default defineComponent({
...
@@ -33,14 +33,17 @@ export default defineComponent({
let
isAddAffix
=
false
;
let
isAddAffix
=
false
;
const
go
=
useGo
();
const
go
=
useGo
();
const
{
currentRoute
}
=
useRouter
();
const
{
currentRoute
}
=
useRouter
();
const
{
addTab
,
activeKeyRef
}
=
useTabs
();
const
{
onMounted
(()
=>
{
// addTab,
const
route
=
unref
(
currentRoute
);
activeKeyRef
,
addTab
(
unref
(
currentRoute
).
path
as
PageEnum
,
false
,
{
}
=
useTabs
();
query
:
route
.
query
,
// onMounted(() => {
params
:
route
.
params
,
// const route = unref(currentRoute);
});
// addTab(unref(currentRoute).path as PageEnum, false, {
});
// query: route.query,
// params: route.params,
// });
// });
// 当前激活tab
// 当前激活tab
// const activeKeyRef = ref<string>('');
// const activeKeyRef = ref<string>('');
...
@@ -64,14 +67,14 @@ export default defineComponent({
...
@@ -64,14 +67,14 @@ export default defineComponent({
// 监听路由的话虽然可以,但是路由切换的时间会造成卡顿现象?
// 监听路由的话虽然可以,但是路由切换的时间会造成卡顿现象?
// 使用useTab的addTab的话,当用户手动调转,需要自行调用addTab
// 使用useTab的addTab的话,当用户手动调转,需要自行调用addTab
// tabStore.commitAddTab((unref(currentRoute) as unknown) as AppRouteRecordRaw);
// tabStore.commitAddTab((unref(currentRoute) as unknown) as AppRouteRecordRaw);
//
const { affix } = currentRoute.value.meta || {};
const
{
affix
}
=
currentRoute
.
value
.
meta
||
{};
//
if (affix) return;
if
(
affix
)
return
;
//
const hasInTab = tabStore.getTabsState.some(
const
hasInTab
=
tabStore
.
getTabsState
.
some
(
//
(item) => item.fullPath === currentRoute.value.fullPath
(
item
)
=>
item
.
fullPath
===
currentRoute
.
value
.
fullPath
//
);
);
//
if (!hasInTab) {
if
(
!
hasInTab
)
{
//
tabStore.commitAddTab((unref(currentRoute) as unknown) as AppRouteRecordRaw);
tabStore
.
commitAddTab
((
unref
(
currentRoute
)
as
unknown
)
as
AppRouteRecordRaw
);
//
}
}
},
},
{
{
immediate
:
true
,
immediate
:
true
,
...
...
src/views/demo/table/tableData.tsx
浏览文件 @
c7cfeb54
...
@@ -239,12 +239,10 @@ export function getFormConfig(): Partial<FormProps> {
...
@@ -239,12 +239,10 @@ export function getFormConfig(): Partial<FormProps> {
{
{
label
:
'选项1'
,
label
:
'选项1'
,
value
:
'1'
,
value
:
'1'
,
key
:
'1'
,
},
},
{
{
label
:
'选项2'
,
label
:
'选项2'
,
value
:
'2'
,
value
:
'2'
,
key
:
'2'
,
},
},
],
],
},
},
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论