Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
admin-fe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pleroma
admin-fe
Commits
ebc2ac08
Commit
ebc2ac08
authored
7 years ago
by
Pan
Browse files
Options
Downloads
Patches
Plain Diff
add(inlineEditable): add the calcel btn to restore the title
parent
a9d2978c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/views/example/table/inlineEditTable.vue
+36
-4
36 additions, 4 deletions
src/views/example/table/inlineEditTable.vue
with
36 additions
and
4 deletions
src/views/example/table/inlineEditTable.vue
+
36
−
4
View file @
ebc2ac08
...
...
@@ -35,14 +35,18 @@
<
el
-
table
-
column
min
-
width
=
"
300px
"
label
=
"
标题
"
>
<
template
slot
-
scope
=
"
scope
"
>
<
el
-
input
v
-
show
=
"
scope.row.edit
"
size
=
"
small
"
v
-
model
=
"
scope.row.title
"
><
/el-input
>
<
span
v
-
show
=
"
!scope.row.edit
"
>
{{
scope
.
row
.
title
}}
<
/span
>
<
template
v
-
if
=
"
scope.row.edit
"
>
<
el
-
input
class
=
"
edit-input
"
size
=
"
small
"
v
-
model
=
"
scope.row.title
"
><
/el-input
>
<
el
-
button
class
=
'
cancel-btn
'
size
=
"
small
"
icon
=
"
el-icon-refresh
"
type
=
"
warning
"
@
click
=
"
cancelEdit(scope.row)
"
>
cancel
<
/el-button
>
<
/template
>
<
span
v
-
else
>
{{
scope
.
row
.
title
}}
<
/span
>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
align
=
"
center
"
label
=
"
编辑
"
width
=
"
120
"
>
<
template
slot
-
scope
=
"
scope
"
>
<
el
-
button
:
type
=
"
scope.row.edit?'success':'primary'
"
@
click
=
'
scope.row.edit=!scope.row.edit
'
size
=
"
small
"
icon
=
"
edit
"
>
{{
scope
.
row
.
edit
?
'
完成
'
:
'
编辑
'
}}
<
/el-button
>
<
el
-
button
v
-
if
=
"
scope.row.edit
"
type
=
"
success
"
@
click
=
"
confirmEdit(scope.row)
"
size
=
"
small
"
icon
=
"
el-icon-circle-check-outline
"
>
完成
<
/el-button
>
<
el
-
button
v
-
else
type
=
"
primary
"
@
click
=
'
scope.row.edit=!scope.row.edit
'
size
=
"
small
"
icon
=
"
el-icon-edit
"
>
编辑
<
/el-button
>
<
/template
>
<
/el-table-column
>
...
...
@@ -84,12 +88,40 @@ export default {
fetchList
(
this
.
listQuery
).
then
(
response
=>
{
const
items
=
response
.
data
.
items
this
.
list
=
items
.
map
(
v
=>
{
this
.
$set
(
v
,
'
edit
'
,
false
)
this
.
$set
(
v
,
'
edit
'
,
false
)
// https://vuejs.org/v2/guide/reactivity.html
v
.
originalTitle
=
v
.
title
// will be used when user click the cancel botton
return
v
}
)
this
.
listLoading
=
false
}
)
}
,
cancelEdit
(
row
)
{
row
.
title
=
row
.
originalTitle
row
.
edit
=
false
this
.
$message
({
message
:
'
The title has been restored to the original value
'
,
type
:
'
warning
'
}
)
}
,
confirmEdit
(
row
)
{
row
.
edit
=
false
row
.
originalTitle
=
row
.
title
this
.
$message
({
message
:
'
The title has been edited
'
,
type
:
'
success
'
}
)
}
}
}
<
/script
>
<
style
scoped
>
.
edit
-
input
{
padding
-
right
:
100
px
;
}
.
cancel
-
btn
{
position
:
absolute
;
right
:
15
px
;
top
:
13
px
;
}
<
/style
>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment