Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-web
/
authority
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit bbe409d8
authored
Sep 10, 2018
by
liwk
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
菜单列表组件增加全部展开与收起
1 parent
69ac8af4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
9 deletions
src/components/Tree/src/main.vue
src/components/Tree/src/main.vue
View file @
bbe409d
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<div
class=
"menu-box box"
>
<div
class=
"menu-box box"
>
<div
class=
"title"
v-html=
"title"
></div>
<div
class=
"title"
v-html=
"title"
></div>
<gl-row
v-if=
"consoleItem"
class=
"console-btn"
>
<gl-row
v-if=
"consoleItem"
class=
"console-btn"
>
<gl-col
:span=
'8'
><gl-button
@
click=
"openAll
"
>
全部展开
</gl-button></gl-col>
<gl-col
:span=
'8'
><gl-button
@
click=
"openAll
(openOrClose)"
>
{{
openOrClose
?
'全部展开'
:
'全部收起'
}}
</gl-button></gl-col>
<gl-col
:span=
'16'
>
<gl-col
:span=
'16'
>
<gl-button
@
click=
"pushSublings"
type=
'primary'
:disabled=
"push"
>
添加同级菜单
</gl-button>
<gl-button
@
click=
"pushSublings"
type=
'primary'
:disabled=
"push"
>
添加同级菜单
</gl-button>
<gl-button
@
click=
"pushChildren"
type=
'primary'
:disabled=
"push"
>
添加子菜单
</gl-button>
<gl-button
@
click=
"pushChildren"
type=
'primary'
:disabled=
"push"
>
添加子菜单
</gl-button>
...
@@ -90,12 +90,12 @@
...
@@ -90,12 +90,12 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
'./time.js'
var
timeTip
=
'系统自动生成(格式yyyy-MM-dd HH:mm:ss)'
var
timeTip
=
'系统自动生成(格式yyyy-MM-dd HH:mm:ss)'
export
default
{
export
default
{
name
:
'Tree'
,
name
:
'Tree'
,
data
()
{
data
()
{
return
{
return
{
openOrClose
:
true
,
node
:
null
,
node
:
null
,
btnTxt
:
'修改'
,
btnTxt
:
'修改'
,
allNode
:
null
,
allNode
:
null
,
...
@@ -177,7 +177,6 @@ export default {
...
@@ -177,7 +177,6 @@ export default {
},
},
methods
:
{
methods
:
{
nodeClick
(
data
,
node
,
that
)
{
nodeClick
(
data
,
node
,
that
)
{
console
.
log
(
data
,
node
,
that
)
this
.
btnTxt
=
'修改'
this
.
btnTxt
=
'修改'
this
.
node
=
node
this
.
node
=
node
this
.
allNode
=
data
this
.
allNode
=
data
...
@@ -193,12 +192,18 @@ export default {
...
@@ -193,12 +192,18 @@ export default {
this
.
form
.
createTime
=
data
.
createTime
this
.
form
.
createTime
=
data
.
createTime
this
.
form
.
changeTime
=
data
.
changeTime
this
.
form
.
changeTime
=
data
.
changeTime
},
},
// 打开全部
// 展开与关闭
openAll
()
{
openAll
(
val
)
{
console
.
log
(
this
.
$refs
)
this
.
searchChildren
(
this
.
$refs
.
tree
.
$children
[
0
].
store
.
_getAllNodes
(),
val
)
for
(
let
i
=
0
;
i
<
this
.
$refs
.
tree
.
$children
[
0
].
store
.
_getAllNodes
().
length
;
i
++
)
{
this
.
openOrClose
=
!
this
.
openOrClose
this
.
$refs
.
tree
.
$children
[
0
].
store
.
_getAllNodes
()[
i
].
expanded
=
true
},
}
searchChildren
(
data
,
val
)
{
data
.
forEach
(
el
=>
{
el
.
expanded
=
val
if
(
el
.
childNodes
)
{
this
.
searchChildren
(
el
.
childNodes
,
val
)
}
})
},
},
// 添加同级菜单
// 添加同级菜单
pushSublings
()
{
pushSublings
()
{
...
...
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