@lambo-design/pro-layout 1.0.0-beta.1 → 1.0.0-beta.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/package.json +6 -7
  2. package/src/components/pro-layout-header.vue +18 -5
  3. package/src/components/pro-layout-logo.vue +38 -12
  4. package/src/components/pro-layout-nav.vue +109 -18
  5. package/src/components/pro-layout-other-menu.vue +137 -0
  6. package/src/components/pro-layout-sider-collapsed-menu.vue +91 -0
  7. package/src/components/pro-layout-sider-icon.vue +81 -0
  8. package/src/components/pro-layout-sider-menu-item.vue +37 -0
  9. package/src/components/pro-layout-sider.vue +230 -5
  10. package/src/components/pro-layout-tabs.vue +394 -5
  11. package/src/components/pro-layout-tools-user.vue +84 -0
  12. package/src/components/pro-layout-tools.vue +11 -5
  13. package/src/components/pro-layout-trigger.vue +2 -2
  14. package/src/index.vue +211 -21
  15. package/src/styles/images/inspur.png +0 -0
  16. package/src/styles/images/menuicon/icon-cang-s.png +0 -0
  17. package/src/styles/images/menuicon/icon-cang.png +0 -0
  18. package/src/styles/images/menuicon/icon-ding-s.png +0 -0
  19. package/src/styles/images/menuicon/icon-ding.png +0 -0
  20. package/src/styles/images/menuicon/icon-huo1-s.png +0 -0
  21. package/src/styles/images/menuicon/icon-huo1.png +0 -0
  22. package/src/styles/images/menuicon/icon-huo2-s.png +0 -0
  23. package/src/styles/images/menuicon/icon-huo2.png +0 -0
  24. package/src/styles/images/menuicon/icon-huo3-s.png +0 -0
  25. package/src/styles/images/menuicon/icon-huo3.png +0 -0
  26. package/src/styles/images/menuicon/icon-jin-s.png +0 -0
  27. package/src/styles/images/menuicon/icon-jin.png +0 -0
  28. package/src/styles/images/menuicon/icon-ke1-s.png +0 -0
  29. package/src/styles/images/menuicon/icon-ke1.png +0 -0
  30. package/src/styles/images/menuicon/icon-ke2-s.png +0 -0
  31. package/src/styles/images/menuicon/icon-ke2.png +0 -0
  32. package/src/styles/images/menuicon/icon-pin1-s.png +0 -0
  33. package/src/styles/images/menuicon/icon-pin1.png +0 -0
  34. package/src/styles/images/menuicon/icon-pin2-s.png +0 -0
  35. package/src/styles/images/menuicon/icon-pin2.png +0 -0
  36. package/src/styles/images/menuicon/icon-she-s.png +0 -0
  37. package/src/styles/images/menuicon/icon-she.png +0 -0
  38. package/src/styles/images/menuicon/icon-shi2-s.png +0 -0
  39. package/src/styles/images/menuicon/icon-shi2.png +0 -0
  40. package/src/styles/images/menuicon/icon-shi3-s.png +0 -0
  41. package/src/styles/images/menuicon/icon-shi3.png +0 -0
  42. package/src/styles/images/menuicon/icon-shu-s.png +0 -0
  43. package/src/styles/images/menuicon/icon-shu.png +0 -0
  44. package/src/styles/images/menuicon/icon-xi2-s.png +0 -0
  45. package/src/styles/images/menuicon/icon-xi2.png +0 -0
  46. package/src/styles/images/menuicon/icon-xiao-s.png +0 -0
  47. package/src/styles/images/menuicon/icon-xiao.png +0 -0
  48. package/src/styles/images/menuicon/icon-yang-s.png +0 -0
  49. package/src/styles/images/menuicon/icon-yang.png +0 -0
  50. package/src/styles/images/menuicon/icon-zhi-s.png +0 -0
  51. package/src/styles/images/menuicon/icon-zhi.png +0 -0
  52. package/src/styles/images/menuicon/icon-zhong-s.png +0 -0
  53. package/src/styles/images/menuicon/icon-zhong.png +0 -0
  54. package/src/styles/other-menu.less +159 -0
  55. package/src/utils/menuItem.js +21 -0
  56. package/src/utils/sider.js +25 -0
  57. package/src/styles/css/main.less +0 -92
  58. /package/src/styles/images/{logo.png → tobacco.png} +0 -0
package/package.json CHANGED
@@ -1,18 +1,17 @@
1
1
  {
2
2
  "name": "@lambo-design/pro-layout",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.100",
4
4
  "description": "",
5
5
  "main": "index.js",
6
- "scripts": {
7
-
8
- },
6
+ "scripts": {},
9
7
  "author": "lambo",
10
8
  "license": "ISC",
11
9
  "publishConfig": {
12
- "access": "public"
10
+ "access": "public",
11
+ "registry": "https://registry.npmjs.org/"
13
12
  },
14
13
  "devDependencies": {
15
- "@lambo-design/core": "workspace:*",
16
- "@lambo-design/shared": "workspace:*"
14
+ "@lambo-design/core": "workspace:^",
15
+ "@lambo-design/shared": "workspace:^"
17
16
  }
18
17
  }
@@ -1,13 +1,13 @@
1
1
  <template>
2
- <div class="pro-layout-header">
2
+ <div class="pro-layout-header-wrapper">
3
3
  <div class="trigger-box">
4
4
  <LamboProTrigger></LamboProTrigger>
5
5
  </div>
6
6
  <div class="logo-box">
7
- <LamboProLogo></LamboProLogo>
7
+ <LamboProLogo @clickLogo="handleClick"></LamboProLogo>
8
8
  </div>
9
9
  <div class="nav-box">
10
- <LamboProNav></LamboProNav>
10
+ <LamboProNav :accept-app-id="acceptAppId"></LamboProNav>
11
11
  </div>
12
12
  <div class="tools-box">
13
13
  <LamboProTools></LamboProTools>
@@ -22,20 +22,33 @@ import LamboProNav from './pro-layout-nav'
22
22
  import LamboProTools from './pro-layout-tools'
23
23
  export default {
24
24
  name: "pro-layout-header",
25
+ props:{
26
+ acceptAppId: {
27
+ type: String,
28
+ default:''
29
+ }
30
+ },
25
31
  components: {
26
32
  LamboProTrigger,
27
33
  LamboProLogo,
28
34
  LamboProNav,
29
35
  LamboProTools
36
+ },
37
+ methods:{
38
+ handleClick(){
39
+ this.$emit('clickLogo')
40
+ }
30
41
  }
31
42
  }
32
43
  </script>
33
44
 
34
45
  <style scoped lang="less">
35
- .pro-layout-header{
36
- overflow: hidden;
46
+ .pro-layout-header-wrapper{
47
+ width: auto;
48
+ height: 64px;
37
49
  .trigger-box{
38
50
  float: left;
51
+ height: inherit;
39
52
  }
40
53
  .logo-box{
41
54
  float: left;
@@ -1,6 +1,8 @@
1
1
  <template>
2
- <div class="pro-layout-logo">
3
- <div class="logo"></div>
2
+ <div class="pro-layout-logo-wrapper">
3
+ <div class="logo" :style="logoStyle"
4
+ @click="handleClick"
5
+ ></div>
4
6
  <div class="divider"></div>
5
7
  <div class="system-name">{{systemName}}</div>
6
8
  </div>
@@ -10,22 +12,44 @@
10
12
  import Bus from '@lambo-design/shared/utils/bus'
11
13
  export default {
12
14
  name: "pro-layout-logo",
15
+ props:{
16
+ routeName:String,
17
+ default:''
18
+ },
13
19
  data(){
14
20
  return {
15
- systemName: '后台管理系统'
21
+ systemInfo: {},
22
+ systemName: '后台管理系统',
23
+ isHovered: false,
24
+ }
25
+ },
26
+ computed:{
27
+ logoStyle(){
28
+ if (this.systemInfo && this.systemInfo.systemLogo) {
29
+ return 'background: url("' + this.systemInfo.systemLogo + '") no-repeat;background-size: 100%;'
30
+ }
31
+ return '';
16
32
  }
17
33
  },
18
34
  methods: {
35
+ handleClick(){
36
+ this.$emit('clickLogo')
37
+ },
19
38
  initListener(){
20
- Bus.$on('system-name-change',(data)=>{
21
- this.systemNameChange(data)
39
+ Bus.$on('system-info',(data)=>{
40
+ this.initSystem(data)
22
41
  });
23
42
  },
24
43
  destroyListener(){
25
- Bus.$off('system-name-change')
44
+ Bus.$off('system-info')
26
45
  },
27
- systemNameChange(data){
28
- this.systemName = data;
46
+ initSystem(data){
47
+ if (data) {
48
+ this.systemInfo = data;
49
+ if (data.systemName) {
50
+ this.systemName = data.systemName;
51
+ }
52
+ }
29
53
  }
30
54
  },
31
55
  created(){
@@ -38,14 +62,16 @@ export default {
38
62
  </script>
39
63
 
40
64
  <style scoped lang="less">
41
- .pro-layout-logo{
65
+ .pro-layout-logo-wrapper{
66
+ overflow: hidden;
42
67
  .logo{
68
+ cursor:pointer;
43
69
  width: 150px;
44
70
  height: 55px;
45
- background: url("../styles/images/logo.png") no-repeat;
71
+ background: url("../styles/images/inspur.png") no-repeat;
46
72
  background-size: 100%;
47
73
  float: left;
48
- margin-top: 8px;
74
+ margin-top: 20px;
49
75
  }
50
76
  .divider{
51
77
  height: 33px;
@@ -61,4 +87,4 @@ export default {
61
87
  margin-right: 15px;
62
88
  }
63
89
  }
64
- </style>
90
+ </style>
@@ -1,17 +1,16 @@
1
1
  <template>
2
- <div class="pro-layout-nav">
3
- <Menu mode="horizontal" :active-name="activeName" @on-select="selectApp">
2
+ <div class="pro-layout-nav-wrapper">
3
+ <Menu ref="topNav" mode="horizontal" theme="dark" :active-name="activeName" @on-select="selectApp">
4
4
  <MenuItem :name="item.appId" v-for="item in topMenList" :key="item.appId">
5
- <Icon :type="item.icon ? item.icon : 'ios-paper'" />
6
5
  {{item.name}}
6
+ <div class="line"></div>
7
7
  </MenuItem>
8
8
  <Submenu name="other" v-if="otherList.length > 0">
9
9
  <template slot="title">
10
10
  ...
11
11
  </template>
12
12
  <MenuItem :name="item.appId" v-for="item in otherList" :key="item.appId">
13
- <Icon :type="item.icon ? item.icon : 'ios-paper'" />
14
- {{item.name}}
13
+ {{item.name}}
15
14
  </MenuItem>
16
15
  </Submenu>
17
16
  </Menu>
@@ -20,15 +19,25 @@
20
19
 
21
20
  <script>
22
21
  import Bus from "@lambo-design/shared/utils/bus";
22
+ import {deepCopy} from "@lambo-design/shared/utils/assist";
23
+ import config from "@lambo-design/shared/config/config";
23
24
 
24
25
  export default {
25
26
  name: "pro-layout-logo",
27
+ props:{
28
+ acceptAppId: {
29
+ type: String,
30
+ default: ''
31
+ }
32
+ },
26
33
  data(){
27
34
  return {
28
35
  navList : [],
29
36
  topMenList : [],
30
37
  otherList : [],
31
- activeName : ''
38
+ activeName : '',
39
+ topMenuNum : 4,
40
+ originMenuList: []
32
41
  }
33
42
  },
34
43
  methods: {
@@ -36,28 +45,67 @@ export default {
36
45
  Bus.$on('nav-list',(data)=>{
37
46
  this.initNav(data)
38
47
  });
48
+ Bus.$on('change-app', ({appId,appInfo})=> {
49
+ this.changeApp(appId,appInfo)
50
+ });
51
+ Bus.$on('menu-list',(data)=>{
52
+ this.initMenu(data)
53
+ });
39
54
  },
40
55
  destroyListener(){
41
56
  Bus.$off('nav-list')
57
+ Bus.$off('menu-list')
58
+ Bus.$off('change-app')
42
59
  },
43
60
  initNav(data){
61
+ if (data.toString() === this.navList.toString()) {
62
+ return;
63
+ }
44
64
  this.navList = data;
45
- if (data.length > 5) {
46
- this.topMenList = this.navList.sublist(0,5);
47
- this.otherList = this.navList.sublist(5,this.navList.length);
65
+ if (data.length > this.topMenuNum) {
66
+ let navList = deepCopy(data);
67
+ this.topMenList = navList.splice(0,this.topMenuNum);
68
+ this.otherList = navList;
48
69
  } else {
49
70
  this.topMenList = this.navList
50
71
  }
51
- },
52
- selectApp(appId){
53
- let appInfo = {};
54
- for (let item of this.navList){
55
- if (item.appId == appId) {
56
- appInfo = item;
57
- break;
72
+ if (this.topMenList.length > 0){
73
+ let appId = this.topMenList[0].appId;
74
+ for (let i = 0; i < this.topMenList.length; i++) {
75
+ if (this.topMenList[i].selected == true){
76
+ appId = this.topMenList[i].appId;
77
+ }
58
78
  }
79
+ if (this.activeName) {
80
+ appId = this.activeName;
81
+ }
82
+ this.selectApp(appId);
59
83
  }
60
- Bus.$emit("change-app", {appId,appInfo})
84
+ },
85
+ initMenu(data){
86
+ this.originMenuList = deepCopy(data);
87
+ },
88
+ selectApp(appId){
89
+ this.activeName = appId;
90
+ let res = this.navList.filter(app => app.appId == appId);
91
+ Bus.$emit('change-app', {appId,appInfo:res[0]})
92
+ },
93
+ changeApp(appId,appInfo) {
94
+ this.activeName = appId;
95
+ this.$nextTick(() => {
96
+ this.$refs.topNav.updateActiveName()
97
+ })
98
+ }
99
+ },
100
+ watch: {
101
+ activeName(){
102
+ this.$nextTick(()=>{
103
+ this.$refs.topNav.updateActiveName();
104
+ })
105
+ },
106
+ acceptAppId(val) {
107
+ console.log('监听成功')
108
+ this.selectApp(val)
61
109
  }
62
110
  },
63
111
  created(){
@@ -69,6 +117,49 @@ export default {
69
117
  }
70
118
  </script>
71
119
 
72
- <style scoped>
120
+ <style scoped lang="less">
121
+ @import '@lambo-design/core/src/styles/default.less';
122
+ .pro-layout-nav-wrapper{
123
+ .ivu-menu{
124
+ .ivu-menu-item{
125
+ &:hover{
126
+ background: rgba(255,255,255,0.2);
127
+ .line{
128
+ border-bottom: 2px solid var(--primary-color,@_primary-color);
129
+ }
130
+ }
131
+ &.ivu-menu-item-active,&.ivu-menu-item-selected{
132
+ background: rgba(255,255,255,0.2);
133
+ .line{
134
+ border-bottom: 2px solid var(--primary-color,@_primary-color);
135
+ }
136
+ }
137
+ }
138
+ /deep/.ivu-menu-submenu{
139
+ .ivu-menu-submenu-title > i{
140
+ &.ivu-menu-submenu-title-icon{
141
+
142
+ }
143
+ }
144
+ .ivu-select-dropdown{
145
+ background: var(--menu-dark-title,@_menu-dark-title);
146
+ color: var(--heading-color-dark,@_heading-color-dark);
147
+ .ivu-menu-drop-list{
148
+ .ivu-menu-item{
149
+ color: var(--menu-dark-subsidiary-color,@_menu-dark-subsidiary-color);
150
+ &:hover{
151
+ background: rgba(255,255,255,0.2);
152
+ color: var(--heading-color-dark,@_heading-color-dark);
153
+ }
154
+ &.ivu-menu-item-active,&.ivu-menu-item-selected{
155
+ background: rgba(255,255,255,0.2);
156
+ color: var(--heading-color-dark,@_heading-color-dark);
157
+ }
158
+ }
159
+ }
160
+ }
161
+ }
162
+ }
163
+ }
73
164
 
74
165
  </style>
@@ -0,0 +1,137 @@
1
+ <template>
2
+ <div :class="classes">
3
+ <div class="other-menu-item" @click="onChange('history')">
4
+ <Tooltip :disabled="!collapsed" content="历史" placement="right" transfer>
5
+ <div>
6
+ <Icon class="other-menu-icon" type="md-time"/>
7
+ <span class="other-menu-title"> 历史</span>
8
+ </div>
9
+ </Tooltip>
10
+ </div>
11
+ <div class="other-menu-item" @click="onChange('collect')">
12
+ <Tooltip :disabled="!collapsed" content="收藏" placement="right" transfer>
13
+ <div>
14
+ <Icon class="other-menu-icon" type="md-star-outline"/>
15
+ <span class="other-menu-title"> 收藏</span>
16
+ </div>
17
+
18
+ </Tooltip>
19
+ </div>
20
+ <Drawer v-model="drawer.model"
21
+ :class-name="drawerClasses"
22
+ :closable="false"
23
+ :mask-style="{backgroundColor: 'unset'}"
24
+ :scrollable="true"
25
+ :title="drawer.title"
26
+ placement="left"
27
+ >
28
+ <div v-if="drawer.type=='history'" class="other-menu-history">
29
+ <div v-for="item in list" class="other-menu-history-item">
30
+ <div class="content" @click="handleClick(item)">
31
+ <common-icon :type="item.icon"></common-icon>
32
+ <span> {{ item.label }}</span>
33
+ </div>
34
+ <div class="delete">
35
+ <common-icon type="ios-close" @click.native="handleHistoryDelete(item)"></common-icon>
36
+ </div>
37
+ </div>
38
+ </div>
39
+ <div v-if="drawer.type=='collect'" class="other-menu-collect">
40
+ <div v-for="item in list" class="other-menu-collect-item" @click="handleClick(item)">
41
+ <div class="content">
42
+ <Tooltip :content="item.label" :delay="1000">
43
+ <common-icon :size="40" :type="item.icon"></common-icon>
44
+ </Tooltip>
45
+ </div>
46
+ <div class="delete">
47
+ <common-icon type="ios-close" @click.native.stop="handleCollectDelete(item)"></common-icon>
48
+ </div>
49
+ </div>
50
+ </div>
51
+ </Drawer>
52
+ </div>
53
+ </template>
54
+
55
+ <script>
56
+ import ajax from '@lambo-design/shared/utils/ajax';
57
+ import config from "@lambo-design/shared/config/config";
58
+
59
+ export default {
60
+ name: "other-menu",
61
+ components: {},
62
+ props: {
63
+ collapsed: {
64
+ type: Boolean
65
+ },
66
+ },
67
+ data() {
68
+ return {
69
+ drawer: {
70
+ model: false,
71
+ url: '',
72
+ title: '',
73
+ type: '',
74
+ },
75
+ list: []
76
+ }
77
+ },
78
+ computed: {
79
+ classes() {
80
+ let classes = ["other-menu"]
81
+ return this.collapsed ? ["other-menu-collapsed", ...classes] : [...classes]
82
+ },
83
+ drawerClasses() {
84
+ return this.collapsed ? "other-menu-drawer-wrap-collapsed" : "other-menu-drawer-wrap"
85
+ }
86
+ },
87
+ methods: {
88
+ onChange(value) {
89
+ if (value == 'history') {
90
+ this.drawer.title = '历史菜单'
91
+ this.drawer.url = '/manage/upmsMenuHistory/list'
92
+
93
+ } else {
94
+ this.drawer.title = '收藏菜单'
95
+ this.drawer.url = '/manage/upmsMenuCollect/list'
96
+ }
97
+ this.getList()
98
+ this.drawer.type = value
99
+ this.drawer.model = !this.drawer.model
100
+ },
101
+ getList() {
102
+ this.list = []
103
+ ajax.get(config.upmsServerContext + this.drawer.url).then(resp => {
104
+ if (resp.data.code == 1) {
105
+ this.list = resp.data.data
106
+ if (this.drawer.type == 'collect') {
107
+ this.$store.commit('setCollectMenuList', this.list)
108
+ }
109
+ }
110
+ })
111
+ },
112
+ handleClick(item) {
113
+ this.$emit('on-select', item.name)
114
+ this.drawer.model = false
115
+ },
116
+ handleHistoryDelete(item) {
117
+ ajax.get(config.upmsServerContext + "/manage/upmsMenuHistory/delete/" + item.historyId).then(resp => {
118
+ if (resp.data.code == 1) {
119
+ this.getList()
120
+ }
121
+ })
122
+ },
123
+ handleCollectDelete(item) {
124
+ ajax.get(config.upmsServerContext + "/manage/upmsMenuCollect/delete/" + item.collectId).then(resp => {
125
+ if (resp.data.code == 1) {
126
+ this.getList()
127
+ }
128
+ })
129
+ }
130
+ }
131
+ }
132
+ </script>
133
+
134
+
135
+ <style lang="less">
136
+ @import '../styles/other-menu.less';
137
+ </style>
@@ -0,0 +1,91 @@
1
+ <template>
2
+ <Dropdown ref="dropdown" :class="hideTitle ? '' : 'collased-menu-dropdown'" :placement="placement"
3
+ :transfer="true" @on-click="handleClick">
4
+ <a :style="{textAlign: !hideTitle ? 'left' : '',padding: !hideTitle ? '0px' : ''}" class="drop-menu-a" type="text"
5
+ @mouseover="handleMousemove($event, children)">
6
+ <ProLayoutSiderIcon :icon-type="parentItem.meta.icon" :icon-size="hideTitle ? 26 : 14"></ProLayoutSiderIcon>
7
+ <span v-if="!hideTitle" class="menu-title">{{ showTitle(parentItem) }}</span>
8
+ <Icon v-if="!hideTitle" :size="16"type="ios-arrow-forward"/>
9
+ </a>
10
+ <DropdownMenu ref="dropdown" slot="list" style="width: auto">
11
+ <template v-for="child in children">
12
+ <ProLayoutSiderCollapsedMenu v-if="showChildren(child)" :key="`drop-${child.name}`"
13
+ :parent-item="child">
14
+ </ProLayoutSiderCollapsedMenu>
15
+ <DropdownItem v-else :key="`drop-${child.name}`" :name="child.name">
16
+ <ProLayoutSiderIcon :icon-type="child.meta.icon"></ProLayoutSiderIcon>
17
+ <span class="menu-title">{{ showTitle(child) }}</span>
18
+ </DropdownItem>
19
+ </template>
20
+ </DropdownMenu>
21
+ </Dropdown>
22
+ </template>
23
+ <script>
24
+ import sider from '../utils/sider'
25
+ import menuItem from '../utils/menuItem'
26
+ import {findNodeUpperByClasses} from '@lambo-design/shared/utils/platform'
27
+
28
+ export default {
29
+ name: 'ProLayoutSiderCollapsedMenu',
30
+ mixins: [sider, menuItem],
31
+ props: {
32
+ hideTitle: {
33
+ type: Boolean,
34
+ default: false
35
+ }
36
+ },
37
+ data() {
38
+ return {
39
+ placement: 'right-start'
40
+ }
41
+ },
42
+ methods: {
43
+ handleClick(name) {
44
+ this.$emit('on-click', name)
45
+ },
46
+ handleMousemove(event, children) {
47
+ const {pageY} = event
48
+ const height = children.length * 38
49
+ const isOverflow = pageY + height < window.innerHeight
50
+ this.placement = isOverflow ? 'right-start' : 'right-end'
51
+ }
52
+ },
53
+ mounted() {
54
+ let dropdown = findNodeUpperByClasses(this.$refs.dropdown.$el, ['ivu-select-dropdown', 'ivu-dropdown-transfer'])
55
+ if (dropdown) dropdown.style.overflow = 'visible'
56
+ }
57
+ }
58
+ </script>
59
+ <style lang="less" scoped>
60
+ @import "@lambo-design/core/src/styles/default";
61
+ .collased-menu-dropdown {
62
+ width: 100%;
63
+ margin: 0;
64
+ line-height: normal;
65
+ padding: 7px 0 6px 16px;
66
+ clear: both;
67
+ font-size: var(--font-size-base, 14px) !important;
68
+ white-space: nowrap;
69
+ list-style: none;
70
+ cursor: pointer;
71
+ transition: background 0.2s ease-in-out;
72
+ display: block;
73
+ &:hover{
74
+ color: var(--heading-color, @_heading-color);
75
+ background: rgba(26,26,26,0.05);
76
+ }
77
+ /deep/.ivu-dropdown-rel{
78
+ a.drop-menu-a{
79
+ display: inline-block;
80
+ width: 100%;
81
+ font-weight: normal;
82
+ margin-left: -5px;
83
+ color: var(--text-color, @_text-color) !important;
84
+ text-decoration: none;
85
+ &:hover{
86
+ color: var(--heading-color, @_heading-color) !important;
87
+ }
88
+ }
89
+ }
90
+ }
91
+ </style>
@@ -0,0 +1,81 @@
1
+ <template>
2
+ <Icon v-if="isIvuIcon" :type="typeName" :size="iconSize"></Icon>
3
+ <i v-else class="iconfont" :style="renderImage"></i>
4
+ </template>
5
+
6
+ <script>
7
+ export default {
8
+ name: "pro-layout-sider-icon",
9
+ props: {
10
+ iconType: {
11
+ type: String,
12
+ default: 'icon'
13
+ },
14
+ iconSize: {
15
+ type: String | Number,
16
+ default: 14
17
+ }
18
+ },
19
+ computed: {
20
+ isIvuIcon(){
21
+ if (this.iconType && this.iconType.indexOf('iconfont') > -1) {
22
+ return false
23
+ }
24
+ return true;
25
+ },
26
+ typeName(){
27
+ let iconType = this.iconType;
28
+ if (!iconType) {
29
+ iconType = 'ios-folder';
30
+ }
31
+ if (iconType == 'icon'){
32
+ iconType = 'ios-folder'
33
+ }
34
+ return iconType;
35
+ },
36
+ renderImage(){
37
+ let iconType = this.iconType;
38
+ if (!iconType) {
39
+ iconType = 'icon'
40
+ }
41
+ if (iconType.indexOf('iconfont') > -1) {
42
+ let imgName = iconType.replace('iconfont','').replace(/\s+/g,'');
43
+ return 'background: url('+ require('../styles/images/menuicon/' + imgName + '-s.png') +') no-repeat;background-size: 100%;';
44
+ }
45
+ return '';
46
+ }
47
+ }
48
+ }
49
+ </script>
50
+
51
+ <style scoped lang="less">
52
+ .iconfont{
53
+ width: 14px;
54
+ height: 14px;
55
+ float: left;
56
+ margin-top: 6px;
57
+ filter: brightness(0.8);
58
+ }
59
+ .ivu-menu-submenu{
60
+ .ivu-menu-submenu-title{
61
+ &:hover {
62
+ .iconfont{
63
+ filter: brightness(1.4);
64
+ }
65
+ }
66
+ }
67
+ }
68
+ .menu-collapsed{
69
+ a.drop-menu-a{
70
+ .iconfont{
71
+ width: 26px;
72
+ height: 26px;
73
+ }
74
+ &:hover{
75
+ .iconfont{
76
+ filter: brightness(1.4);
77
+ }
78
+ }
79
+ }
80
+ }
81
+ </style>
@@ -0,0 +1,37 @@
1
+ <template>
2
+ <Submenu v-show="isShow" :name="`${parentName}`">
3
+ <template slot="title">
4
+ <ProLayoutSiderIcon :icon-type="parentItem.meta.icon"></ProLayoutSiderIcon>
5
+ <span>{{ showTitle(parentItem) }}</span>
6
+ </template>
7
+ <template v-for="item in children">
8
+ <template v-if="item.children && item.children.length === 1">
9
+ <ProLayoutSiderMenuItem v-if="showChildren(item)" :key="`menu-${item.name}`"
10
+ :parent-item="item">
11
+ </ProLayoutSiderMenuItem>
12
+ <menu-item v-else :key="`menu-${item.children[0].name}`" :name="getNameOrHref(item, true)">
13
+ <ProLayoutSiderIcon :icon-type="item.meta.icon"></ProLayoutSiderIcon>
14
+ <span>{{ showTitle(item.children[0]) }}</span>
15
+ </menu-item>
16
+ </template>
17
+ <template v-else>
18
+ <ProLayoutSiderMenuItem v-if="showChildren(item)" :key="`menu-${item.name}`"
19
+ :parent-item="item">
20
+ </ProLayoutSiderMenuItem>
21
+ <menu-item v-else :key="`menu-${item.name}`" :name="getNameOrHref(item)">
22
+ <ProLayoutSiderIcon :icon-type="item.meta.icon"></ProLayoutSiderIcon>
23
+ <span>{{ showTitle(item) }}</span>
24
+ </menu-item>
25
+ </template>
26
+ </template>
27
+ </Submenu>
28
+ </template>
29
+ <script>
30
+ import sider from '../utils/sider'
31
+ import menuItem from '../utils/menuItem'
32
+
33
+ export default {
34
+ name: 'ProLayoutSiderMenuItem',
35
+ mixins: [sider, menuItem],
36
+ }
37
+ </script>