md-iview 1.0.12
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -0
- package/package.json +116 -0
- package/src/components/libs/util.js +117 -0
- package/src/components/md-error-page/403.less +92 -0
- package/src/components/md-error-page/403.vue +34 -0
- package/src/components/md-error-page/404.less +60 -0
- package/src/components/md-error-page/404.vue +34 -0
- package/src/components/md-error-page/500.less +73 -0
- package/src/components/md-error-page/500.vue +36 -0
- package/src/components/md-error-page/demo/index.less +22 -0
- package/src/components/md-error-page/demo/index.vue +97 -0
- package/src/components/md-form-item/index.js +3 -0
- package/src/components/md-icon/icon.vue +77 -0
- package/src/components/md-icon/icons.js +5 -0
- package/src/components/md-icon/index.js +11 -0
- package/src/components/md-icon/style/index.less +1 -0
- package/src/components/md-loading/index.js +55 -0
- package/src/components/md-loading/index.vue +53 -0
- package/src/components/md-loading/md-loading.js +38 -0
- package/src/components/md-print/demo/index.vue +260 -0
- package/src/components/md-print/index.js +123 -0
- package/src/components/md-rich-editor/index.vue +69 -0
- package/src/components/md-rich-editor/module/image-extend/index.js +216 -0
- package/src/components/md-scroll-bar/demo/index.vue +102 -0
- package/src/components/md-scroll-bar/index.js +3 -0
- package/src/components/md-scroll-bar/index.less +90 -0
- package/src/components/md-scroll-bar/index.vue +250 -0
- package/src/components/md-select/index.js +7 -0
- package/src/components/md-select/select.vue +841 -0
- package/src/components/md-shrinkable-menu/components/sidebarMenu.vue +167 -0
- package/src/components/md-shrinkable-menu/components/sidebarMenuShrink.vue +119 -0
- package/src/components/md-shrinkable-menu/demo/data/cachePage.js +1 -0
- package/src/components/md-shrinkable-menu/demo/data/currentPath.js +9 -0
- package/src/components/md-shrinkable-menu/demo/data/menu.js +575 -0
- package/src/components/md-shrinkable-menu/demo/data/menu2.js +1017 -0
- package/src/components/md-shrinkable-menu/demo/data/pageTagsList.js +153 -0
- package/src/components/md-shrinkable-menu/demo/index.less +297 -0
- package/src/components/md-shrinkable-menu/demo/index.vue +285 -0
- package/src/components/md-shrinkable-menu/index.vue +112 -0
- package/src/components/md-shrinkable-menu/sidebar.vue +195 -0
- package/src/components/md-shrinkable-menu/styles/menu.less +5 -0
- package/src/components/md-shrinkable-menu/styles/sidebar.less +363 -0
- package/src/components/md-split-pane/demo/index.vue +101 -0
- package/src/components/md-split-pane/index.js +3 -0
- package/src/components/md-split-pane/index.less +93 -0
- package/src/components/md-split-pane/index.vue +230 -0
- package/src/components/md-table/action-tooltip.vue +45 -0
- package/src/components/md-table/can-edit-v2.vue +823 -0
- package/src/components/md-table/can-edit.vue +723 -0
- package/src/components/md-table/custom-cell.vue +71 -0
- package/src/components/md-table/date-picker-cell-v2.vue +48 -0
- package/src/components/md-table/date-picker-cell.vue +39 -0
- package/src/components/md-table/demo/data/search.js +67 -0
- package/src/components/md-table/demo/data/table2csv.js +200 -0
- package/src/components/md-table/demo/data/table2excel.js +239 -0
- package/src/components/md-table/demo/data/table_data.js +251 -0
- package/src/components/md-table/demo/editable-table.vue +144 -0
- package/src/components/md-table/demo/exportable-table.vue +124 -0
- package/src/components/md-table/demo/widgets/header-search.vue +88 -0
- package/src/components/md-table/drop-down-cell-v2.vue +87 -0
- package/src/components/md-table/drop-down-cell.vue +81 -0
- package/src/components/md-table/editable-expand.vue +143 -0
- package/src/components/md-table/expand.vue +97 -0
- package/src/components/md-table/index.vue +53 -0
- package/src/components/md-table/iview-table/cell.vue +99 -0
- package/src/components/md-table/iview-table/expand.js +21 -0
- package/src/components/md-table/iview-table/export-csv.js +76 -0
- package/src/components/md-table/iview-table/header.js +16 -0
- package/src/components/md-table/iview-table/index.js +2 -0
- package/src/components/md-table/iview-table/mixin.js +31 -0
- package/src/components/md-table/iview-table/table-body.vue +101 -0
- package/src/components/md-table/iview-table/table-head.vue +311 -0
- package/src/components/md-table/iview-table/table-tr.vue +31 -0
- package/src/components/md-table/iview-table/table.vue +1026 -0
- package/src/components/md-table/iview-table/util.js +93 -0
- package/src/components/md-table/libs/table2excel.js +100 -0
- package/src/components/md-table/select-cell-v2.vue +64 -0
- package/src/components/md-table/select-cell.vue +46 -0
- package/src/components/md-table/table.less +76 -0
- package/src/components/md-toolbar/index.vue +171 -0
- package/src/components/md-tree/index.js +2 -0
- package/src/components/md-tree/node.vue +238 -0
- package/src/components/md-tree/render.js +17 -0
- package/src/components/md-tree/tree.vue +241 -0
- package/src/components/utilities/can.js +35 -0
- package/src/directives/index.js +34 -0
- package/src/directives/resize.js +27 -0
- package/src/directives/scroll.js +27 -0
- package/src/directives/style/bg-color.js +23 -0
- package/src/directives/style/color.js +23 -0
- package/src/directives/style/font-size.js +23 -0
- package/src/directives/style/height.js +23 -0
- package/src/directives/style/lineHeight.js +23 -0
- package/src/directives/style/margin.js +48 -0
- package/src/directives/style/opacity.js +23 -0
- package/src/directives/style/padding.js +48 -0
- package/src/directives/style/width.js +24 -0
- package/src/index.js +442 -0
- package/src/locale/lang.js +5 -0
- package/src/mixins/colorable.js +51 -0
- package/src/style/color/bezierEasing.less +110 -0
- package/src/style/color/colorPalette.less +75 -0
- package/src/style/color/colors.less +146 -0
- package/src/style/color/tinyColor.less +1184 -0
- package/src/style/common.less +72 -0
- package/src/style/components/_ripple.less +60 -0
- package/src/style/components/_shrinkable-menu.less +46 -0
- package/src/style/components/_toolbar.less +96 -0
- package/src/style/components/index.less +3 -0
- package/src/style/components/rich-editor.less +6 -0
- package/src/style/index.less +10 -0
- package/src/style/theme.less +155 -0
- package/src/utils/color.js +46 -0
- package/src/utils/console.js +105 -0
- package/src/utils/load.js +79 -0
- package/src/utils/mask.js +139 -0
- package/src/utils/mixins.js +5 -0
- package/src/utils/validate.js +271 -0
@@ -0,0 +1,93 @@
|
|
1
|
+
import { deepCopy } from 'iview/src/utils/assist';
|
2
|
+
|
3
|
+
const convertColumnOrder = (columns, fixedType) => {
|
4
|
+
let list = [];
|
5
|
+
let other = [];
|
6
|
+
columns.forEach((col) => {
|
7
|
+
if (col.fixed && col.fixed === fixedType) {
|
8
|
+
list.push(col);
|
9
|
+
} else {
|
10
|
+
other.push(col);
|
11
|
+
}
|
12
|
+
});
|
13
|
+
return list.concat(other);
|
14
|
+
};
|
15
|
+
|
16
|
+
export {convertColumnOrder};
|
17
|
+
|
18
|
+
// set forTableHead to true when convertToRows, false in normal cases like table.vue
|
19
|
+
const getAllColumns = (cols, forTableHead = false) => {
|
20
|
+
const columns = deepCopy(cols);
|
21
|
+
const result = [];
|
22
|
+
columns.forEach((column) => {
|
23
|
+
if (column.children) {
|
24
|
+
if (forTableHead) result.push(column);
|
25
|
+
result.push.apply(result, getAllColumns(column.children, forTableHead));
|
26
|
+
} else {
|
27
|
+
result.push(column);
|
28
|
+
}
|
29
|
+
});
|
30
|
+
return result;
|
31
|
+
};
|
32
|
+
|
33
|
+
export {getAllColumns};
|
34
|
+
|
35
|
+
const convertToRows = (columns, fixedType = false) => {
|
36
|
+
const originColumns = fixedType ? fixedType === 'left' ? deepCopy(convertColumnOrder(columns, 'left')) : deepCopy(convertColumnOrder(columns, 'right')) : deepCopy(columns);
|
37
|
+
let maxLevel = 1;
|
38
|
+
const traverse = (column, parent) => {
|
39
|
+
if (parent) {
|
40
|
+
column.level = parent.level + 1;
|
41
|
+
if (maxLevel < column.level) {
|
42
|
+
maxLevel = column.level;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
if (column.children) {
|
46
|
+
let colSpan = 0;
|
47
|
+
column.children.forEach((subColumn) => {
|
48
|
+
traverse(subColumn, column);
|
49
|
+
colSpan += subColumn.colSpan;
|
50
|
+
});
|
51
|
+
column.colSpan = colSpan;
|
52
|
+
} else {
|
53
|
+
column.colSpan = 1;
|
54
|
+
}
|
55
|
+
};
|
56
|
+
|
57
|
+
originColumns.forEach((column) => {
|
58
|
+
column.level = 1;
|
59
|
+
traverse(column);
|
60
|
+
});
|
61
|
+
|
62
|
+
const rows = [];
|
63
|
+
for (let i = 0; i < maxLevel; i++) {
|
64
|
+
rows.push([]);
|
65
|
+
}
|
66
|
+
|
67
|
+
const allColumns = getAllColumns(originColumns, true);
|
68
|
+
|
69
|
+
allColumns.forEach((column) => {
|
70
|
+
if (!column.children) {
|
71
|
+
column.rowSpan = maxLevel - column.level + 1;
|
72
|
+
} else {
|
73
|
+
column.rowSpan = 1;
|
74
|
+
}
|
75
|
+
rows[column.level - 1].push(column);
|
76
|
+
});
|
77
|
+
|
78
|
+
return rows;
|
79
|
+
};
|
80
|
+
|
81
|
+
export {convertToRows};
|
82
|
+
|
83
|
+
const getRandomStr = function (len = 32) {
|
84
|
+
const $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
|
85
|
+
const maxPos = $chars.length;
|
86
|
+
let str = '';
|
87
|
+
for (let i = 0; i < len; i++) {
|
88
|
+
str += $chars.charAt(Math.floor(Math.random() * maxPos));
|
89
|
+
}
|
90
|
+
return str;
|
91
|
+
};
|
92
|
+
|
93
|
+
export {getRandomStr};
|
@@ -0,0 +1,100 @@
|
|
1
|
+
var idTmr;
|
2
|
+
function getExplorer () {
|
3
|
+
var explorer = window.navigator.userAgent;
|
4
|
+
if (explorer.indexOf('MSIE') >= 0) {
|
5
|
+
// ie
|
6
|
+
return 'ie';
|
7
|
+
} else if (explorer.indexOf('Firefox') >= 0) {
|
8
|
+
// firefox
|
9
|
+
return 'Firefox';
|
10
|
+
} else if (explorer.indexOf('Chrome') >= 0) {
|
11
|
+
// Chrome
|
12
|
+
return 'Chrome';
|
13
|
+
} else if (explorer.indexOf('Opera') >= 0) {
|
14
|
+
// Opera
|
15
|
+
return 'Opera';
|
16
|
+
} else if (explorer.indexOf('Safari') >= 0) {
|
17
|
+
// Safari
|
18
|
+
return 'Safari';
|
19
|
+
};
|
20
|
+
};
|
21
|
+
function tranform (table, aId, name) {
|
22
|
+
let tableHead = table.$children[0].$el;
|
23
|
+
let tableBody = table.$children[1].$el;
|
24
|
+
let tableInnerHTML = '<thead><tr>';
|
25
|
+
if (table.$children.length !== 1) {
|
26
|
+
let len = tableBody.rows.length;
|
27
|
+
let i = -1;
|
28
|
+
while (i < len) {
|
29
|
+
if (i === -1) {
|
30
|
+
Array.from(tableHead.rows[0].children).forEach((td) => {
|
31
|
+
tableInnerHTML = tableInnerHTML + '<th>' + td.children[0].children[0].innerHTML + '</th>';
|
32
|
+
});
|
33
|
+
tableInnerHTML += '</tr><thead><tbody>';
|
34
|
+
} else {
|
35
|
+
tableInnerHTML += '<tr>';
|
36
|
+
Array.from(tableBody.rows[i].children).forEach((td) => {
|
37
|
+
tableInnerHTML = tableInnerHTML + '<td>' + td.children[0].children[0].innerHTML + '</td>';
|
38
|
+
});
|
39
|
+
tableInnerHTML += '</tr>';
|
40
|
+
}
|
41
|
+
i++;
|
42
|
+
}
|
43
|
+
tableInnerHTML += '</tbody>';
|
44
|
+
}
|
45
|
+
|
46
|
+
if (getExplorer() !== 'Safari' && name.substr(-1, 4) !== '.xls') {
|
47
|
+
name += '.xls';
|
48
|
+
}
|
49
|
+
|
50
|
+
if (getExplorer() === 'ie') {
|
51
|
+
var curTbl = table;
|
52
|
+
var oXL = new ActiveXObject('Excel.Application');
|
53
|
+
var oWB = oXL.Workbooks.Add();
|
54
|
+
var xlsheet = oWB.Worksheets(1);
|
55
|
+
var sel = document.body.createTextRange();
|
56
|
+
sel.moveToElementText(curTbl);
|
57
|
+
sel.select();
|
58
|
+
sel.execCommand('Copy');
|
59
|
+
xlsheet.Paste();
|
60
|
+
oXL.Visible = true;
|
61
|
+
|
62
|
+
try {
|
63
|
+
var fname = oXL.Application.GetSaveAsFilename('Excel.xls', 'Excel Spreadsheets (*.xls), *.xls');
|
64
|
+
} catch (e) {
|
65
|
+
print('Nested catch caught ' + e);
|
66
|
+
} finally {
|
67
|
+
oWB.SaveAs(fname);
|
68
|
+
// oWB.Close(savechanges = false);
|
69
|
+
oXL.Quit();
|
70
|
+
oXL = null;
|
71
|
+
idTmr = setInterval(Cleanup(), 1);
|
72
|
+
}
|
73
|
+
} else {
|
74
|
+
tableToExcel(tableInnerHTML, aId, name);
|
75
|
+
}
|
76
|
+
}
|
77
|
+
function Cleanup () {
|
78
|
+
window.clearInterval(idTmr);
|
79
|
+
// CollectGarbage();
|
80
|
+
}
|
81
|
+
let tableToExcel = (function () {
|
82
|
+
let uri = 'data:application/vnd.ms-excel;base64,';
|
83
|
+
let template = '<html><head><meta charset="UTF-8"></head><body><table>{table}</table></body></html>';
|
84
|
+
let base64 = function (s) { return window.btoa(unescape(encodeURIComponent(s))); };
|
85
|
+
let format = function (s, c) {
|
86
|
+
return s.replace(/{(\w+)}/g, function (m, p) { return c[p]; });
|
87
|
+
};
|
88
|
+
return function (table, aId, name) {
|
89
|
+
let ctx = {worksheet: name || 'Worksheet', table: table};
|
90
|
+
document.getElementById(aId).href = uri + base64(format(template, ctx));
|
91
|
+
document.getElementById(aId).download = name;
|
92
|
+
document.getElementById(aId).click();
|
93
|
+
};
|
94
|
+
})();
|
95
|
+
|
96
|
+
const table2excel = {};
|
97
|
+
|
98
|
+
table2excel.transform = tranform;
|
99
|
+
|
100
|
+
export default table2excel;
|
@@ -0,0 +1,64 @@
|
|
1
|
+
<template>
|
2
|
+
<Select v-model="cloneValue"
|
3
|
+
:multiple="multiple"
|
4
|
+
:disabled="readonly"
|
5
|
+
v-bind="$attrs" v-on="$listeners"
|
6
|
+
:transfer="transfer"
|
7
|
+
class="table-cell-select"
|
8
|
+
filterable>
|
9
|
+
<Option v-for="item in option" :value="item.value" :key="item.value">{{ item.label }}</Option>
|
10
|
+
</Select>
|
11
|
+
</template>
|
12
|
+
|
13
|
+
<script>
|
14
|
+
export default {
|
15
|
+
name: "select-cell",
|
16
|
+
props: {
|
17
|
+
option: Array | Object,
|
18
|
+
multiple: {
|
19
|
+
type: Boolean,
|
20
|
+
default: false
|
21
|
+
},
|
22
|
+
readonly: {
|
23
|
+
type: Boolean,
|
24
|
+
default: false
|
25
|
+
},
|
26
|
+
transfer:Boolean,
|
27
|
+
value: Array | Object
|
28
|
+
},
|
29
|
+
watch: {
|
30
|
+
value: {
|
31
|
+
immediate: true,
|
32
|
+
handler(to) {
|
33
|
+
this.cloneValue = to;
|
34
|
+
}
|
35
|
+
},
|
36
|
+
cloneValue: {
|
37
|
+
immediate: true,
|
38
|
+
handler(to) {
|
39
|
+
this.$emit("on-change", to);
|
40
|
+
}
|
41
|
+
}
|
42
|
+
},
|
43
|
+
data() {
|
44
|
+
return {
|
45
|
+
cloneValue: null
|
46
|
+
};
|
47
|
+
}
|
48
|
+
};
|
49
|
+
</script>
|
50
|
+
|
51
|
+
<style lang="less">
|
52
|
+
.table-cell-select{
|
53
|
+
border: 1px solid #d9d9d9;
|
54
|
+
&:hover{
|
55
|
+
border-color: #1890ff;
|
56
|
+
}
|
57
|
+
.ivu-select-selection {
|
58
|
+
height: 45px !important;
|
59
|
+
line-height: 45px;
|
60
|
+
border: 0 !important;
|
61
|
+
border-radius: 0px !important;
|
62
|
+
}
|
63
|
+
}
|
64
|
+
</style>
|
@@ -0,0 +1,46 @@
|
|
1
|
+
<template>
|
2
|
+
<Select v-model="cloneValue" :multiple="multiple" :disabled="readonly" v-bind="$attrs" v-on="$listeners":transfer="transfer" filterable>
|
3
|
+
<Option v-for="item in option" :value="item.value" :key="item.value">{{ item.label }}</Option>
|
4
|
+
</Select>
|
5
|
+
</template>
|
6
|
+
|
7
|
+
<script>
|
8
|
+
export default {
|
9
|
+
name: "select-cell",
|
10
|
+
props: {
|
11
|
+
option: Array | Object,
|
12
|
+
multiple: {
|
13
|
+
type: Boolean,
|
14
|
+
default: false
|
15
|
+
},
|
16
|
+
readonly: {
|
17
|
+
type: Boolean,
|
18
|
+
default: false
|
19
|
+
},
|
20
|
+
transfer:Boolean,
|
21
|
+
value: Array | Object
|
22
|
+
},
|
23
|
+
watch: {
|
24
|
+
value: {
|
25
|
+
immediate: true,
|
26
|
+
handler(to) {
|
27
|
+
this.cloneValue = to;
|
28
|
+
}
|
29
|
+
},
|
30
|
+
cloneValue: {
|
31
|
+
immediate: true,
|
32
|
+
handler(to) {
|
33
|
+
this.$emit("on-change", to);
|
34
|
+
}
|
35
|
+
}
|
36
|
+
},
|
37
|
+
data() {
|
38
|
+
return {
|
39
|
+
cloneValue: null
|
40
|
+
};
|
41
|
+
}
|
42
|
+
};
|
43
|
+
</script>
|
44
|
+
|
45
|
+
<style scoped>
|
46
|
+
</style>
|
@@ -0,0 +1,76 @@
|
|
1
|
+
.dragging-tip-enter-active{
|
2
|
+
opacity: 1;
|
3
|
+
transition: opacity .3s;
|
4
|
+
}
|
5
|
+
.dragging-tip-enter, .dragging-tip-leave-to{
|
6
|
+
opacity: 0;
|
7
|
+
transition: opacity .3s
|
8
|
+
}
|
9
|
+
.dragging-tip-con{
|
10
|
+
display: block;
|
11
|
+
text-align: center;
|
12
|
+
width: 100%;
|
13
|
+
height: 50px;
|
14
|
+
}
|
15
|
+
.dragging-tip-con span{
|
16
|
+
font-size: 18px;
|
17
|
+
}
|
18
|
+
.record-tip-con{
|
19
|
+
display: block;
|
20
|
+
width: 100%;
|
21
|
+
height: 292px;
|
22
|
+
overflow: auto;
|
23
|
+
}
|
24
|
+
.record-item{
|
25
|
+
box-sizing: content-box;
|
26
|
+
display: block;
|
27
|
+
overflow: hidden;
|
28
|
+
height: 24px;
|
29
|
+
line-height: 24px;
|
30
|
+
padding: 8px 10px;
|
31
|
+
border-bottom: 1px dashed gainsboro;
|
32
|
+
}
|
33
|
+
.record-tip-con span{
|
34
|
+
font-size: 14px;
|
35
|
+
}
|
36
|
+
.edittable-test-con{
|
37
|
+
height: 160px;
|
38
|
+
}
|
39
|
+
.edittable-table-height-con{
|
40
|
+
height: 190px;
|
41
|
+
}
|
42
|
+
.edittable-con-1{
|
43
|
+
box-sizing: content-box;
|
44
|
+
padding: 15px 0 0;
|
45
|
+
height: 196px;
|
46
|
+
}
|
47
|
+
.edittable-table-get-currentdata-con{
|
48
|
+
height: 190px !important;
|
49
|
+
}
|
50
|
+
.exportable-table-download-con1{
|
51
|
+
padding: 16px 0 16px 20px;
|
52
|
+
border-bottom: 1px dashed #c3c3c3;
|
53
|
+
margin-bottom: 16px;
|
54
|
+
}
|
55
|
+
.exportable-table-download-con2{
|
56
|
+
padding-left: 20px;
|
57
|
+
}
|
58
|
+
.show-image{
|
59
|
+
padding: 20px 0px;
|
60
|
+
}
|
61
|
+
.show-image img{
|
62
|
+
display: block;
|
63
|
+
width: 100%;
|
64
|
+
height: auto;
|
65
|
+
}
|
66
|
+
.searchable-table{
|
67
|
+
&-con1{
|
68
|
+
height: 230px !important;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
.table-page {
|
73
|
+
margin-top: 20px;
|
74
|
+
text-align: right;
|
75
|
+
z-index: 1005;
|
76
|
+
}
|
@@ -0,0 +1,171 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="md-toolbar" :class="themeClassName">
|
3
|
+
<div class="md-toolbar__left" :class="[classNames]">
|
4
|
+
<!-- <md-icon type="menu" size="22" color="white" class="md-toolbar__left-item md-toolbar__left-menu cursor-pointer" v-if="!hideMenuBtn" @click="onClickMenuBtn"></md-icon>
|
5
|
+
<div class="md-toolbar__left-item md-toolbar__left-brand cursor-pointer" v-if="!collapsed">
|
6
|
+
<img src="../../../examples/assets/logo.png" alt="icon" v-if="icon">
|
7
|
+
<span class="title" v-if="title">{{ title }}</span>
|
8
|
+
</div>-->
|
9
|
+
<slot name="left">
|
10
|
+
<md-icon type="md-menu" size="22" color="white" class="md-toolbar__left-item md-toolbar__left-menu cursor-pointer" v-if="!hideMenuBtn" @click.native="onClickMenuBtn"></md-icon>
|
11
|
+
<div class="md-toolbar__left-item md-toolbar__left-brand cursor-pointer" v-if="!selfCollapsed">
|
12
|
+
<img src="../../../examples/assets/logo.png" alt="icon" v-if="icon">
|
13
|
+
<span class="md-toolbar__left-brand-title" v-if="title">{{ title }}</span>
|
14
|
+
</div>
|
15
|
+
</slot>
|
16
|
+
</div>
|
17
|
+
<div class="md-toolbar__content">
|
18
|
+
<slot></slot>
|
19
|
+
</div>
|
20
|
+
<div class="md-toolbar__right">
|
21
|
+
<slot name="right"></slot>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
</template>
|
25
|
+
|
26
|
+
<script>
|
27
|
+
export default {
|
28
|
+
name: "md-toolbar",
|
29
|
+
props:{
|
30
|
+
icon:{
|
31
|
+
type:String,
|
32
|
+
default:''
|
33
|
+
},
|
34
|
+
title:{
|
35
|
+
type:String,
|
36
|
+
default:'',
|
37
|
+
},
|
38
|
+
hideMenuBtn:{
|
39
|
+
type:Boolean,
|
40
|
+
default:false,
|
41
|
+
},
|
42
|
+
collapsed:{
|
43
|
+
type:Boolean,
|
44
|
+
default:false,
|
45
|
+
},
|
46
|
+
theme:{
|
47
|
+
type:String,
|
48
|
+
default:'dark',
|
49
|
+
validator:value=>{
|
50
|
+
return ['dark', 'light'].indexOf(value) !== -1
|
51
|
+
}
|
52
|
+
}
|
53
|
+
},
|
54
|
+
computed:{
|
55
|
+
themeClassName() {
|
56
|
+
if (this.theme === 'dark') {
|
57
|
+
return ["md-toolbar--dark"]
|
58
|
+
} else {
|
59
|
+
return ["md-toolbar--light"]
|
60
|
+
}
|
61
|
+
}
|
62
|
+
},
|
63
|
+
watch:{
|
64
|
+
collapsed:{
|
65
|
+
immediate:true,
|
66
|
+
handler(to) {
|
67
|
+
this.selfCollapsed = to;
|
68
|
+
if (to) {
|
69
|
+
this.classNames = [
|
70
|
+
'collapsed-width',
|
71
|
+
'display-flex',
|
72
|
+
'justify-main-center',
|
73
|
+
'align-item-center',
|
74
|
+
]
|
75
|
+
} else {
|
76
|
+
this.classNames = ['expand-width']
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
80
|
+
/* collapsed(to) {
|
81
|
+
this.selfCollapsed = to;
|
82
|
+
console.log("=======", to);
|
83
|
+
if (to) {
|
84
|
+
this.classNames = [
|
85
|
+
'collapsed-width',
|
86
|
+
'display-flex',
|
87
|
+
'justify-main-center',
|
88
|
+
'align-item-center'
|
89
|
+
]
|
90
|
+
} else {
|
91
|
+
this.classNames = ['expand-width']
|
92
|
+
}
|
93
|
+
}*/
|
94
|
+
},
|
95
|
+
data(){
|
96
|
+
return {
|
97
|
+
classNames:['expand-width'],
|
98
|
+
selfCollapsed:false,
|
99
|
+
}
|
100
|
+
},
|
101
|
+
methods:{
|
102
|
+
onClickMenuBtn() {
|
103
|
+
this.selfCollapsed = !this.selfCollapsed;
|
104
|
+
this.$emit('on-click-collapsed', this.selfCollapsed)
|
105
|
+
}
|
106
|
+
}
|
107
|
+
}
|
108
|
+
</script>
|
109
|
+
|
110
|
+
<style scoped lang="less">
|
111
|
+
/* @import "../../style/theme.less";
|
112
|
+
.md-toolbar {
|
113
|
+
height: 48px;
|
114
|
+
align-items: center;
|
115
|
+
display: flex;
|
116
|
+
background: @blue-6;
|
117
|
+
justify-content: space-between;
|
118
|
+
!*padding: 0 16px;*!
|
119
|
+
.collapsed-width {
|
120
|
+
width: 80px;
|
121
|
+
justify-content: center;
|
122
|
+
.icon{
|
123
|
+
margin:0 auto;
|
124
|
+
}
|
125
|
+
}
|
126
|
+
.margin-0-auto{
|
127
|
+
margin: 0 auto;
|
128
|
+
}
|
129
|
+
.expand-width{
|
130
|
+
width: 250px;
|
131
|
+
}
|
132
|
+
&__left {
|
133
|
+
height: inherit;
|
134
|
+
display: flex;
|
135
|
+
align-items: center;
|
136
|
+
padding: 0 16px;
|
137
|
+
background: @primary-7;
|
138
|
+
|
139
|
+
!*background-color:darken(#1890ff, 10%);*!
|
140
|
+
&-item {
|
141
|
+
|
142
|
+
}
|
143
|
+
&-menu {
|
144
|
+
|
145
|
+
}
|
146
|
+
&-brand {
|
147
|
+
height: inherit;
|
148
|
+
margin: 0 8px;
|
149
|
+
display: flex;
|
150
|
+
align-items: center;
|
151
|
+
img {
|
152
|
+
height: 40px;
|
153
|
+
width: 40px;
|
154
|
+
}
|
155
|
+
&-title {
|
156
|
+
font-size: 20px;
|
157
|
+
font-weight: 500;
|
158
|
+
letter-spacing: 0.02em;
|
159
|
+
white-space: nowrap;
|
160
|
+
overflow: hidden;
|
161
|
+
text-overflow: ellipsis;
|
162
|
+
color: white;
|
163
|
+
}
|
164
|
+
}
|
165
|
+
|
166
|
+
}
|
167
|
+
&__right {
|
168
|
+
padding: 0 16px;
|
169
|
+
}
|
170
|
+
}*/
|
171
|
+
</style>
|