Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
customTmplate-vue3
Project
Project
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
刘阳
customTmplate-vue3
Commits
8826207c
Commit
8826207c
authored
May 11, 2021
by
刘阳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
4ec1d349
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
381 additions
and
71 deletions
+381
-71
index.js
config/index.js
+2
-1
_util.ts
mock/_util.ts
+0
-0
package.json
package.json
+0
-0
App.vue
src/App.vue
+47
-27
avatar.gif
src/assets/images/avatar.gif
+0
-0
index.vue
src/components/geekHeader/index.vue
+39
-0
index.vue
src/components/header/index.vue
+0
-13
index.ts
src/components/index.ts
+2
-2
index.ts
src/components/menuNav/index.ts
+4
-0
BasicMenu.vue
src/components/menuNav/src/BasicMenu.vue
+114
-0
index.ts
src/constant/index.ts
+80
-1
index.ts
src/router/index.ts
+12
-2
Home.vue
src/views/Home.vue
+81
-25
No files found.
config/index.js
View file @
8826207c
...
...
@@ -11,6 +11,6 @@ module.exports = {
...
agentList
},
publicPath
:
'/customTmplate-vue3'
,
outputDir
:
'customTmplate-vue3'
outputDir
:
'customTmplate-vue3'
,
}
\ No newline at end of file
mock/_util.ts
0 → 100644
View file @
8826207c
package.json
View file @
8826207c
src/App.vue
View file @
8826207c
<
template
>
<div
id=
"app"
>
<g-header
/>
<div
id=
"nav"
>
<router-link
to=
"/"
>
Home
</router-link>
|
<div
:class=
"mode"
>
<basic-menu
/>
<div
class=
"content"
>
<geek-header
v-if=
"mode === 'vertical'"
/>
<router-view
/>
</div>
<router-view/>
</div>
</
template
>
<
script
lang=
"ts"
>
import
{
Header
}
from
'@/components'
import
BasicMenu
from
"./components/menuNav/src/BasicMenu.vue"
;
import
{
GeekHeader
}
from
"@/components"
;
import
{
menuData
}
from
"@/constant"
;
export
default
{
components
:
{
GHeader
:
Header
components
:
{
BasicMenu
,
GeekHeader
},
data
()
{
const
{
mode
}
=
menuData
;
return
{
mode
:
mode
,
editableTabsValue
:
"2"
,
editableTabs
:
[
{
title
:
"Tab 1"
,
name
:
"1"
,
content
:
"Tab 1 content"
}
}
]
};
},
watch
:
{
// $route: {
// handler: function( val:any, oldVal:any) {
// console.log(val);
// },
// // 深度观察监听
// deep: true
// }
}
};
</
script
>
<
style
lang=
'scss'
>
#app
{
font-family
:
Avenir
,
Helvetica
,
Arial
,
sans-serif
;
-webkit-font-smoothing
:
antialiased
;
-moz-osx-font-smoothing
:
grayscale
;
text-align
:
center
;
color
:
#2c3e50
;
<
style
lang=
"scss"
scoped
>
.vertical
{
display
:
flex
;
flex-direction
:
row
;
}
#nav
{
padding
:
30px
;
.horizontal
{
display
:
flex
;
flex-direction
:
column
;
}
#nav
a
{
f
ont-weight
:
bold
;
color
:
#2c3e50
;
.content
{
display
:
flex
;
f
lex
:
1
;
flex-direction
:
column
;
}
#nav
a
.router-link-exact-active
{
color
:
#42b983
;
.el-header
{
color
:
#333
;
line-height
:
60px
;
}
</
style
>
src/assets/images/avatar.gif
0 → 100644
View file @
8826207c
6.19 KB
src/components/geekHeader/index.vue
0 → 100644
View file @
8826207c
<
template
>
<el-header
class=
"gk-header"
style=
"text-align: right; font-size: 14px"
>
<el-dropdown>
<i
class=
"el-icon-setting"
style=
"margin-right: 15px"
></i>
<template
#
dropdown
>
<el-dropdown-menu>
<el-dropdown-item
@
click=
"handleClick(item)"
v-for=
"(item, index) in rightMenu"
:key=
"index"
>
{{
item
.
value
}}
</el-dropdown-item>
</el-dropdown-menu>
</
template
>
</el-dropdown>
<span>
王小虎
</span>
</el-header>
</template>
<
script
>
import
{
menuData
}
from
"@/constant"
;
export
default
{
data
()
{
const
{
rightMenu
}
=
menuData
return
{
rightMenu
};
},
methods
:
{
handleClick
(
item
){
console
.
log
(
'ss'
,
item
)
}
},
};
</
script
>
<
style
lang=
"scss"
scoped
>
.gk-header
{
height
:
64px
;
width
:
100%
;
border
:
solid
1px
#f5f5f5
;
}
</
style
>
src/components/header/index.vue
deleted
100644 → 0
View file @
4ec1d349
<
template
>
<div
class=
"gk-header"
>
</div>
</
template
>
<
style
lang=
"scss"
scoped
>
.gk-header
{
height
:
64px
;
width
:
100%
;
background-color
:
blue
;
}
</
style
>
src/components/index.ts
View file @
8826207c
/* eslint-disable import/prefer-default-export */
import
Header
from
'./h
eader/index.vue'
;
import
GeekHeader
from
'./geekH
eader/index.vue'
;
export
{
Header
,
Geek
Header
,
};
src/components/menuNav/index.ts
0 → 100644
View file @
8826207c
import
BasicMenu
from
'./src/BasicMenu.vue'
export
{
BasicMenu
}
\ No newline at end of file
src/components/menuNav/src/BasicMenu.vue
0 → 100644
View file @
8826207c
<
template
>
<div
:class=
"mode=== 'horizontal'? 'horizontal-content':''"
>
<div
:class=
"mode=== 'horizontal'?'horizontal':''"
>
<div
class=
"header"
@
click=
"controllCollapse"
>
<img
:src=
"headerImg"
width=
"56"
alt=
""
srcset=
""
/>
</div>
<el-menu
:collapse=
"isCollapse"
:mode=
"mode"
:router=
"router"
:class=
"mode"
>
<div
v-for=
"(item, index) in routers"
:key=
"index"
>
<el-submenu
v-if=
"item.children && item.children.length > 0"
:index=
"item.path ? item.path : index + ''"
>
<template
#
title
>
<i
:class=
"item.icon"
></i>
<span
v-if=
"!isCollapse"
>
{{
item
.
title
}}
</span>
</
template
>
<el-menu-item
v-for=
"(child, childIndex) in item.children"
:key=
"childIndex"
:index=
"child.path ? `${item.path}/${child.path}` : `${index}-${childIndex}`"
>
<i
v-if=
"child.icon"
:class=
"child.icon"
></i>
{{ child.title }}
</el-menu-item
>
</el-submenu>
<el-menu-item
v-else
:index=
"item.path ? item.path : index + ''"
>
<i
:class=
"item.icon"
></i>
<
template
#
title
>
{{
item
.
title
}}
</
template
>
</el-menu-item>
</div>
</el-menu>
</div>
<el-header
v-if=
"mode==='horizontal'"
class=
"gk-header"
style=
"text-align: right; font-size: 14px"
>
<el-dropdown>
<i
class=
"el-icon-setting"
style=
"margin-right: 15px"
></i>
<
template
#
dropdown
>
<el-dropdown-menu
>
<el-dropdown-item
@
click=
"handleClick(item)"
v-for=
"(item,index) in rightMenu"
:key=
"index"
>
{{
item
.
value
}}
</el-dropdown-item>
</el-dropdown-menu>
</
template
>
</el-dropdown>
<span>
王小虎
</span>
</el-header>
</div>
</template>
<
script
>
import
{
menuData
}
from
"@/constant"
;
export
default
{
data
()
{
const
{
isCollapse
,
router
,
routers
,
mode
,
headerImg
,
rightMenu
}
=
menuData
;
return
{
isCollapse
,
router
,
routers
,
mode
,
headerImg
,
rightMenu
};
},
methods
:
{
controllCollapse
()
{
if
(
this
.
mode
===
'horizontal'
)
return
this
.
isCollapse
=
!
this
.
isCollapse
;
},
handleClick
(
item
){
console
.
log
(
'sss'
,
item
)
}
}
};
</
script
>
<
style
scoped
>
::v-deep
.vertical
:not
(
.el-menu--collapse
)
{
min-height
:
800px
;
width
:
200px
;
}
.horizontal
{
display
:
flex
;
flex-direction
:
row
;
align-items
:
center
;
padding
:
0px
10px
;
justify-content
:
space-between
;
}
::v-deep
.el-menu--collapse
{
min-height
:
800px
;
}
::v-deep
.el-submenu__icon-arrow
{
top
:
53%
;
right
:
5px
;
}
.horizontal-content
{
display
:
flex
;
flex-direction
:
row
;
justify-content
:
space-between
;
}
.header
{
line-height
:
60px
;
display
:
flex
;
justify-content
:
center
;
padding
:
10px
0px
;
}
.el-header
{
color
:
#333
;
line-height
:
60px
;
}
</
style
>
src/constant/index.ts
View file @
8826207c
export
default
{
const
menuData
=
{
isCollapse
:
false
,
router
:
true
,
// horizontal vertical
mode
:
'vertical'
,
headerImg
:
'https://i.gtimg.cn/club/item/face/img/2/15922_100.gif'
,
routers
:
[
{
title
:
"导航一"
,
icon
:
"el-icon-location"
,
path
:
"home"
,
children
:
[
{
title
:
"导航三"
,
icon
:
"el-icon-document"
,
path
:
"next"
},
{
title
:
"导航二"
,
icon
:
"el-icon-menu"
,
children
:
[],
path
:
""
}
]
},
{
title
:
"导航二"
,
icon
:
"el-icon-menu"
,
path
:
""
,
children
:
[
{
title
:
"导航二2"
,
icon
:
"el-icon-setting"
},
{
title
:
"导航二"
,
icon
:
"el-icon-menu"
,
children
:
[]
}
]
},
{
title
:
"导航三"
,
icon
:
"el-icon-document"
,
children
:
[],
path
:
""
},
{
title
:
"导航四"
,
icon
:
"el-icon-setting"
,
children
:
[
{
title
:
"导航二"
,
icon
:
"el-icon-menu"
,
children
:
[],
path
:
""
}
],
path
:
""
}
],
rightMenu
:[
{
key
:
''
,
value
:
'查看s'
},
{
key
:
''
,
value
:
'新增'
},
{
key
:
''
,
value
:
'删除'
}
]
}
export
{
menuData
}
\ No newline at end of file
src/router/index.ts
View file @
8826207c
...
...
@@ -3,8 +3,18 @@ import Home from '../views/Home.vue';
const
routes
:
Array
<
RouteRecordRaw
>
=
[
{
path
:
'/'
,
name
:
'Home'
,
path
:
'/home'
,
name
:
'home'
,
component
:
Home
,
children
:
[
{
path
:
'next'
,
name
:
'next'
,
component
:
Home
,
}]
},
{
path
:
'/next'
,
name
:
'next'
,
component
:
Home
,
}
];
...
...
src/views/Home.vue
View file @
8826207c
<
template
>
<div
class=
"home"
>
<img
alt=
"Vue logo"
src=
"@/assets/images/logo.png"
>
<p>
{{
state
.
name
}}
</p>
<el-button
type=
"primary"
@
click=
"update"
>
ss
</el-button>
<el-container
style=
"height: 500px;margin:10px; border: 1px solid #eee"
>
<el-container>
<el-main
>
<div>
<div
style=
"margin-bottom: 20px;"
>
<el-button
size=
"small"
@
click=
"addTab(editableTabsValue)"
>
add tab
</el-button>
</div>
<el-tabs
v-model=
"editableTabsValue"
type=
"card"
closable
@
tab-remove=
"removeTab"
>
<el-tab-pane
v-for=
"(item, index) in editableTabs"
:key=
"item.name + index"
:label=
"item.title"
:name=
"item.name"
>
{{
item
.
content
}}
</el-tab-pane>
</el-tabs>
</div>
</el-main>
</el-container>
</el-container>
</
template
>
<
script
lang=
"ts"
>
import
{
computed
,
reactive
,
toRefs
}
from
'vue'
import
{
useStore
}
from
'vuex'
;
<
script
>
export
default
{
name
:
'Home'
,
components
:
{
components
:
{
},
data
()
{
const
item
=
{
date
:
"2016-05-02"
,
name
:
"王小虎"
,
address
:
"上海市普陀区金沙江路 1518 弄"
};
return
{
tableData
:
Array
(
20
).
fill
(
item
),
editableTabsValue
:
"2"
,
editableTabs
:
[
{
title
:
"Tab 1"
,
name
:
"1"
,
content
:
"Tab 1 content"
}
],
tabIndex
:
2
,
isCollapse
:
false
,
windowHeight
:
document
.
documentElement
.
clientHeight
};
},
setup
()
{
const
store
=
useStore
()
const
info
=
reactive
({
nnn
:
'1232'
,
a
:
242
})
const
update
=
()
=>
{
store
.
commit
(
'hello/changeName'
,
new
Date
().
getTime
())
methods
:
{
controllCollapse
()
{
this
.
isCollapse
=
!
this
.
isCollapse
;
},
addTab
(
targetName
)
{
let
newTabName
=
++
this
.
tabIndex
+
""
;
this
.
editableTabs
.
push
({
title
:
"New Tab"
,
name
:
newTabName
,
content
:
"New Tab content"
});
this
.
editableTabsValue
=
newTabName
;
},
removeTab
(
targetName
)
{
let
tabs
=
this
.
editableTabs
;
let
activeName
=
this
.
editableTabsValue
;
if
(
activeName
===
targetName
)
{
tabs
.
forEach
((
tab
,
index
)
=>
{
if
(
tab
.
name
===
targetName
)
{
let
nextTab
=
tabs
[
index
+
1
]
||
tabs
[
index
-
1
];
if
(
nextTab
)
{
activeName
=
nextTab
.
name
;
}
}
});
}
const
state
=
computed
(()
=>
store
.
state
.
hello
)
return
{
...
toRefs
(
info
),
state
,
update
,
this
.
editableTabsValue
=
activeName
;
this
.
editableTabs
=
tabs
.
filter
(
tab
=>
tab
.
name
!==
targetName
);
}
}
}
}
;
</
script
>
<
style
lang=
"scss"
scoped
>
</
style
>
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