Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 9105d4d1
authored
Dec 03, 2025
by
JyQAQ
Committed by
GitHub
Dec 03, 2025
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat(api-component): api-component组件的options支持指定disabled值 (#6991)
1 parent
c76db7d8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
packages/effects/common-ui/src/components/api-component/api-component.vue
packages/effects/common-ui/src/components/api-component/api-component.vue
View file @
9105d4d
...
...
@@ -36,6 +36,8 @@ interface Props {
childrenField
?:
string
;
/** value字段名 */
valueField
?:
string
;
/** disabled字段名 */
disabledField
?:
string
;
/** 组件接收options数据的属性名 */
optionsPropName
?:
string
;
/** 是否立即调用api */
...
...
@@ -75,6 +77,7 @@ defineOptions({ name: 'ApiComponent', inheritAttrs: false });
const
props
=
withDefaults
(
defineProps
<
Props
>
(),
{
labelField
:
'label'
,
valueField
:
'value'
,
disabledField
:
'disabled'
,
childrenField
:
''
,
optionsPropName
:
'options'
,
resultField
:
''
,
...
...
@@ -108,17 +111,25 @@ const isFirstLoaded = ref(false);
const
hasPendingRequest
=
ref
(
false
);
const
getOptions
=
computed
(()
=>
{
const
{
labelField
,
valueField
,
childrenField
,
numberToString
}
=
props
;
const
{
labelField
,
valueField
,
disabledField
,
childrenField
,
numberToString
,
}
=
props
;
const
refOptionsData
=
unref
(
refOptions
);
function
transformData
(
data
:
OptionsItem
[]):
OptionsItem
[]
{
return
data
.
map
((
item
)
=>
{
const
value
=
get
(
item
,
valueField
);
const
disabled
=
get
(
item
,
disabledField
);
return
{
...
objectOmit
(
item
,
[
labelField
,
valueField
,
childrenField
]),
...
objectOmit
(
item
,
[
labelField
,
valueField
,
disabled
,
childrenField
]),
label
:
get
(
item
,
labelField
),
value
:
numberToString
?
`
${
value
}
`
:
value
,
disabled
:
get
(
item
,
disabledField
),
...(
childrenField
&&
item
[
childrenField
]
?
{
children
:
transformData
(
item
[
childrenField
])
}
:
{}),
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment