haiwei-ui 1.0.3 → 1.0.5
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 +143 -143
- 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
|
@@ -6,45 +6,45 @@
|
|
|
6
6
|
</section>
|
|
7
7
|
</template>
|
|
8
8
|
<script>
|
|
9
|
-
import draggable from 'vuedraggable'
|
|
10
|
-
export default {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
import draggable from 'vuedraggable'
|
|
10
|
+
export default {
|
|
11
|
+
name: 'DragSort',
|
|
12
|
+
components: { draggable },
|
|
13
|
+
data() {
|
|
14
|
+
return {
|
|
15
|
+
list: this.value,
|
|
16
|
+
dragOptions: {
|
|
17
|
+
animation: 200,
|
|
18
|
+
ghostClass: 'nm-drag-sort-ghost'
|
|
19
|
+
},
|
|
20
|
+
dragOn: {
|
|
21
|
+
start: this.onDragStart,
|
|
22
|
+
end: this.onDragEnd
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
props: {
|
|
27
|
+
value: {
|
|
28
|
+
type: Array,
|
|
29
|
+
required: true
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
methods: {
|
|
33
|
+
onDragStart() {
|
|
34
|
+
this.$emit('start')
|
|
19
35
|
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
36
|
+
onDragEnd() {
|
|
37
|
+
this.list.map((item, index) => {
|
|
38
|
+
item.sort = index
|
|
39
|
+
})
|
|
40
|
+
this.$emit('input', this.list)
|
|
41
|
+
this.$emit('end', this.list)
|
|
23
42
|
}
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
props: {
|
|
27
|
-
value: {
|
|
28
|
-
type: Array,
|
|
29
|
-
required: true
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
methods: {
|
|
33
|
-
onDragStart() {
|
|
34
|
-
this.$emit('start')
|
|
35
43
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
this.$emit('input', this.list)
|
|
41
|
-
this.$emit('end', this.list)
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
watch: {
|
|
45
|
-
value(val) {
|
|
46
|
-
if (val !== this.list) this.list = val
|
|
44
|
+
watch: {
|
|
45
|
+
value(val) {
|
|
46
|
+
if (val !== this.list) this.list = val
|
|
47
|
+
}
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
|
-
}
|
|
50
50
|
</script>
|
|
@@ -7,67 +7,67 @@
|
|
|
7
7
|
</nm-dialog>
|
|
8
8
|
</template>
|
|
9
9
|
<script>
|
|
10
|
-
import visibleMixins from '../../mixins/components/visible'
|
|
11
|
-
export default {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
props: {
|
|
23
|
-
title: {
|
|
24
|
-
type: String,
|
|
25
|
-
default: '排序'
|
|
26
|
-
},
|
|
27
|
-
icon: {
|
|
28
|
-
type: String,
|
|
29
|
-
default: 'sort'
|
|
30
|
-
},
|
|
31
|
-
width: {
|
|
32
|
-
type: String,
|
|
33
|
-
default: '400px'
|
|
10
|
+
import visibleMixins from '../../mixins/components/visible'
|
|
11
|
+
export default {
|
|
12
|
+
name: 'DragSortDialog',
|
|
13
|
+
mixins: [visibleMixins],
|
|
14
|
+
data() {
|
|
15
|
+
return {
|
|
16
|
+
model: {
|
|
17
|
+
options: []
|
|
18
|
+
},
|
|
19
|
+
loading: false
|
|
20
|
+
}
|
|
34
21
|
},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
22
|
+
props: {
|
|
23
|
+
title: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: '排序'
|
|
26
|
+
},
|
|
27
|
+
icon: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: 'sort'
|
|
30
|
+
},
|
|
31
|
+
width: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: '400px'
|
|
34
|
+
},
|
|
35
|
+
height: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: '60%'
|
|
38
|
+
},
|
|
39
|
+
queryAction: {
|
|
40
|
+
type: Function,
|
|
41
|
+
required: true
|
|
42
|
+
},
|
|
43
|
+
updateAction: {
|
|
44
|
+
type: Function,
|
|
45
|
+
required: true
|
|
46
|
+
},
|
|
47
|
+
/** 保存成功后关闭 */
|
|
48
|
+
closeOnSuccess: Boolean
|
|
55
49
|
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
this.loading = false
|
|
61
|
-
this.$emit('success', this.model.options)
|
|
62
|
-
if (this.closeOnSuccess) {
|
|
63
|
-
this.visible_ = false
|
|
64
|
-
}
|
|
65
|
-
})
|
|
66
|
-
.catch(() => {
|
|
67
|
-
this.loading = false
|
|
68
|
-
this.$emit('error')
|
|
50
|
+
methods: {
|
|
51
|
+
onOpen() {
|
|
52
|
+
this.queryAction().then(data => {
|
|
53
|
+
this.model = data
|
|
69
54
|
})
|
|
55
|
+
},
|
|
56
|
+
onUpdate() {
|
|
57
|
+
this.loading = true
|
|
58
|
+
this.updateAction(this.model)
|
|
59
|
+
.then(() => {
|
|
60
|
+
this.loading = false
|
|
61
|
+
this.$emit('success', this.model.options)
|
|
62
|
+
if (this.closeOnSuccess) {
|
|
63
|
+
this.visible_ = false
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
.catch(() => {
|
|
67
|
+
this.loading = false
|
|
68
|
+
this.$emit('error')
|
|
69
|
+
})
|
|
70
|
+
}
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
|
-
}
|
|
73
73
|
</script>
|
|
@@ -4,16 +4,7 @@
|
|
|
4
4
|
<section class="nm-drawer-modal" @click="onModalClick" v-if="modal" v-show="visible"></section>
|
|
5
5
|
</transition>
|
|
6
6
|
<transition :name="`move-${placement}`">
|
|
7
|
-
<section
|
|
8
|
-
ref="dialog"
|
|
9
|
-
class="nm-drawer-dialog"
|
|
10
|
-
:style="{ width: wrapperWidth }"
|
|
11
|
-
v-show="visible"
|
|
12
|
-
v-loading="loading"
|
|
13
|
-
:element-loading-text="loadingText"
|
|
14
|
-
:element-loading-background="loadingBackground"
|
|
15
|
-
:element-loading-spinner="loadingSpinner"
|
|
16
|
-
>
|
|
7
|
+
<section ref="dialog" class="nm-drawer-dialog" :style="{ width: wrapperWidth }" v-show="visible" v-loading="loading" :element-loading-text="loadingText" :element-loading-background="loadingBackground" :element-loading-spinner="loadingSpinner">
|
|
17
8
|
<!--头部-->
|
|
18
9
|
<header v-if="header" class="nm-drawer-header">
|
|
19
10
|
<slot name="header">
|
|
@@ -65,175 +56,175 @@
|
|
|
65
56
|
</section>
|
|
66
57
|
</template>
|
|
67
58
|
<script>
|
|
68
|
-
import { mapState } from 'vuex'
|
|
69
|
-
import { oneOf } from '../../utils/assist'
|
|
70
|
-
import { on, off } from '../../utils/dom'
|
|
71
|
-
export default {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
props: {
|
|
82
|
-
/** 是否显示 */
|
|
83
|
-
visible: Boolean,
|
|
84
|
-
/** 是否显示头部 */
|
|
85
|
-
header: Boolean,
|
|
86
|
-
/** 是否显示底部 */
|
|
87
|
-
footer: Boolean,
|
|
88
|
-
/** 标题 */
|
|
89
|
-
title: String,
|
|
90
|
-
/** 图标 */
|
|
91
|
-
icon: String,
|
|
92
|
-
/** 位置 */
|
|
93
|
-
placement: {
|
|
94
|
-
type: String,
|
|
95
|
-
default: 'right',
|
|
96
|
-
validator(value) {
|
|
97
|
-
return oneOf(value, ['left', 'right'])
|
|
59
|
+
import { mapState } from 'vuex'
|
|
60
|
+
import { oneOf } from '../../utils/assist'
|
|
61
|
+
import { on, off } from '../../utils/dom'
|
|
62
|
+
export default {
|
|
63
|
+
name: 'Drawer',
|
|
64
|
+
data() {
|
|
65
|
+
return {
|
|
66
|
+
canMove: false,
|
|
67
|
+
fullscreen_: false,
|
|
68
|
+
wrapperWidth: this.width,
|
|
69
|
+
minWidth: 226
|
|
98
70
|
}
|
|
99
71
|
},
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
72
|
+
props: {
|
|
73
|
+
/** 是否显示 */
|
|
74
|
+
visible: Boolean,
|
|
75
|
+
/** 是否显示头部 */
|
|
76
|
+
header: Boolean,
|
|
77
|
+
/** 是否显示底部 */
|
|
78
|
+
footer: Boolean,
|
|
79
|
+
/** 标题 */
|
|
80
|
+
title: String,
|
|
81
|
+
/** 图标 */
|
|
82
|
+
icon: String,
|
|
83
|
+
/** 位置 */
|
|
84
|
+
placement: {
|
|
85
|
+
type: String,
|
|
86
|
+
default: 'right',
|
|
87
|
+
validator(value) {
|
|
88
|
+
return oneOf(value, ['left', 'right'])
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
/** 宽度 */
|
|
92
|
+
width: {
|
|
93
|
+
type: String,
|
|
94
|
+
default: '30%'
|
|
95
|
+
},
|
|
96
|
+
/** 是否显示水平滚动条 */
|
|
97
|
+
horizontal: Boolean,
|
|
98
|
+
/** loading */
|
|
99
|
+
loading: Boolean,
|
|
100
|
+
/** 是否附加到Body */
|
|
101
|
+
appendToBody: Boolean,
|
|
102
|
+
/** 是否显示模态框 */
|
|
103
|
+
modal: {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
default: true
|
|
106
|
+
},
|
|
107
|
+
/** 是否点击模态框关闭抽屉 */
|
|
108
|
+
modalClickClose: {
|
|
109
|
+
type: Boolean,
|
|
110
|
+
default: true
|
|
111
|
+
},
|
|
112
|
+
/** 自定义class */
|
|
113
|
+
customClass: String,
|
|
114
|
+
/** 是否显示全屏按钮 */
|
|
115
|
+
fullscreen: {
|
|
116
|
+
type: Boolean,
|
|
117
|
+
default: true
|
|
118
|
+
},
|
|
119
|
+
/** 没有内边距 */
|
|
120
|
+
noPadding: Boolean,
|
|
121
|
+
/** 可拖拽 */
|
|
122
|
+
draggable: {
|
|
123
|
+
type: Boolean,
|
|
124
|
+
default: false
|
|
125
|
+
},
|
|
126
|
+
/** 不显示滚动条 */
|
|
127
|
+
noScrollbar: Boolean
|
|
134
128
|
},
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
...mapState('app/loading', { loadingText: 'text', loadingBackground: 'background', loadingSpinner: 'spinner' }),
|
|
140
|
-
class_() {
|
|
141
|
-
return ['nm-drawer', this.placement, this.fullscreen_ ? 'fullscreen' : '', this.draggable ? 'draggable' : '', this.customClass, this.noPadding ? 'no-padding' : '', this.fontSize]
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
methods: {
|
|
145
|
-
append() {
|
|
146
|
-
if (this.appendToBody) {
|
|
147
|
-
// 附加到body下面
|
|
148
|
-
document.body.appendChild(this.$el)
|
|
129
|
+
computed: {
|
|
130
|
+
...mapState('app/loading', { loadingText: 'text', loadingBackground: 'background', loadingSpinner: 'spinner' }),
|
|
131
|
+
class_() {
|
|
132
|
+
return ['nm-drawer', this.placement, this.fullscreen_ ? 'fullscreen' : '', this.draggable ? 'draggable' : '', this.customClass, this.noPadding ? 'no-padding' : '', this.fontSize]
|
|
149
133
|
}
|
|
150
|
-
|
|
151
|
-
window.addEventListener('resize', this.resize)
|
|
152
|
-
},
|
|
153
|
-
close() {
|
|
154
|
-
this.fullscreen_ = false
|
|
155
|
-
this.$emit('update:visible', false)
|
|
156
|
-
},
|
|
157
|
-
resize() {
|
|
158
|
-
this.$refs.scrollbar.update()
|
|
159
|
-
},
|
|
160
|
-
/** 开启全屏 */
|
|
161
|
-
openFullscreen() {
|
|
162
|
-
this.fullscreen_ = true
|
|
163
|
-
// 全屏事件
|
|
164
|
-
this.$emit('fullscreen-change', this.fullscreen_)
|
|
165
134
|
},
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
135
|
+
methods: {
|
|
136
|
+
append() {
|
|
137
|
+
if (this.appendToBody) {
|
|
138
|
+
// 附加到body下面
|
|
139
|
+
document.body.appendChild(this.$el)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
window.addEventListener('resize', this.resize)
|
|
143
|
+
},
|
|
144
|
+
close() {
|
|
145
|
+
this.fullscreen_ = false
|
|
146
|
+
this.$emit('update:visible', false)
|
|
147
|
+
},
|
|
148
|
+
resize() {
|
|
149
|
+
this.$refs.scrollbar.update()
|
|
150
|
+
},
|
|
151
|
+
/** 开启全屏 */
|
|
152
|
+
openFullscreen() {
|
|
153
|
+
this.fullscreen_ = true
|
|
154
|
+
// 全屏事件
|
|
155
|
+
this.$emit('fullscreen-change', this.fullscreen_)
|
|
156
|
+
},
|
|
157
|
+
/** 关闭全屏 */
|
|
158
|
+
closeFullscreen() {
|
|
159
|
+
this.fullscreen_ = false
|
|
160
|
+
// 全屏事件
|
|
161
|
+
this.$emit('fullscreen-change', this.fullscreen_)
|
|
162
|
+
},
|
|
163
|
+
/** 全屏事件 */
|
|
164
|
+
triggerFullscreen() {
|
|
165
|
+
this.fullscreen_ ? this.closeFullscreen() : this.openFullscreen()
|
|
166
|
+
},
|
|
167
|
+
onModalClick() {
|
|
168
|
+
if (this.modal && this.modalClickClose) {
|
|
169
|
+
this.close()
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
/** 拖拽按钮鼠标按下事件 */
|
|
173
|
+
onTriggerMousedown() {
|
|
174
|
+
if (!this.draggable) return
|
|
175
|
+
this.canMove = true
|
|
176
|
+
// 防止鼠标选中抽屉中文字,造成拖动trigger触发浏览器原生拖动行为
|
|
177
|
+
window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty()
|
|
178
|
+
on(document, 'mousemove', this.onMousemove)
|
|
179
|
+
on(document, 'mouseup', this.onMouseup)
|
|
180
|
+
},
|
|
181
|
+
onMousemove(event) {
|
|
182
|
+
if (!this.canMove || !this.draggable) return
|
|
183
|
+
const { width, x } = this.$el.getBoundingClientRect()
|
|
184
|
+
let wrapperWidth
|
|
185
|
+
if (this.placement === 'right' && event.pageX - x > 20) {
|
|
186
|
+
wrapperWidth = width + x - event.pageX
|
|
187
|
+
} else if (this.placement === 'left' && event.pageX - x < width - 20) {
|
|
188
|
+
wrapperWidth = event.pageX - x
|
|
189
|
+
}
|
|
190
|
+
if (wrapperWidth > this.minWidth) {
|
|
191
|
+
this.wrapperWidth = wrapperWidth + 'px'
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
onMouseup() {
|
|
195
|
+
if (!this.draggable) return
|
|
196
|
+
this.canMove = false
|
|
197
|
+
off(document, 'mousemove', this.onMousemove)
|
|
198
|
+
off(document, 'mouseup', this.onMouseup)
|
|
179
199
|
}
|
|
180
200
|
},
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (!this.draggable) return
|
|
184
|
-
this.canMove = true
|
|
185
|
-
// 防止鼠标选中抽屉中文字,造成拖动trigger触发浏览器原生拖动行为
|
|
186
|
-
window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty()
|
|
187
|
-
on(document, 'mousemove', this.onMousemove)
|
|
188
|
-
on(document, 'mouseup', this.onMouseup)
|
|
189
|
-
},
|
|
190
|
-
onMousemove(event) {
|
|
191
|
-
if (!this.canMove || !this.draggable) return
|
|
192
|
-
const { width, x } = this.$el.getBoundingClientRect()
|
|
193
|
-
let wrapperWidth
|
|
194
|
-
if (this.placement === 'right' && event.pageX - x > 20) {
|
|
195
|
-
wrapperWidth = width + x - event.pageX
|
|
196
|
-
} else if (this.placement === 'left' && event.pageX - x < width - 20) {
|
|
197
|
-
wrapperWidth = event.pageX - x
|
|
198
|
-
}
|
|
199
|
-
if (wrapperWidth > this.minWidth) {
|
|
200
|
-
this.wrapperWidth = wrapperWidth + 'px'
|
|
201
|
-
}
|
|
201
|
+
mounted() {
|
|
202
|
+
this.append()
|
|
202
203
|
},
|
|
203
|
-
|
|
204
|
-
if (!this.draggable) return
|
|
205
|
-
this.canMove = false
|
|
204
|
+
destroyed() {
|
|
206
205
|
off(document, 'mousemove', this.onMousemove)
|
|
207
206
|
off(document, 'mouseup', this.onMouseup)
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
this.$el.parentNode.removeChild(this.$el)
|
|
218
|
-
window.removeEventListener('resize', this.resize)
|
|
219
|
-
}
|
|
220
|
-
},
|
|
221
|
-
watch: {
|
|
222
|
-
visible(val) {
|
|
223
|
-
if (val) {
|
|
224
|
-
this.$emit('open')
|
|
207
|
+
if (this.$el && this.$el.parentNode) {
|
|
208
|
+
this.$el.parentNode.removeChild(this.$el)
|
|
209
|
+
window.removeEventListener('resize', this.resize)
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
watch: {
|
|
213
|
+
visible(val) {
|
|
214
|
+
if (val) {
|
|
215
|
+
this.$emit('open')
|
|
225
216
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
217
|
+
this.$nextTick(() => {
|
|
218
|
+
this.$emit('opened')
|
|
219
|
+
})
|
|
220
|
+
} else {
|
|
221
|
+
this.$emit('close')
|
|
231
222
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
223
|
+
this.$nextTick(() => {
|
|
224
|
+
this.$emit('closed')
|
|
225
|
+
})
|
|
226
|
+
}
|
|
235
227
|
}
|
|
236
228
|
}
|
|
237
229
|
}
|
|
238
|
-
}
|
|
239
230
|
</script>
|
|
@@ -19,40 +19,40 @@
|
|
|
19
19
|
</section>
|
|
20
20
|
</template>
|
|
21
21
|
<script>
|
|
22
|
-
export default {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
export default {
|
|
23
|
+
name: 'Flex',
|
|
24
|
+
props: {
|
|
25
|
+
// 布局方向,对应flex-direction属性
|
|
26
|
+
direction: {
|
|
27
|
+
type: String,
|
|
28
|
+
validator(value) {
|
|
29
|
+
return value === 'column' || value === 'row'
|
|
30
|
+
},
|
|
31
|
+
default: 'column'
|
|
30
32
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
type: String,
|
|
36
|
-
required: true
|
|
37
|
-
},
|
|
38
|
-
// 固定模式,top、bottom、left、right
|
|
39
|
-
fixMode: {
|
|
40
|
-
type: String,
|
|
41
|
-
validator(value) {
|
|
42
|
-
return ['top', 'bottom', 'left', 'right'].includes(value)
|
|
33
|
+
// 固定宽度或高度
|
|
34
|
+
fix: {
|
|
35
|
+
type: String,
|
|
36
|
+
required: true
|
|
43
37
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
38
|
+
// 固定模式,top、bottom、left、right
|
|
39
|
+
fixMode: {
|
|
40
|
+
type: String,
|
|
41
|
+
validator(value) {
|
|
42
|
+
return ['top', 'bottom', 'left', 'right'].includes(value)
|
|
43
|
+
},
|
|
44
|
+
default: 'top'
|
|
45
|
+
},
|
|
46
|
+
height: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: '100%'
|
|
49
|
+
},
|
|
50
|
+
width: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: '100%'
|
|
53
|
+
},
|
|
54
|
+
/** 间隔 */
|
|
55
|
+
gutter: Number
|
|
56
|
+
}
|
|
56
57
|
}
|
|
57
|
-
}
|
|
58
58
|
</script>
|