haiwei-ui 1.0.3 → 1.0.4
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.
- package/README.md +10 -0
- package/package.json +1 -1
- package/packages/components/box/index.vue +116 -125
- package/packages/components/box-col/index.vue +30 -33
- package/packages/components/box-row/index.vue +17 -17
- package/packages/components/box-small/index.vue +38 -38
- package/packages/components/button/index.vue +29 -42
- package/packages/components/button-copy/index.vue +46 -62
- package/packages/components/button-delete/index.vue +64 -77
- package/packages/components/button-delete-batch/index.vue +82 -95
- package/packages/components/button-has/index.vue +29 -42
- package/packages/components/checkbox-group/index.vue +85 -85
- package/packages/components/color-picker/index.vue +41 -50
- package/packages/components/container/index.vue +8 -8
- package/packages/components/date-range-picker/index.vue +92 -103
- package/packages/components/details/index.vue +72 -79
- package/packages/components/dialog/index.vue +281 -294
- package/packages/components/drag-sort/index.vue +36 -36
- package/packages/components/drag-sort-dialog/index.vue +58 -58
- package/packages/components/drawer/index.vue +157 -166
- package/packages/components/enums/sex/index.vue +1 -1
- package/packages/components/flex/index.vue +33 -33
- package/packages/components/form/index.vue +123 -138
- package/packages/components/form-dialog/index.vue +184 -217
- package/packages/components/form-page/index.vue +134 -151
- package/packages/components/icon/index.vue +6 -6
- package/packages/components/icon-picker/index.vue +30 -30
- package/packages/components/icon-picker/panel.vue +58 -58
- package/packages/components/label/index.vue +22 -30
- package/packages/components/list/components/export/index.vue +101 -99
- package/packages/components/list/components/footer/index.vue +42 -51
- package/packages/components/list/components/header/index.vue +34 -34
- package/packages/components/list/components/querybar/index.vue +144 -144
- package/packages/components/list/components/select-column/index.vue +30 -30
- package/packages/components/list/components/table/index.vue +169 -188
- package/packages/components/list/index.vue +337 -391
- package/packages/components/list-agile/index.vue +145 -145
- package/packages/components/list-dialog/index.vue +70 -84
- package/packages/components/listbox/index.vue +48 -48
- package/packages/components/login-default/index.vue +107 -107
- package/packages/components/login-neon/index.vue +104 -104
- package/packages/components/map/index.vue +229 -229
- package/packages/components/map-coord-picking/index.vue +220 -219
- package/packages/components/map-search/index.vue +75 -72
- package/packages/components/scrollbar/index.vue +11 -11
- package/packages/components/select-whether/index.vue +30 -30
- package/packages/components/split/index.vue +141 -141
- package/packages/components/split/trigger.vue +15 -15
- package/packages/components/tabnav/index.vue +125 -89
- package/packages/components/tabs/index.vue +31 -31
- package/packages/components/toolbar/components/fullscreen/index.vue +10 -10
- package/packages/components/toolbar/components/logout/index.vue +13 -13
- package/packages/components/toolbar/components/skin-toggle/form.vue +59 -59
- package/packages/components/toolbar/components/skin-toggle/index.vue +12 -12
- package/packages/components/toolbar/components/userInfo/index.vue +18 -18
- package/packages/components/toolbar/index.vue +12 -12
- package/packages/components/tree-select/mixins.vue +261 -270
- package/packages/components/txt/index.vue +17 -17
- package/packages/components/update-password/index.vue +45 -57
- package/packages/layout.vue +18 -18
- package/packages/mixins/components/checkbox.vue +71 -82
- package/packages/mixins/components/radio.vue +69 -69
- package/packages/page/403/index.vue +32 -28
- package/packages/page/404/index.vue +32 -28
- package/packages/page/default/index.vue +17 -13
- package/packages/page/iframe/index.vue +6 -6
- package/packages/page/login/index.vue +9 -9
- package/packages/page/userInfo/index.vue +5 -5
- package/packages/router/index.js +1 -9
- package/packages/skins/pretty/components/header/components/breadcrumb/index.vue +29 -29
- package/packages/skins/pretty/components/header/components/theme/index.vue +22 -21
- package/packages/skins/pretty/components/header/index.vue +12 -12
- package/packages/skins/pretty/components/main/index.vue +27 -27
- package/packages/skins/pretty/components/menus/index.vue +28 -28
- package/packages/skins/pretty/components/menus/item.vue +23 -23
- package/packages/skins/pretty/components/sidebar/index.vue +7 -7
- package/packages/skins/pretty/index.vue +6 -6
- package/packages/skins/pretty/styles/themes/blue-light/_index.scss +2 -2
- package/packages/skins/pretty/styles/themes/default/_index.scss +1 -1
- package/packages/skins/pretty/styles/themes/green/_index.scss +2 -2
- package/packages/skins/pretty/styles/themes/green-light/_index.scss +2 -2
- package/packages/styles/_mixins.scss +24 -25
- package/packages/styles/animation/_index.scss +22 -23
- package/packages/styles/animation/breadcrumb.scss +6 -6
- package/packages/styles/animation/fade.scss +11 -11
- package/packages/styles/animation/move.scss +98 -98
- package/packages/styles/components/box-small/_index.scss +58 -58
- package/packages/styles/components/button/_index.scss +7 -7
- package/packages/styles/components/container/_index.scss +26 -26
- package/packages/styles/components/date-range-picker/_index.scss +4 -4
- package/packages/styles/components/details/_index.scss +66 -67
- package/packages/styles/components/details-dialog/_index.scss +13 -13
- package/packages/styles/components/drag-sort/_index.scss +20 -20
- package/packages/styles/components/drag-sort-dialog/_index.scss +7 -7
- package/packages/styles/components/flex/_index.scss +56 -56
- package/packages/styles/components/form-dialog/_index.scss +11 -11
- package/packages/styles/components/icon/_index.scss +6 -6
- package/packages/styles/components/label/_index.scss +245 -245
- package/packages/styles/components/listbox/_index.scss +47 -47
- package/packages/styles/components/split/_index.scss +102 -102
- package/packages/styles/components/toolbar/_index.scss +98 -98
- package/packages/styles/components/txt/_index.scss +13 -13
- package/packages/styles/components/upload-dialog/_index.scss +44 -44
- package/packages/styles/components/upload-multiple/_index.scss +19 -19
- package/packages/styles/components/upload-single/_index.scss +16 -16
- package/packages/utils/resize-event.js +3 -3
- package/packages/vuter/attributes.json +30 -40
- package/packages/vuter/tags.json +11 -27
- package/public/lib/font/iconfont.js +47 -1
|
@@ -5,38 +5,38 @@
|
|
|
5
5
|
</el-select>
|
|
6
6
|
</template>
|
|
7
7
|
<script>
|
|
8
|
-
export default {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
props: {
|
|
16
|
-
value: [String, Number],
|
|
17
|
-
placeholder: {
|
|
18
|
-
type: String,
|
|
19
|
-
default: '请选择...'
|
|
8
|
+
export default {
|
|
9
|
+
name: 'SelectWhether',
|
|
10
|
+
data() {
|
|
11
|
+
return {
|
|
12
|
+
value_: this.value
|
|
13
|
+
}
|
|
20
14
|
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
props: {
|
|
16
|
+
value: [String, Number],
|
|
17
|
+
placeholder: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: '请选择...'
|
|
20
|
+
},
|
|
21
|
+
clearable: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: true
|
|
24
|
+
}
|
|
30
25
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
methods: {
|
|
27
|
+
onChange(val) {
|
|
28
|
+
this.$emit('input', val)
|
|
29
|
+
this.$emit('change', val)
|
|
30
|
+
},
|
|
31
|
+
reset() {
|
|
32
|
+
this.value_ = ''
|
|
33
|
+
this.onChange('')
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
watch: {
|
|
37
|
+
value(val) {
|
|
38
|
+
this.value_ = val
|
|
39
|
+
}
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
|
-
}
|
|
42
42
|
</script>
|
|
@@ -30,149 +30,149 @@
|
|
|
30
30
|
</template>
|
|
31
31
|
|
|
32
32
|
<script>
|
|
33
|
-
// 从iView迁移
|
|
34
|
-
import { mapState } from 'vuex'
|
|
35
|
-
import Trigger from './trigger.vue'
|
|
36
|
-
export default {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
mode: {
|
|
47
|
-
validator(value) {
|
|
48
|
-
return value === 'horizontal' || value === 'vertical'
|
|
33
|
+
// 从iView迁移
|
|
34
|
+
import { mapState } from 'vuex'
|
|
35
|
+
import Trigger from './trigger.vue'
|
|
36
|
+
export default {
|
|
37
|
+
name: 'Split',
|
|
38
|
+
components: {
|
|
39
|
+
Trigger
|
|
40
|
+
},
|
|
41
|
+
props: {
|
|
42
|
+
value: {
|
|
43
|
+
type: [Number, String],
|
|
44
|
+
default: 0.5
|
|
49
45
|
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
`${this.prefix}-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
},
|
|
113
|
-
getComputedThresholdValue(type) {
|
|
114
|
-
let size = this.$refs.outerWrapper[this.offsetSize]
|
|
115
|
-
if (this.valueIsPx) return typeof this[type] === 'string' ? this[type] : size * this[type]
|
|
116
|
-
else return typeof this[type] === 'string' ? this.px2percent(this[type], size) : this[type]
|
|
117
|
-
},
|
|
118
|
-
getMin(value1, value2) {
|
|
119
|
-
if (this.valueIsPx) return `${Math.min(parseFloat(value1), parseFloat(value2))}px`
|
|
120
|
-
else return Math.min(value1, value2)
|
|
121
|
-
},
|
|
122
|
-
getMax(value1, value2) {
|
|
123
|
-
if (this.valueIsPx) return `${Math.max(parseFloat(value1), parseFloat(value2))}px`
|
|
124
|
-
else return Math.max(value1, value2)
|
|
125
|
-
},
|
|
126
|
-
getAnotherOffset(value) {
|
|
127
|
-
let res = 0
|
|
128
|
-
if (this.valueIsPx) res = `${this.$refs.outerWrapper[this.offsetSize] - parseFloat(value)}px`
|
|
129
|
-
else res = 1 - value
|
|
130
|
-
return res
|
|
131
|
-
},
|
|
132
|
-
handleMove(e) {
|
|
133
|
-
let pageOffset = this.isHorizontal ? e.pageX : e.pageY
|
|
134
|
-
let offset = pageOffset - this.initOffset
|
|
135
|
-
let outerWidth = this.$refs.outerWrapper[this.offsetSize]
|
|
136
|
-
let value = this.valueIsPx ? `${parseFloat(this.oldOffset) + offset}px` : this.px2percent(outerWidth * this.oldOffset + offset, outerWidth)
|
|
137
|
-
let anotherValue = this.getAnotherOffset(value)
|
|
138
|
-
if (parseFloat(value) <= parseFloat(this.computedMin)) value = this.getMax(value, this.computedMin)
|
|
139
|
-
if (parseFloat(anotherValue) <= parseFloat(this.computedMax)) value = this.getAnotherOffset(this.getMax(anotherValue, this.computedMax))
|
|
140
|
-
e.atMin = this.value === this.computedMin
|
|
141
|
-
e.atMax = this.valueIsPx ? this.getAnotherOffset(this.value) === this.computedMax : this.getAnotherOffset(this.value).toFixed(5) === this.computedMax.toFixed(5)
|
|
142
|
-
this.$emit('input', value)
|
|
143
|
-
this.$emit('on-moving', e)
|
|
144
|
-
},
|
|
145
|
-
handleUp() {
|
|
146
|
-
this.isMoving = false
|
|
147
|
-
document.removeEventListener('mousemove', this.handleMove, false)
|
|
148
|
-
document.removeEventListener('mouseup', this.handleUp, false)
|
|
149
|
-
this.$emit('on-move-end')
|
|
150
|
-
},
|
|
151
|
-
handleMousedown(e) {
|
|
152
|
-
this.initOffset = this.isHorizontal ? e.pageX : e.pageY
|
|
153
|
-
this.oldOffset = this.value
|
|
154
|
-
this.isMoving = true
|
|
155
|
-
document.addEventListener('mousemove', this.handleMove, false)
|
|
156
|
-
document.addEventListener('mouseup', this.handleUp, false)
|
|
157
|
-
this.$emit('on-move-start')
|
|
46
|
+
mode: {
|
|
47
|
+
validator(value) {
|
|
48
|
+
return value === 'horizontal' || value === 'vertical'
|
|
49
|
+
},
|
|
50
|
+
default: 'horizontal'
|
|
51
|
+
},
|
|
52
|
+
min: {
|
|
53
|
+
type: [Number, String],
|
|
54
|
+
default: '40px'
|
|
55
|
+
},
|
|
56
|
+
max: {
|
|
57
|
+
type: [Number, String],
|
|
58
|
+
default: '40px'
|
|
59
|
+
},
|
|
60
|
+
/** loading */
|
|
61
|
+
loading: Boolean
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* Events
|
|
65
|
+
* @on-move-start
|
|
66
|
+
* @on-moving 返回值:事件对象,但是在事件对象中加入了两个参数:atMin(当前是否在最小值处), atMax(当前是否在最大值处)
|
|
67
|
+
* @on-move-end
|
|
68
|
+
*/
|
|
69
|
+
data() {
|
|
70
|
+
return {
|
|
71
|
+
prefix: 'nm-split',
|
|
72
|
+
offset: 0,
|
|
73
|
+
oldOffset: 0,
|
|
74
|
+
isMoving: false
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
computed: {
|
|
78
|
+
...mapState('app/loading', { loadingText: 'text', loadingBackground: 'background', loadingSpinner: 'spinner' }),
|
|
79
|
+
wrapperClasses() {
|
|
80
|
+
return [`${this.prefix}-wrapper`, this.isMoving ? 'no-select' : '']
|
|
81
|
+
},
|
|
82
|
+
paneClasses() {
|
|
83
|
+
return [
|
|
84
|
+
`${this.prefix}-pane`,
|
|
85
|
+
{
|
|
86
|
+
[`${this.prefix}-pane-moving`]: this.isMoving
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
isHorizontal() {
|
|
91
|
+
return this.mode === 'horizontal'
|
|
92
|
+
},
|
|
93
|
+
anotherOffset() {
|
|
94
|
+
return 100 - this.offset
|
|
95
|
+
},
|
|
96
|
+
valueIsPx() {
|
|
97
|
+
return typeof this.value === 'string'
|
|
98
|
+
},
|
|
99
|
+
offsetSize() {
|
|
100
|
+
return this.isHorizontal ? 'offsetWidth' : 'offsetHeight'
|
|
101
|
+
},
|
|
102
|
+
computedMin() {
|
|
103
|
+
return this.getComputedThresholdValue('min')
|
|
104
|
+
},
|
|
105
|
+
computedMax() {
|
|
106
|
+
return this.getComputedThresholdValue('max')
|
|
107
|
+
}
|
|
158
108
|
},
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
109
|
+
methods: {
|
|
110
|
+
px2percent(numerator, denominator) {
|
|
111
|
+
return parseFloat(numerator) / parseFloat(denominator)
|
|
112
|
+
},
|
|
113
|
+
getComputedThresholdValue(type) {
|
|
114
|
+
let size = this.$refs.outerWrapper[this.offsetSize]
|
|
115
|
+
if (this.valueIsPx) return typeof this[type] === 'string' ? this[type] : size * this[type]
|
|
116
|
+
else return typeof this[type] === 'string' ? this.px2percent(this[type], size) : this[type]
|
|
117
|
+
},
|
|
118
|
+
getMin(value1, value2) {
|
|
119
|
+
if (this.valueIsPx) return `${Math.min(parseFloat(value1), parseFloat(value2))}px`
|
|
120
|
+
else return Math.min(value1, value2)
|
|
121
|
+
},
|
|
122
|
+
getMax(value1, value2) {
|
|
123
|
+
if (this.valueIsPx) return `${Math.max(parseFloat(value1), parseFloat(value2))}px`
|
|
124
|
+
else return Math.max(value1, value2)
|
|
125
|
+
},
|
|
126
|
+
getAnotherOffset(value) {
|
|
127
|
+
let res = 0
|
|
128
|
+
if (this.valueIsPx) res = `${this.$refs.outerWrapper[this.offsetSize] - parseFloat(value)}px`
|
|
129
|
+
else res = 1 - value
|
|
130
|
+
return res
|
|
131
|
+
},
|
|
132
|
+
handleMove(e) {
|
|
133
|
+
let pageOffset = this.isHorizontal ? e.pageX : e.pageY
|
|
134
|
+
let offset = pageOffset - this.initOffset
|
|
135
|
+
let outerWidth = this.$refs.outerWrapper[this.offsetSize]
|
|
136
|
+
let value = this.valueIsPx ? `${parseFloat(this.oldOffset) + offset}px` : this.px2percent(outerWidth * this.oldOffset + offset, outerWidth)
|
|
137
|
+
let anotherValue = this.getAnotherOffset(value)
|
|
138
|
+
if (parseFloat(value) <= parseFloat(this.computedMin)) value = this.getMax(value, this.computedMin)
|
|
139
|
+
if (parseFloat(anotherValue) <= parseFloat(this.computedMax)) value = this.getAnotherOffset(this.getMax(anotherValue, this.computedMax))
|
|
140
|
+
e.atMin = this.value === this.computedMin
|
|
141
|
+
e.atMax = this.valueIsPx ? this.getAnotherOffset(this.value) === this.computedMax : this.getAnotherOffset(this.value).toFixed(5) === this.computedMax.toFixed(5)
|
|
142
|
+
this.$emit('input', value)
|
|
143
|
+
this.$emit('on-moving', e)
|
|
144
|
+
},
|
|
145
|
+
handleUp() {
|
|
146
|
+
this.isMoving = false
|
|
147
|
+
document.removeEventListener('mousemove', this.handleMove, false)
|
|
148
|
+
document.removeEventListener('mouseup', this.handleUp, false)
|
|
149
|
+
this.$emit('on-move-end')
|
|
150
|
+
},
|
|
151
|
+
handleMousedown(e) {
|
|
152
|
+
this.initOffset = this.isHorizontal ? e.pageX : e.pageY
|
|
153
|
+
this.oldOffset = this.value
|
|
154
|
+
this.isMoving = true
|
|
155
|
+
document.addEventListener('mousemove', this.handleMove, false)
|
|
156
|
+
document.addEventListener('mouseup', this.handleUp, false)
|
|
157
|
+
this.$emit('on-move-start')
|
|
158
|
+
},
|
|
159
|
+
computeOffset() {
|
|
160
|
+
this.offset = ((this.valueIsPx ? this.px2percent(this.value, this.$refs.outerWrapper[this.offsetSize]) : this.value) * 10000) / 100
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
watch: {
|
|
164
|
+
value() {
|
|
165
|
+
this.computeOffset()
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
mounted() {
|
|
169
|
+
this.$nextTick(() => {
|
|
170
|
+
this.computeOffset()
|
|
171
|
+
})
|
|
172
172
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
173
|
+
window.addEventListener('resize', () => {
|
|
174
|
+
this.computeOffset()
|
|
175
|
+
})
|
|
176
|
+
}
|
|
176
177
|
}
|
|
177
|
-
}
|
|
178
178
|
</script>
|
|
@@ -7,22 +7,22 @@
|
|
|
7
7
|
</template>
|
|
8
8
|
|
|
9
9
|
<script>
|
|
10
|
-
export default {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
computed: {
|
|
20
|
-
isVertical() {
|
|
21
|
-
return this.mode === 'vertical'
|
|
10
|
+
export default {
|
|
11
|
+
props: {
|
|
12
|
+
mode: String
|
|
13
|
+
},
|
|
14
|
+
data() {
|
|
15
|
+
return {
|
|
16
|
+
initOffset: 0
|
|
17
|
+
}
|
|
22
18
|
},
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
computed: {
|
|
20
|
+
isVertical() {
|
|
21
|
+
return this.mode === 'vertical'
|
|
22
|
+
},
|
|
23
|
+
classes() {
|
|
24
|
+
return ['nm-split-trigger', this.isVertical ? `nm-split-trigger-vertical` : `nm-split-trigger-horizontal`]
|
|
25
|
+
}
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
|
-
}
|
|
28
28
|
</script>
|
|
@@ -4,10 +4,16 @@
|
|
|
4
4
|
<div class="nm-tabnav-tabs">
|
|
5
5
|
<el-tabs :value="current.path" type="card" :closable="true" @tab-click="onTabClick" @tab-remove="onTabRemove" @contextmenu.prevent.native="showContextMenu">
|
|
6
6
|
<el-tab-pane v-if="config.showHome" :name="defaultPage">
|
|
7
|
-
<span slot="label">
|
|
7
|
+
<span slot="label">
|
|
8
|
+
<nm-icon v-if="config.showIcon" name="home" />
|
|
9
|
+
首页
|
|
10
|
+
</span>
|
|
8
11
|
</el-tab-pane>
|
|
9
|
-
<el-tab-pane v-for="(item, i) in opened" :key="item.path" :name="item.path"
|
|
10
|
-
|
|
12
|
+
<el-tab-pane v-for="(item, i) in opened" :key="item.path" :name="item.path">
|
|
13
|
+
<span slot="label" :index="i">
|
|
14
|
+
<nm-icon v-if="config.showIcon && item.icon" :name="item.icon" />
|
|
15
|
+
{{ item.tabName }}
|
|
16
|
+
</span>
|
|
11
17
|
</el-tab-pane>
|
|
12
18
|
</el-tabs>
|
|
13
19
|
</div>
|
|
@@ -17,108 +23,138 @@
|
|
|
17
23
|
<nm-icon name="angle-double-down" />
|
|
18
24
|
</span>
|
|
19
25
|
<el-dropdown-menu slot="dropdown">
|
|
20
|
-
<el-dropdown-item command="Left">
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
<el-dropdown-item command="Left">
|
|
27
|
+
<nm-icon name="arrow-left" class="nm-tabnav-control-icon" />
|
|
28
|
+
关闭左侧
|
|
29
|
+
</el-dropdown-item>
|
|
30
|
+
<el-dropdown-item command="Right">
|
|
31
|
+
<nm-icon name="arrow-right" class="nm-tabnav-control-icon" />
|
|
32
|
+
关闭右侧
|
|
33
|
+
</el-dropdown-item>
|
|
34
|
+
<el-dropdown-item command="Other">
|
|
35
|
+
<nm-icon name="other" class="nm-tabnav-control-icon" />
|
|
36
|
+
关闭其他
|
|
37
|
+
</el-dropdown-item>
|
|
38
|
+
<el-dropdown-item command="All">
|
|
39
|
+
<nm-icon name="app" class="nm-tabnav-control-icon" />
|
|
40
|
+
全部关闭
|
|
41
|
+
</el-dropdown-item>
|
|
24
42
|
</el-dropdown-menu>
|
|
25
43
|
</el-dropdown>
|
|
26
44
|
</div>
|
|
27
45
|
<div ref="contextmenu" class="nm-tabnav-contextmenu" v-show="contextmenu.visible" :style="{ top: contextmenu.top, left: contextmenu.left }">
|
|
28
46
|
<ul>
|
|
29
|
-
<li @click.stop="onRefresh"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<li @click.stop="onClose('
|
|
34
|
-
|
|
47
|
+
<li @click.stop="onRefresh">
|
|
48
|
+
<nm-icon name="refresh" />
|
|
49
|
+
重新载入
|
|
50
|
+
</li>
|
|
51
|
+
<li @click.stop="onClose('')">
|
|
52
|
+
<nm-icon name="close" />
|
|
53
|
+
关闭
|
|
54
|
+
</li>
|
|
55
|
+
<li @click.stop="onClose('Left')">
|
|
56
|
+
<nm-icon name="arrow-left" />
|
|
57
|
+
关闭左侧
|
|
58
|
+
</li>
|
|
59
|
+
<li @click.stop="onClose('Right')">
|
|
60
|
+
<nm-icon name="arrow-right" />
|
|
61
|
+
关闭右侧
|
|
62
|
+
</li>
|
|
63
|
+
<li @click.stop="onClose('Other')">
|
|
64
|
+
<nm-icon name="other" />
|
|
65
|
+
关闭其它
|
|
66
|
+
</li>
|
|
67
|
+
<li @click.stop="onClose('All')">
|
|
68
|
+
<nm-icon name="app" />
|
|
69
|
+
关闭全部
|
|
70
|
+
</li>
|
|
35
71
|
</ul>
|
|
36
72
|
</div>
|
|
37
73
|
</section>
|
|
38
74
|
</template>
|
|
39
75
|
<script>
|
|
40
|
-
import { mapState, mapActions } from 'vuex'
|
|
41
|
-
import { on, off, hasClass } from '../../utils/dom'
|
|
42
|
-
export default {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
computed: {
|
|
55
|
-
...mapState('app/page', { opened: 'opened', current: 'current', defaultPage: 'default' }),
|
|
56
|
-
...mapState('app/config', { config: s => s.component.tabnav })
|
|
57
|
-
},
|
|
58
|
-
inject: ['reload'],
|
|
59
|
-
methods: {
|
|
60
|
-
...mapActions('app/page', ['close', 'closeLeft', 'closeRight', 'closeOther', 'closeAll']),
|
|
61
|
-
showContextMenu(event) {
|
|
62
|
-
const { path } = event
|
|
63
|
-
for (let i = 0; i < path.length; i++) {
|
|
64
|
-
if (hasClass(path[i], 'el-tabs__item')) {
|
|
65
|
-
const index = path[i].querySelector('span').getAttribute('index')
|
|
66
|
-
if (index) {
|
|
67
|
-
this.contextmenu = {
|
|
68
|
-
visible: true,
|
|
69
|
-
top: event.y + 'px',
|
|
70
|
-
left: event.x + 'px'
|
|
71
|
-
}
|
|
72
|
-
this.closeParams.index = parseInt(index)
|
|
73
|
-
}
|
|
74
|
-
break
|
|
75
|
-
}
|
|
76
|
+
import { mapState, mapActions } from 'vuex'
|
|
77
|
+
import { on, off, hasClass } from '../../utils/dom'
|
|
78
|
+
export default {
|
|
79
|
+
name: 'Tabnav',
|
|
80
|
+
data() {
|
|
81
|
+
return {
|
|
82
|
+
contextmenu: {
|
|
83
|
+
visible: false,
|
|
84
|
+
top: 0,
|
|
85
|
+
left: 0
|
|
86
|
+
},
|
|
87
|
+
closeParams: { index: 0, router: this.$router }
|
|
76
88
|
}
|
|
77
89
|
},
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
/**
|
|
83
|
-
* @description 处理关闭标签下拉菜单命令
|
|
84
|
-
* @param {String} cmd 命令
|
|
85
|
-
* @param {String} tagName 选择的标签名称
|
|
86
|
-
*/
|
|
87
|
-
handleCommand(cmd) {
|
|
88
|
-
this.closeParams.index = this.opened.findIndex(m => m.path === this.current.path)
|
|
89
|
-
this.onClose(cmd)
|
|
90
|
+
computed: {
|
|
91
|
+
...mapState('app/page', { opened: 'opened', current: 'current', defaultPage: 'default' }),
|
|
92
|
+
...mapState('app/config', { config: s => s.component.tabnav })
|
|
90
93
|
},
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
94
|
+
inject: ['reload'],
|
|
95
|
+
methods: {
|
|
96
|
+
...mapActions('app/page', ['close', 'closeLeft', 'closeRight', 'closeOther', 'closeAll']),
|
|
97
|
+
showContextMenu(event) {
|
|
98
|
+
const { path } = event
|
|
99
|
+
for (let i = 0; i < path.length; i++) {
|
|
100
|
+
if (hasClass(path[i], 'el-tabs__item')) {
|
|
101
|
+
const index = path[i].querySelector('span').getAttribute('index')
|
|
102
|
+
if (index) {
|
|
103
|
+
this.contextmenu = {
|
|
104
|
+
visible: true,
|
|
105
|
+
top: event.y + 'px',
|
|
106
|
+
left: event.x + 'px'
|
|
107
|
+
}
|
|
108
|
+
this.closeParams.index = parseInt(index)
|
|
109
|
+
}
|
|
110
|
+
break
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
hideContextMenu(e) {
|
|
115
|
+
const { target } = e || window.event
|
|
116
|
+
if (this.$refs.contextmenu !== target) this.contextmenu.visible = false
|
|
117
|
+
},
|
|
118
|
+
/**
|
|
119
|
+
* @description 处理关闭标签下拉菜单命令
|
|
120
|
+
* @param {String} cmd 命令
|
|
121
|
+
* @param {String} tagName 选择的标签名称
|
|
122
|
+
*/
|
|
123
|
+
handleCommand(cmd) {
|
|
124
|
+
this.closeParams.index = this.opened.findIndex(m => m.path === this.current.path)
|
|
125
|
+
this.onClose(cmd)
|
|
126
|
+
},
|
|
127
|
+
onTabClick(tab) {
|
|
128
|
+
if (tab.name === this.defaultPage && this.current.path !== this.defaultPage) {
|
|
129
|
+
this.$router.push(this.defaultPage)
|
|
130
|
+
return
|
|
131
|
+
}
|
|
132
|
+
if (this.current.path === tab.name) return
|
|
133
|
+
const page = this.opened.find(page => page.path === tab.name)
|
|
134
|
+
if (page) {
|
|
135
|
+
const { name, params, query } = page
|
|
136
|
+
this.$router.push({ name, params, query })
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
onTabRemove(path) {
|
|
140
|
+
this.closeParams.index = this.opened.findIndex(m => m.path === path)
|
|
141
|
+
this.onClose()
|
|
142
|
+
},
|
|
143
|
+
onClose(type) {
|
|
144
|
+
this[`close${type || ''}`](this.closeParams)
|
|
145
|
+
},
|
|
146
|
+
onRefresh() {
|
|
147
|
+
this.reload(this.current.name)
|
|
101
148
|
}
|
|
102
149
|
},
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
onRefresh() {
|
|
111
|
-
this.reload(this.current.name)
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
watch: {
|
|
115
|
-
'contextmenu.visible'(val) {
|
|
116
|
-
if (val) {
|
|
117
|
-
on(document, 'mouseup', this.hideContextMenu)
|
|
118
|
-
} else {
|
|
119
|
-
off(document, 'mouseup', this.hideContextMenu)
|
|
150
|
+
watch: {
|
|
151
|
+
'contextmenu.visible'(val) {
|
|
152
|
+
if (val) {
|
|
153
|
+
on(document, 'mouseup', this.hideContextMenu)
|
|
154
|
+
} else {
|
|
155
|
+
off(document, 'mouseup', this.hideContextMenu)
|
|
156
|
+
}
|
|
120
157
|
}
|
|
121
158
|
}
|
|
122
159
|
}
|
|
123
|
-
}
|
|
124
160
|
</script>
|