Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
VueElementTemplate
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
黄瑜
VueElementTemplate
Commits
72253330
Commit
72253330
authored
May 08, 2017
by
Pan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
table example add sort
parent
f1c807ab
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
article_table.js
src/mock/article_table.js
+7
-2
table.vue
src/views/example/table.vue
+8
-1
No files found.
src/mock/article_table.js
View file @
72253330
...
@@ -21,14 +21,19 @@ for (let i = 0; i < count; i++) {
...
@@ -21,14 +21,19 @@ for (let i = 0; i < count; i++) {
export
default
{
export
default
{
getList
:
config
=>
{
getList
:
config
=>
{
const
{
importance
,
type
,
title
,
page
,
limit
}
=
config
.
params
;
const
{
importance
,
type
,
title
,
page
,
limit
,
sort
}
=
config
.
params
;
cons
t
mockList
=
List
.
filter
(
item
=>
{
le
t
mockList
=
List
.
filter
(
item
=>
{
if
(
importance
&&
item
.
importance
!==
importance
)
return
false
;
if
(
importance
&&
item
.
importance
!==
importance
)
return
false
;
if
(
type
&&
item
.
type
!==
type
)
return
false
;
if
(
type
&&
item
.
type
!==
type
)
return
false
;
if
(
title
&&
item
.
title
.
indexOf
(
title
)
<
0
)
return
false
;
if
(
title
&&
item
.
title
.
indexOf
(
title
)
<
0
)
return
false
;
return
true
;
return
true
;
});
});
if
(
sort
===
'-id'
)
{
mockList
=
mockList
.
reverse
()
}
const
pageList
=
mockList
.
filter
((
item
,
index
)
=>
index
<
limit
*
page
&&
index
>=
limit
*
(
page
-
1
));
const
pageList
=
mockList
.
filter
((
item
,
index
)
=>
index
<
limit
*
page
&&
index
>=
limit
*
(
page
-
1
));
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
resolve
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
resolve
([
200
,
{
resolve
([
200
,
{
...
...
src/views/example/table.vue
View file @
72253330
...
@@ -14,6 +14,11 @@
...
@@ -14,6 +14,11 @@
</el-option>
</el-option>
</el-select>
</el-select>
<el-select
@
change=
'handleFilter'
style=
"width: 120px"
class=
"filter-item"
v-model=
"listQuery.sort"
placeholder=
"排序"
>
<el-option
v-for=
"item in sortOptions"
:key=
"item.key"
:label=
"item.label"
:value=
"item.key"
>
</el-option>
</el-select>
<el-button
class=
"filter-item"
type=
"primary"
v-waves
icon=
"search"
@
click=
"handleFilter"
>
搜索
</el-button>
<el-button
class=
"filter-item"
type=
"primary"
v-waves
icon=
"search"
@
click=
"handleFilter"
>
搜索
</el-button>
<el-button
class=
"filter-item"
style=
"margin-left: 10px;"
@
click=
"handleCreate"
type=
"primary"
icon=
"edit"
>
添加
</el-button>
<el-button
class=
"filter-item"
style=
"margin-left: 10px;"
@
click=
"handleCreate"
type=
"primary"
icon=
"edit"
>
添加
</el-button>
<el-button
class=
"filter-item"
type=
"primary"
icon=
"document"
@
click=
"handleDownload"
>
导出
</el-button>
<el-button
class=
"filter-item"
type=
"primary"
icon=
"document"
@
click=
"handleDownload"
>
导出
</el-button>
...
@@ -174,7 +179,8 @@
...
@@ -174,7 +179,8 @@
limit
:
20
,
limit
:
20
,
importance
:
undefined
,
importance
:
undefined
,
title
:
undefined
,
title
:
undefined
,
type
:
undefined
type
:
undefined
,
sort
:
'+id'
}
,
}
,
temp
:
{
temp
:
{
id
:
undefined
,
id
:
undefined
,
...
@@ -187,6 +193,7 @@
...
@@ -187,6 +193,7 @@
}
,
}
,
importanceOptions
:
[
1
,
2
,
3
],
importanceOptions
:
[
1
,
2
,
3
],
calendarTypeOptions
,
calendarTypeOptions
,
sortOptions
:
[{
label
:
'按ID升序列'
,
key
:
'+id'
}
,
{
label
:
'按ID降序'
,
key
:
'-id'
}
],
statusOptions
:
[
'published'
,
'draft'
,
'deleted'
],
statusOptions
:
[
'published'
,
'draft'
,
'deleted'
],
dialogFormVisible
:
false
,
dialogFormVisible
:
false
,
dialogStatus
:
''
,
dialogStatus
:
''
,
...
...
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