Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
najiu-admin-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
najiu-frontend
najiu-admin-template
Commits
8c2491fc
Unverified
Commit
8c2491fc
authored
Apr 19, 2021
by
jinmao88
Committed by
GitHub
Apr 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: fix AppendFormDemo (#505)
Co-authored-by:
haha
<
admin@qq.com
>
parent
85b92a9a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
13 deletions
+14
-13
AppendForm.vue
src/views/demo/form/AppendForm.vue
+14
-13
No files found.
src/views/demo/form/AppendForm.vue
View file @
8c2491fc
...
...
@@ -3,8 +3,8 @@
<CollapseContainer
title=
"表单增删"
>
<BasicForm
@
register=
"register"
@
submit=
"handleSubmit"
>
<template
#add
="
{ field }">
<Button
v-if=
"
field === 1
"
@
click=
"add"
>
+
</Button>
<Button
v-if=
"field >
1
"
@
click=
"del(field)"
>
-
</Button>
<Button
v-if=
"
Number(field) === 0
"
@
click=
"add"
>
+
</Button>
<Button
v-if=
"field >
0
"
@
click=
"del(field)"
>
-
</Button>
</
template
>
</BasicForm>
</CollapseContainer>
...
...
@@ -24,25 +24,25 @@
const
[
register
,
{
appendSchemaByField
,
removeSchemaByFiled
,
validate
}]
=
useForm
({
schemas
:
[
{
field
:
'
field
1
a
'
,
field
:
'
field
0
a
'
,
component
:
'
Input
'
,
label
:
'
字段
1
'
,
label
:
'
字段
0
'
,
colProps
:
{
span
:
8
,
},
required
:
true
,
},
{
field
:
'
field
1
b
'
,
field
:
'
field
0
b
'
,
component
:
'
Input
'
,
label
:
'
字段
1
'
,
label
:
'
字段
0
'
,
colProps
:
{
span
:
8
,
},
required
:
true
,
},
{
field
:
'
1
'
,
field
:
'
0
'
,
component
:
'
Input
'
,
label
:
'
'
,
colProps
:
{
...
...
@@ -64,14 +64,14 @@
}
}
const
n
=
ref
(
2
);
const
n
=
ref
(
1
);
function
add
()
{
appendSchemaByField
(
{
field
:
'
field
'
+
n
.
value
+
'
a
'
,
field
:
`field
${
n
.
value
}
a`
,
component
:
'
Input
'
,
label
:
'
字段
2
'
,
label
:
'
字段
'
+
n
.
value
,
colProps
:
{
span
:
8
,
},
...
...
@@ -81,9 +81,9 @@
);
appendSchemaByField
(
{
field
:
'
field
'
+
n
.
value
+
'
b
'
,
field
:
`field
${
n
.
value
}
b`
,
component
:
'
Input
'
,
label
:
'
字段
2
'
,
label
:
'
字段
'
+
n
.
value
,
colProps
:
{
span
:
8
,
},
...
...
@@ -91,6 +91,7 @@
},
''
);
appendSchemaByField
(
{
field
:
`
${
n
.
value
}
`
,
...
...
@@ -107,8 +108,8 @@
}
function
del
(
field
)
{
console
.
log
(
field
);
removeSchemaByFiled
([
`field
${
field
}
a`
,
`field
${
field
}
b`
,
`
${
field
}
`
]);
n
.
value
--
;
}
return
{
register
,
handleSubmit
,
add
,
del
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment