Skip to content

Commit 1c9eed4

Browse files
committed
edit [b-modal]
1 parent 2742e5d commit 1c9eed4

File tree

5 files changed

+86
-165
lines changed

5 files changed

+86
-165
lines changed

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"howler": "^2.2.1",
2929
"jquery": "^3.6.0",
3030
"moment": "^2.29.1",
31-
"popper.js": "^1.16.1",
3231
"print-js": "^1.6.0",
3332
"province-city-china": "^7.1.3",
3433
"register-service-worker": "^1.7.2",

src/components/base/Modal/b-modal.vue

+25-69
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,32 @@
44
:class="ObjClass"
55
tabindex="-1"
66
role="dialog"
7-
:aria-labelledby="labelledby"
7+
:data-bs-keyboard="!backdrop && keyboard"
8+
:data-bs-backdrop="backdrop ? 'static' : true"
89
:aria-modal="show"
9-
aria-hidden="false"
10+
:aria-hidden="!show"
1011
>
1112
<div
1213
class="modal-dialog my-0"
1314
:class="documentClass"
14-
:style="documentStyle"
1515
role="document"
1616
>
1717
<div class="modal-content">
1818
<div class="modal-header">
1919
<h5 class="modal-title">
20-
<slot
21-
v-if="$slots.icon || showIcon"
22-
name="icon"
23-
>
24-
<i
25-
class="me-2"
26-
:class="iconClass"
27-
/>
28-
</slot>
29-
{{ dataTitle }}
20+
<basic-label
21+
:label="dataTitle"
22+
:icon="dataIcon"
23+
:info="info"
24+
:iconColor="dataColor"
25+
/>
3026
</h5>
3127
<button
3228
type="button"
33-
class="close"
34-
data-dismiss="modal"
29+
class="btn-close"
30+
data-bs-dismiss="modal"
3531
aria-label="Close"
36-
>
37-
<span aria-hidden="true">&times;</span>
38-
</button>
32+
/>
3933
</div>
4034
<div class="modal-body">
4135
<slot>{{ content }}</slot>
@@ -45,11 +39,10 @@
4539
class="modal-footer"
4640
>
4741
<slot name="footer">
48-
<!-- TODO: 关闭方式存在问题 -->
4942
<button
5043
type="button"
5144
class="btn btn-secondary"
52-
data-dismiss="modal"
45+
data-bs-dismiss="modal"
5346
>
5447
Close
5548
</button>
@@ -69,29 +62,27 @@
6962
<script>
7063
import util from "@/components/util/index.js";
7164
65+
import BasicLabel from '@/components/basic/basic-label.vue'
66+
7267
export default {
7368
name: "BModal",
69+
components: { BasicLabel, },
7470
mixins: [ util.mixins.status.message, ],
7571
props: {
72+
info: util.props.String,
7673
content: util.props.String,
77-
scrol: util.props.Boolean, //modal-dialog-scrollable
74+
backdrop: util.props.Boolean,//
75+
keyboard: util.props.Boolean,
76+
scrol: util.props.Boolean, // modal-dialog-scrollable
77+
center: util.props.Boolean,// modal-dialog-centered
7878
hideFooter: util.props.Boolean,
79-
drawer: util.props.Boolean,
8079
size: {
8180
type: String,
8281
default: "",
8382
validator: function(val) {
8483
return ["", "xl", "lg", "sm"].includes(val);
8584
}
8685
}, // modal-xl modal-lg modal-sm
87-
set: {
88-
...util.props.set,
89-
default: 'up',
90-
},
91-
labelledby: {
92-
...util.props.String,
93-
default: "Modal Dialog"
94-
},
9586
},
9687
data() {
9788
return {
@@ -103,46 +94,11 @@ export default {
10394
return this.show ? "show" : "";
10495
},
10596
documentClass: function() {
106-
let scrol = this.scrol ? "modal-dialog-scrollable" : "";
10797
let size = this.size ? `modal-${this.size}` : "";
108-
let set = ''
109-
switch (this.set) {
110-
case 'left':
111-
set = 'w-25 ms-0 d-flex align-items-right'
112-
break;
113-
case 'right':
114-
set = 'w-25 me-0 d-flex align-items-right'
115-
break;
116-
case 'center':
117-
set = 'd-flex align-items-center'
118-
break;
119-
case 'down':
120-
set = 'd-flex align-items-end'
121-
break;
122-
default:
123-
set = ''
124-
}
125-
return `${scrol} ${set} ${size}`;
126-
},
127-
documentStyle: function() {
128-
let set = ''
129-
switch (this.set) {
130-
case 'left':
131-
set = this.drawer ? 'min-height: 100%' : ''
132-
break;
133-
case 'right':
134-
set = this.drawer ? 'min-height: 100%' : ''
135-
break;
136-
case 'center':
137-
set = this.drawer ? 'min-height: 100%; min-width: 100%' : 'min-height: 100%;'
138-
break;
139-
case 'down':
140-
set = this.drawer ? 'min-height: 100%; min-width: 100%' : 'min-height: 100%'
141-
break;
142-
default:
143-
set = this.drawer ? 'min-width: 100%' : ''
144-
}
145-
return set
98+
let scrol = this.scrol ? "modal-dialog-scrollable" : "";
99+
let center = this.center ? 'modal-dialog-centered' : ''
100+
101+
return `${scrol} ${size} ${center}`;
146102
},
147103
},
148104
methods: {

src/components/util/directives/modal.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import tools from '@/tools/index.js'
66
const name = 'modal'
77
const func = (el, binding) => {
88
tools.dom.addAttrs(el, {
9-
'data-toggle': 'modal',
10-
'data-target': binding.value
9+
'data-bs-toggle': 'modal',
10+
'data-bs-target': binding.value
1111
})
1212
}
1313

src/config/status.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
const base = {
2-
default: { title: 'Default', color: 'primary', icon: 'far fa-dot-circle' },
3-
success: { title: 'Success', color: 'success', icon: 'far fa-check-circle' },
4-
warning: { title: 'Warning', color: 'warning', icon: 'far fa-exclamation-triangle'},
5-
error: { title: 'Error', color: 'danger', icon: 'far fa-times-circle'},
6-
danger: { title: 'Danger', color: 'danger', icon: 'far fa-exclamation-circle'},
2+
default: { title: 'Default', color: 'primary', icon: 'record-circle-fill' },
3+
success: { title: 'Success', color: 'success', icon: 'check-circle-fill' },
4+
warning: { title: 'Warning', color: 'warning', icon: 'exclamation-triangle-fill'},
5+
error: { title: 'Error', color: 'danger', icon: 'x-circle-fill'},
6+
danger: { title: 'Danger', color: 'danger', icon: 'exclamation-circle-fill'},
77
}
88

99
const message = {
1010
...base,
11-
system: { title: 'System Info', color: 'info', icon: 'far fa-cog' },
12-
info: { title: 'Info', color: 'info', icon: 'far fa-info-circle' },
13-
issue: { title: 'Issue', color: 'secondary', icon: 'far fa-question-circle' },
11+
system: { title: 'System Info', color: 'info', icon: 'info-lg' },
12+
info: { title: 'Info', color: 'info', icon: 'info-circle-fill' },
13+
issue: { title: 'Issue', color: 'secondary', icon: 'question-circle-fill' },
1414
}
1515

1616
const method = {

0 commit comments

Comments
 (0)