Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ant-design-pro-vue
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
tianzhuanghu
ant-design-pro-vue
Commits
48fe38a3
Unverified
Commit
48fe38a3
authored
Feb 13, 2019
by
Sendya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: table rowSelection false;
add: table alert example
parent
3b1d4a57
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
6 deletions
+49
-6
index.js
src/components/table/index.js
+6
-2
TableList.vue
src/views/list/TableList.vue
+43
-4
No files found.
src/components/table/index.js
View file @
48fe38a3
...
@@ -249,7 +249,8 @@ export default {
...
@@ -249,7 +249,8 @@ export default {
props
[
k
]
=
this
[
localKey
]
props
[
k
]
=
this
[
localKey
]
return
props
[
k
]
return
props
[
k
]
}
}
if
(
showAlert
&&
k
===
'rowSelection'
)
{
if
(
k
===
'rowSelection'
)
{
if
(
showAlert
&&
this
.
rowSelection
)
{
// 重新绑定 rowSelection 事件
// 重新绑定 rowSelection 事件
props
[
k
]
=
{
props
[
k
]
=
{
selectedRows
:
this
.
selectedRows
,
selectedRows
:
this
.
selectedRows
,
...
@@ -261,10 +262,13 @@ export default {
...
@@ -261,10 +262,13 @@ export default {
}
}
return
props
[
k
]
return
props
[
k
]
}
}
// 如果没打算开启 rowSelection 则清空默认的选择项
props
[
k
]
=
null
return
props
[
k
]
}
props
[
k
]
=
this
[
k
]
props
[
k
]
=
this
[
k
]
return
props
[
k
]
return
props
[
k
]
})
})
const
table
=
(
const
table
=
(
<
a
-
table
{...{
props
,
scopedSlots
:
{
...
this
.
$scopedSlots
}
}}
onChange
=
{
this
.
loadData
}
>
<
a
-
table
{...{
props
,
scopedSlots
:
{
...
this
.
$scopedSlots
}
}}
onChange
=
{
this
.
loadData
}
>
{
this
.
$slots
.
default
}
{
this
.
$slots
.
default
}
...
...
src/views/list/TableList.vue
View file @
48fe38a3
...
@@ -75,14 +75,20 @@
...
@@ -75,14 +75,20 @@
</a-dropdown>
</a-dropdown>
</div>
</div>
<div>
<a-button
@
click=
"tableOption(false)"
v-if=
"optionAlertShow"
>
关闭 alert
</a-button>
</div>
<s-table
<s-table
ref=
"table"
ref=
"table"
size=
"default"
size=
"default"
:columns=
"columns"
:columns=
"columns"
:data=
"loadData"
:data=
"loadData"
:alert=
"
{ show: true, clear: () => { this.selectedRowKeys = [] } }
"
:alert=
"
options.alert
"
:rowSelection=
"
{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }
"
:rowSelection=
"
options.rowSelection
"
>
>
<span
slot=
"serial"
slot-scope=
"text, record, index"
>
{{ index + 1 }}
</span>
<span
slot=
"action"
slot-scope=
"text, record"
>
<span
slot=
"action"
slot-scope=
"text, record"
>
<
template
v-if=
"$auth('table.update')"
>
<
template
v-if=
"$auth('table.update')"
>
<a
@
click=
"handleEdit(record)"
>
编辑
</a>
<a
@
click=
"handleEdit(record)"
>
编辑
</a>
...
@@ -216,6 +222,10 @@ export default {
...
@@ -216,6 +222,10 @@ export default {
// 表头
// 表头
columns
:
[
columns
:
[
{
{
title
:
'#'
,
scopedSlots
:
{
customRender
:
'serial'
}
},
{
title
:
'规则编号'
,
title
:
'规则编号'
,
dataIndex
:
'no'
dataIndex
:
'no'
},
},
...
@@ -254,15 +264,44 @@ export default {
...
@@ -254,15 +264,44 @@ export default {
return
res
.
result
return
res
.
result
})
})
},
},
selectedRowKeys
:
[],
selectedRowKeys
:
[],
selectedRows
:
[]
selectedRows
:
[],
// custom table alert & rowSelection
options
:
{
alert
:
{
show
:
true
,
clear
:
()
=>
{
this
.
selectedRowKeys
=
[]
}
},
rowSelection
:
{
selectedRowKeys
:
this
.
selectedRowKeys
,
onChange
:
this
.
onSelectChange
}
},
optionAlertShow
:
true
}
}
},
},
created
()
{
created
()
{
this
.
tableOption
(
true
)
getRoleList
({
t
:
new
Date
()
})
getRoleList
({
t
:
new
Date
()
})
},
},
methods
:
{
methods
:
{
tableOption
(
bool
)
{
if
(
bool
)
{
this
.
options
=
{
alert
:
{
show
:
true
,
clear
:
()
=>
{
this
.
selectedRowKeys
=
[]
}
},
rowSelection
:
{
selectedRowKeys
:
this
.
selectedRowKeys
,
onChange
:
this
.
onSelectChange
}
}
}
else
{
this
.
options
=
{
alert
:
false
,
rowSelection
:
null
}
this
.
optionAlertShow
=
false
}
},
handleEdit
(
record
)
{
handleEdit
(
record
)
{
this
.
mdl
=
Object
.
assign
({},
record
)
this
.
mdl
=
Object
.
assign
({},
record
)
console
.
log
(
this
.
mdl
)
console
.
log
(
this
.
mdl
)
...
...
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