@v2coding/ui 0.1.1 → 0.1.6

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.
@@ -20,7 +20,7 @@
20
20
  </div>
21
21
  </div>
22
22
  </div>
23
- <flex-scroll-view>
23
+ <fill-view>
24
24
  <el-table
25
25
  ref="table"
26
26
  height="100%"
@@ -42,7 +42,7 @@
42
42
  <div class="ui-table-empty">暂无数据</div>
43
43
  </template>
44
44
  </el-table>
45
- </flex-scroll-view>
45
+ </fill-view>
46
46
  <div v-show="hasPagination" class="footer-bar">
47
47
  <slot name="footer-bar"/>
48
48
  </div>
@@ -50,6 +50,7 @@
50
50
  </div>
51
51
  </template>
52
52
  <script>
53
+ import FillView from '../fill-view/fill-view';
53
54
  import ExportsMixin from '../exports/mixin';
54
55
  import RemoteExportsDialog from '../exports/remote-exports-dialog';
55
56
 
@@ -595,12 +596,13 @@
595
596
  // },
596
597
  },
597
598
  components: {
599
+ FillView,
598
600
  RemoteExportsDialog,
599
601
  Refresh: {
600
602
  render(createElement) {
601
603
  return createElement('el-tooltip', {props: {content: '刷新'}}, [
602
604
  createElement('el-button', {
603
- props: {icon: 'el-icon-fa-refresh', size: 'mini', circle: true},
605
+ props: {icon: 'el-icon-refresh', size: 'mini', circle: true},
604
606
  on: {click: this.$parent.reload},
605
607
  }),
606
608
  ]);
@@ -610,7 +612,7 @@
610
612
  render(createElement) {
611
613
  return createElement('el-tooltip', {props: {content: '导出Excel'}}, [
612
614
  createElement('el-button', {
613
- props: {icon: 'el-icon-fa-cloud-download', size: 'mini', circle: true},
615
+ props: {icon: 'el-icon-download', size: 'mini', circle: true},
614
616
  on: {click: this.$parent.exportsRemote},
615
617
  }),
616
618
  ]);
@@ -665,7 +667,7 @@
665
667
  }
666
668
  return createElement('el-tooltip', {props: {content: this.$parent.searchBarVisible ? '隐藏查询区域' : '显示查询区域'}}, [
667
669
  createElement('el-button', {
668
- props: {icon: 'el-icon-fa-search', circle: true},
670
+ props: {icon: 'el-icon-search', circle: true},
669
671
  on: {click: this.$parent.toggleSearchBarVisible},
670
672
  }),
671
673
  ]);
@@ -777,7 +779,7 @@
777
779
 
778
780
  .ui-table-empty {
779
781
  padding-top: 110px;
780
- background: url("../../../assets/img/empty.svg") center top no-repeat;
782
+ background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTg0IiBoZWlnaHQ9IjE1MiIgdmlld0JveD0iMCAwIDE4NCAxNTIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDI0IDMxLjY3KSI+CiAgICAgIDxlbGxpcHNlIGZpbGwtb3BhY2l0eT0iLjgiIGZpbGw9IiNGNUY1RjciIGN4PSI2Ny43OTciIGN5PSIxMDYuODkiIHJ4PSI2Ny43OTciIHJ5PSIxMi42NjgiPjwvZWxsaXBzZT4KICAgICAgPHBhdGggZD0iTTEyMi4wMzQgNjkuNjc0TDk4LjEwOSA0MC4yMjljLTEuMTQ4LTEuMzg2LTIuODI2LTIuMjI1LTQuNTkzLTIuMjI1aC01MS40NGMtMS43NjYgMC0zLjQ0NC44MzktNC41OTIgMi4yMjVMMTMuNTYgNjkuNjc0djE1LjM4M2gxMDguNDc1VjY5LjY3NHoiIGZpbGw9IiNBRUI4QzIiPjwvcGF0aD4KICAgICAgPHBhdGggZD0iTTEwMS41MzcgODYuMjE0TDgwLjYzIDYxLjEwMmMtMS4wMDEtMS4yMDctMi41MDctMS44NjctNC4wNDgtMS44NjdIMzEuNzI0Yy0xLjU0IDAtMy4wNDcuNjYtNC4wNDggMS44NjdMNi43NjkgODYuMjE0djEzLjc5Mmg5NC43NjhWODYuMjE0eiIgZmlsbD0idXJsKCNsaW5lYXJHcmFkaWVudC0xKSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTMuNTYpIj48L3BhdGg+CiAgICAgIDxwYXRoIGQ9Ik0zMy44MyAwaDY3LjkzM2E0IDQgMCAwIDEgNCA0djkzLjM0NGE0IDQgMCAwIDEtNCA0SDMzLjgzYTQgNCAwIDAgMS00LTRWNGE0IDQgMCAwIDEgNC00eiIgZmlsbD0iI0Y1RjVGNyI+PC9wYXRoPgogICAgICA8cGF0aAogICAgICAgIGQ9Ik00Mi42NzggOS45NTNoNTAuMjM3YTIgMiAwIDAgMSAyIDJWMzYuOTFhMiAyIDAgMCAxLTIgMkg0Mi42NzhhMiAyIDAgMCAxLTItMlYxMS45NTNhMiAyIDAgMCAxIDItMnpNNDIuOTQgNDkuNzY3aDQ5LjcxM2EyLjI2MiAyLjI2MiAwIDEgMSAwIDQuNTI0SDQyLjk0YTIuMjYyIDIuMjYyIDAgMCAxIDAtNC41MjR6TTQyLjk0IDYxLjUzaDQ5LjcxM2EyLjI2MiAyLjI2MiAwIDEgMSAwIDQuNTI1SDQyLjk0YTIuMjYyIDIuMjYyIDAgMCAxIDAtNC41MjV6TTEyMS44MTMgMTA1LjAzMmMtLjc3NSAzLjA3MS0zLjQ5NyA1LjM2LTYuNzM1IDUuMzZIMjAuNTE1Yy0zLjIzOCAwLTUuOTYtMi4yOS02LjczNC01LjM2YTcuMzA5IDcuMzA5IDAgMCAxLS4yMjItMS43OVY2OS42NzVoMjYuMzE4YzIuOTA3IDAgNS4yNSAyLjQ0OCA1LjI1IDUuNDJ2LjA0YzAgMi45NzEgMi4zNyA1LjM3IDUuMjc3IDUuMzdoMzQuNzg1YzIuOTA3IDAgNS4yNzctMi40MjEgNS4yNzctNS4zOTNWNzUuMWMwLTIuOTcyIDIuMzQzLTUuNDI2IDUuMjUtNS40MjZoMjYuMzE4djMzLjU2OWMwIC42MTctLjA3NyAxLjIxNi0uMjIxIDEuNzg5eiIKICAgICAgICBmaWxsPSIjRENFMEU2Ij48L3BhdGg+CiAgICA8L2c+CiAgICA8cGF0aCBkPSJNMTQ5LjEyMSAzMy4yOTJsLTYuODMgMi42NWExIDEgMCAwIDEtMS4zMTctMS4yM2wxLjkzNy02LjIwN2MtMi41ODktMi45NDQtNC4xMDktNi41MzQtNC4xMDktMTAuNDA4QzEzOC44MDIgOC4xMDIgMTQ4LjkyIDAgMTYxLjQwMiAwIDE3My44ODEgMCAxODQgOC4xMDIgMTg0IDE4LjA5N2MwIDkuOTk1LTEwLjExOCAxOC4wOTctMjIuNTk5IDE4LjA5Ny00LjUyOCAwLTguNzQ0LTEuMDY2LTEyLjI4LTIuOTAyeiIgZmlsbD0iI0RDRTBFNiI+PC9wYXRoPgogICAgPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTQ5LjY1IDE1LjM4MykiIGZpbGw9IiNGRkYiPgogICAgICA8ZWxsaXBzZSBjeD0iMjAuNjU0IiBjeT0iMy4xNjciIHJ4PSIyLjg0OSIgcnk9IjIuODE1Ij48L2VsbGlwc2U+CiAgICAgIDxwYXRoIGQ9Ik01LjY5OCA1LjYzSDBMMi44OTguNzA0ek05LjI1OS43MDRoNC45ODVWNS42M0g5LjI1OXoiPjwvcGF0aD4KICAgIDwvZz4KICA8L2c+Cjwvc3ZnPgo=) center top no-repeat;
781
783
  background-size: auto 100px;
782
784
  color: rgba(0, 0, 0, 0.65);
783
785
  font-size: 14px;
@@ -1,304 +0,0 @@
1
- <template>
2
- <div>
3
- <div class="ui-image-upload-file">
4
- <div class="item" v-show="showPhoto">
5
- <div class="modal">
6
- <a :href="photoUrl" target="_blank"><i class="el-icon-zoom-in"></i></a>
7
- <i class="el-icon-delete" @click="remove()"></i>
8
- </div>
9
- <div class="image" :style="{'background-image': `url(${imgUrl})`}"></div>
10
- </div>
11
- <el-row v-show="!showPhoto">
12
- <div @click="showDialog" class="item upload-btn">
13
- <i class="el-icon-fa-camera"></i>
14
- </div>
15
- </el-row>
16
- </div>
17
- <ui-dialog :title="title" :visible.sync="visible" width="30%" :confirm="onConfirm">
18
- <el-row v-loading="videoLoading">
19
- <video id="videos" width="100%"/>
20
- </el-row>
21
- <el-row class="close">
22
- <el-col v-show="false">
23
- <canvas id="canvas" :width="w + 'px'" :height="h + 'px'"/>
24
- </el-col>
25
- <el-col :span="12">
26
- <img :src="imgUrl" class="show-img" width="100%" alt="">
27
- </el-col>
28
- <el-col :span="12" class="buttons">
29
- <div class="buttons-desc">
30
- <div class="capture">
31
- <div
32
- :class="{'out-circle': true, reduce: isReduce}"
33
- @click="capture"
34
- @mousedown="isReduce = true"
35
- @mouseup="isReduce = false"
36
- @mouseleave="isReduce = false"
37
- >
38
- <i class="el-icon-fa-camera"></i>
39
- </div>
40
- </div>
41
- <el-button @click="updatePortrait">上传照片</el-button>
42
- </div>
43
- </el-col>
44
- </el-row>
45
- <span slot="footer" class="dialog-footer">
46
- <el-button>取 消</el-button>
47
- <el-button type="primary">确 定</el-button>
48
- </span>
49
- </ui-dialog>
50
- </div>
51
- </template>
52
- <script>
53
- import FieldMixin from './field.mixin';
54
- import Upload from './field.helper.upload';
55
-
56
- export default {
57
- name: 'ui-field-upload-portrait',
58
- mixins: [FieldMixin],
59
- data() {
60
- return {
61
- videoLoading: true, //相机初始化loading
62
- isReduce: false, //拍照按钮动画
63
- front: true,//是否打开后摄像头
64
- showPhoto: false,
65
- imgUrl: '',
66
- photoUrl: '',
67
- w: 320,
68
- h: 240,
69
- };
70
- },
71
- props: {
72
- params: {
73
- type: Object,
74
- default: () => ({
75
- rootDirName: 'image',
76
- fileType: 2,
77
- }),
78
- },
79
- title: {
80
- type: String,
81
- default: '请上传照片',
82
- },
83
- filename: {
84
- type: String,
85
- default: 'file',
86
- },
87
- url: {
88
- type: String,
89
- default: '/api/oss/upload',
90
- },
91
- uploadType: {
92
- type: String,
93
- validator: (val) => ['oss', 'default'].includes(val),
94
- default: 'default',
95
- },
96
- visible: {
97
- type: Boolean,
98
- default: false,
99
- },
100
- },
101
- methods: {
102
- remove() {
103
- this.imgUrl = '';
104
- this.showPhoto = false;
105
- },
106
- showDialog() {
107
- this.visible = true;
108
- this.init();
109
- },
110
- onConfirm() {
111
- if (this.photoUrl === '') {
112
- this.$message.error('请上传图片后点击确定');
113
- return;
114
- }
115
- this.visible = false;
116
- this.onChange(this.photoUrl);
117
- this.showPhoto = true;
118
- },
119
- //点击拍照
120
- capture() {
121
- const videoDom = document.getElementById('videos');
122
- const canvas = document.getElementById('canvas');
123
- const ctx = canvas.getContext('2d');
124
- ctx.drawImage(videoDom, 0, 0, this.w, this.h);
125
- this.imgUrl = canvas.toDataURL();
126
- },
127
- //初始化 打开摄像头
128
- init() {
129
- const _this = this;
130
- const constraints = {video: {width: this.w, height: this.h, facingMode: {exact: this.front ? 'user' : 'environment'}}};
131
- navigator.mediaDevices.getUserMedia(constraints).then(function(mediaStream) {
132
- const video = document.querySelector('video');
133
- video.srcObject = mediaStream;
134
- _this.videoLoading = false;
135
- video.onloadedmetadata = function() {
136
- video.play();
137
- };
138
- }).catch(function(err) {
139
- console.log(err.name + ': ' + err.message);
140
- }); // 总是在最后检查错误
141
- },
142
- //base64转file
143
- toFile(value, fileName) {
144
- if (value !== null || ('' && value.indexOf('base'))) {
145
- const arr = value.split(','), mime = arr[0].match(/:(.*?);/)[1], bsTr = atob(arr[1]);
146
- let n = bsTr.length, u8arr = new Uint8Array(n);
147
- while (n--) {
148
- u8arr[n] = bsTr.charCodeAt(n);
149
- }
150
- return new File([u8arr], fileName, {type: mime});
151
- }
152
- },
153
- //上传照片
154
- updatePortrait() {
155
- if (!this.imgUrl) {
156
- this.$message.error('请先拍照后上传');
157
- return;
158
- }
159
- const file = this.toFile(this.imgUrl, 'file.png');
160
- console.log(file);
161
- const uploadServer = Upload[this.uploadType] || Upload.default;
162
- uploadServer(this.url, this.params, {file, filename: this.filename}).then((result) => {
163
- console.log(result);
164
- this.photoUrl = result.content.url;
165
- if (!result.success) {
166
- this.$message.error(result.message || '上传失败');
167
- return;
168
- }
169
- this.$message.success('上传成功');
170
- this.onChange('');
171
- });
172
- },
173
- },
174
- };
175
- </script>
176
- <style lang="less" scoped>
177
- .ui-image-upload-file {
178
- width: 100%;
179
- display: flex;
180
- flex-direction: row;
181
- flex-wrap: wrap;
182
-
183
- .item {
184
- position: relative;
185
- display: flex;
186
- justify-content: center;
187
- align-items: center;
188
- overflow: hidden;
189
- width: 140px;
190
- height: 140px;
191
- margin-bottom: 10px;
192
- margin-right: 10px;
193
- border: 1px dashed #d0d2d7;
194
- padding: 8px;
195
- border-radius: 2px;
196
- box-sizing: border-box;
197
-
198
- .modal {
199
- position: absolute;
200
- top: 0;
201
- right: 0;
202
- bottom: 0;
203
- left: 0;
204
- display: flex;
205
- align-items: center;
206
- justify-content: space-around;
207
- background: rgba(0, 0, 0, 0.5);
208
- visibility: hidden;
209
- line-height: initial;
210
- border-radius: 2px;
211
-
212
- [class^='el-icon-'] {
213
- color: #fff;
214
- font-size: 1.5em;
215
- cursor: pointer;
216
- }
217
- }
218
-
219
- > .image {
220
- width: 100%;
221
- height: 100%;
222
- background: no-repeat center;
223
- background-size: contain;
224
- }
225
-
226
- &.upload-btn {
227
- background: #edeef0;
228
- display: flex;
229
- align-items: center;
230
- justify-content: center;
231
- border: none;
232
- cursor: pointer;
233
-
234
- & > i {
235
- width: 2em;
236
- color: #888c94;
237
- font-size: 20px;
238
- line-height: 1.2;
239
- }
240
- }
241
- }
242
-
243
- .item:hover .modal {
244
- visibility: visible;
245
- }
246
-
247
- ::v-deep .preview {
248
- display: inline-block;
249
- width: auto;
250
- max-width: 60%;
251
- left: 50%;
252
- transform: translateX(-50%);
253
- }
254
- }
255
-
256
- .show-img {
257
- border: 1px dashed #ccc;
258
- padding: 5px;
259
- }
260
-
261
- .capture {
262
- width: 60px;
263
- height: 60px;
264
- border-radius: 50%;
265
- background: #ccc;
266
- text-align: center;
267
- color: #CCC;
268
- overflow: hidden;
269
- margin: 0 auto 10px;
270
-
271
- .out-circle {
272
- width: 50px;
273
- height: 50px;
274
- background: #FFF;
275
- border-radius: 50%;
276
- line-height: 55px;
277
- margin: 5px auto;
278
- overflow: hidden;
279
- cursor: pointer;
280
-
281
- i {
282
- font-size: 20px;
283
- }
284
- }
285
-
286
- .reduce {
287
- transform: scale(.8);
288
- transition: .2s linear;
289
- }
290
- }
291
-
292
- .buttons {
293
- position: relative;
294
- height: 240px;
295
-
296
- .buttons-desc {
297
- position: absolute;
298
- top: 50%;
299
- left: 50%;
300
- transform: translate(-50%, -50%);
301
-
302
- }
303
- }
304
- </style>
@@ -1,188 +0,0 @@
1
- <template>
2
- <el-menu
3
- class="head-menu"
4
- v-bind="$attrs"
5
- v-on="$listeners"
6
- :mode="mode"
7
- :router="router"
8
- :default-active="active"
9
- >
10
- <menu-item v-for="item in displayMenus" :item="item" :key="item.id"/>
11
- </el-menu>
12
- </template>
13
-
14
- <script>
15
- import {mapState} from 'vuex';
16
- import MenuItem from './menu-item';
17
-
18
- export default {
19
- name: 'head-menu',
20
- components: {MenuItem},
21
- provide() {
22
- return {
23
- headMenu: this,
24
- };
25
- },
26
- props: {
27
- router: {
28
- type: Boolean,
29
- default: true,
30
- },
31
- defaultActive: String,
32
- mode: {
33
- default: 'horizontal',
34
- },
35
- },
36
- data() {
37
- return {
38
- packUpWidth: 0,
39
- };
40
- },
41
- computed: {
42
- ...mapState(['menus']),
43
- headMenu() {
44
- // eslint-disable-next-line
45
- return this.menus.filter(menu => [1, 2].includes(menu.type)).map(({children, ...menu}) => menu);
46
- },
47
- active() {
48
- if (!this.router) {
49
- return this.defaultActive;
50
- }
51
- const currentPath = this.$route.path;
52
- const isHeadRoute = this.headMenu.some(menu => menu.url === currentPath);
53
- if (isHeadRoute) {
54
- return currentPath;
55
- }
56
- const currentHeadMenu = this.getCurrentHeadMenu(currentPath, this.menus);
57
- return currentHeadMenu && (currentHeadMenu.path || currentHeadMenu.url);
58
- },
59
- menuWidth() {
60
- return this.headMenu.reduce((total, item) => {
61
- return total + (item.name || '').split('').length * 16 + 25 * 2; // 16:字体大小值; 25:左右padding/margin值
62
- }, 60); // 100:菜单左边的margin值
63
- },
64
- packUpIndex() {
65
- if (this.packUpWidth <= 0) {
66
- return -1;
67
- }
68
- let index = -1;
69
- let width = this.packUpWidth + 130; // 50:更多下拉菜单所占宽度
70
- for(let i = this.headMenu.length - 1; i >= 0; i--) {
71
- const item = this.headMenu[i];
72
- const currentWidth = (item.name || '').split('').length * 16 + 25 * 2;
73
- if (currentWidth >= width) {
74
- index = i - 1;
75
- break;
76
- }
77
- width = width - currentWidth;
78
- }
79
- return Math.max(0, index);
80
- },
81
- displayMenus() {
82
- if (this.packUpIndex === -1) {
83
- return this.headMenu;
84
- }
85
- const menus = this.headMenu.slice(0, this.packUpIndex);
86
- const moreMenus = this.headMenu.slice(this.packUpIndex);
87
- menus.push({
88
- id: 'more',
89
- name: '更多菜单',
90
- children: moreMenus,
91
- });
92
- return menus;
93
- },
94
- },
95
- mounted() {
96
- window.addEventListener('resize', this.onResize);
97
- this.onResize();
98
-
99
- const logo = document.querySelector('.page-header > .logo');
100
- logo && logo.addEventListener('load', () => this.onResize());
101
- },
102
- beforeDestroy() {
103
- window.removeEventListener('resize', this.onResize);
104
- },
105
- methods: {
106
- onResize() {
107
- clearTimeout(this.timer);
108
- this.timer = setTimeout(() => {
109
- const headerWidth = document.documentElement.clientWidth;
110
- const logoEl = document.querySelector('.page-header > .logo');
111
- const titleEl = document.querySelector('.page-header > .title');
112
- const messageEl = document.querySelector('.page-header > .screen');
113
- const usernameEl = document.querySelector('.page-header > .username');
114
- const logoWidth = (logoEl && logoEl.offsetWidth || 0) + 20; // 20 margin
115
- const titleWidth = titleEl && titleEl.offsetWidth || 0;
116
- const messageElWidth = messageEl && messageEl.offsetWidth || 0;
117
- const usernameWidth = usernameEl && usernameEl.offsetWidth || 0;
118
- const allowedMenuWidth = headerWidth - 60 - logoWidth - titleWidth - messageElWidth - usernameWidth;
119
- this.packUpWidth = Math.max(0, this.menuWidth - allowedMenuWidth);
120
- }, 50);
121
- },
122
- getCurrentHeadMenu(path, menus) {
123
- if (!Array.isArray(menus) || menus.length <= 0) {
124
- return undefined;
125
- }
126
- return menus.find(menu => {
127
- const isMatched = (menu.children || []).some(childMenu => (childMenu.path || childMenu.url) === path);
128
- if (isMatched) {
129
- return true;
130
- }
131
- return this.getCurrentHeadMenu(path, menu.children);
132
- });
133
- },
134
- },
135
- };
136
- </script>
137
-
138
- <style lang="scss">
139
-
140
- .head-menu.el-menu {
141
- background-color: transparent;
142
- border-bottom: none;
143
-
144
- > .el-menu-item,
145
- > .el-submenu .el-submenu__title {
146
- font-size: 16px;
147
- font-weight: 400;
148
- color: inherit;
149
- height: var(--header-height);
150
- line-height: var(--header-height);
151
- padding: 0 25px;
152
- border: none;
153
- box-sizing: border-box;
154
- transition: all 0.2s ease-in-out;
155
-
156
- span {
157
- vertical-align: unset;
158
- }
159
-
160
- i {
161
- width: 20px;
162
- font-size: 14px;
163
- }
164
- }
165
-
166
- > .el-menu-item:not(.is-disabled):not(.is-active):hover,
167
- > .el-menu-item:not(.is-disabled):not(.is-active):focus,
168
- > .el-submenu:not(.is-disabled):not(.is-active):hover .el-submenu__title,
169
- > .el-submenu:not(.is-disabled):not(.is-active):focus .el-submenu__title {
170
- color: inherit;
171
- background-color: rgba(0, 146, 63, 0.3);
172
- }
173
-
174
- > .el-menu-item.is-active,
175
- > .el-submenu.is-active .el-submenu__title {
176
- color: inherit;
177
- background-color: rgba(0, 146, 63, 0.6);
178
- }
179
-
180
- .el-submenu__title i {
181
- color: inherit;
182
- }
183
-
184
- .el-menu--popup {
185
-
186
- }
187
- }
188
- </style>
@@ -1,84 +0,0 @@
1
- <script type="text/jsx">
2
- export default {
3
- name: 'head-menu-submenu',
4
- inject: ['headMenu'],
5
- props: {
6
- item: Object,
7
- },
8
- computed: {
9
- isLeaf() {
10
- const {children} = this.item;
11
- return !Array.isArray(children) || children.length <= 0;
12
- },
13
- index() {
14
- const {url, id} = this.item;
15
- if (this.isRouter) {
16
- return url || id + '';
17
- }
18
- return id + '';
19
- },
20
- route() {
21
- const {url} = this.item;
22
- return url;
23
- },
24
- isRouter() {
25
- return this.headMenu.router;
26
- },
27
- theme() {
28
- return this.headMenu.theme;
29
- },
30
- popperClass() {
31
- return ['nav-menu-submenu-popup', this.theme].join(' ');
32
- },
33
- },
34
- render() {
35
- if (this.isLeaf) {
36
- return (
37
- <el-menu-item index={this.index} route={this.route}>
38
- <template slot="title">{this.item.name}</template>
39
- </el-menu-item>
40
- );
41
- }
42
- return (
43
- <el-submenu index={this.index} popperClass={this.popperClass} popper-append-to-body={false}>
44
- <template slot="title">{this.item.name}</template>
45
- {this.item.children.map(child => <head-menu-submenu key={child.id} item={child}/>)}
46
- </el-submenu>
47
- );
48
- },
49
- };
50
- </script>
51
- <style lang="less">
52
- .el-menu--collapse .el-menu-item [class^=el-icon-],
53
- .el-menu--collapse .el-submenu .el-submenu__title [class^=el-icon-] {
54
- margin: 0;
55
- vertical-align: middle;
56
- width: 24px;
57
- text-align: center
58
- }
59
-
60
- .el-menu--collapse .el-menu-item .el-submenu__icon-arrow,
61
- .el-menu--collapse .el-submenu .el-submenu__title .el-submenu__icon-arrow {
62
- display: none
63
- }
64
-
65
- .el-menu--collapse .el-menu-item span,
66
- .el-menu--collapse .el-submenu .el-submenu__title span {
67
- height: 0;
68
- width: 0;
69
- overflow: hidden;
70
- visibility: hidden;
71
- display: inline-block
72
- }
73
-
74
- .nav-menu-submenu-popup {
75
-
76
- .el-menu-item,
77
- .el-submenu__title {
78
- height: 40px;
79
- line-height: 40px;
80
- font-size: 12px;
81
- }
82
- }
83
-
84
- </style>