Skip to content

Commit bc4a7fa

Browse files
committed
封装cofirm遮罩层
1 parent c972ad0 commit bc4a7fa

File tree

7 files changed

+41
-12
lines changed

7 files changed

+41
-12
lines changed

build/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const webpackConfig = {
7575
}),
7676
new HtmlWebpackPlugin({
7777
filename: 'index.html',
78-
template: path.resolve(__dirname, '../src/index.html'),
78+
template: path.resolve(__dirname, '../index.html'),
7979
inject: true
8080
})
8181
]

build/webpack.dist.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ const webpackConfig = {
121121
}),
122122
new HtmlWebpackPlugin({
123123
filename: 'index.html',
124-
template: path.resolve(__dirname, '../src/index.html'),
124+
template: path.resolve(__dirname, '../index.html'),
125125
inject: true,
126126
minify: {
127127
removeAttributeQuotes: true,
File renamed without changes.

src/components/common.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
.axios-loading{ font-size: 35px; .el-loading-spinner .el-loading-text{ font-size: 18px; }}.axios-error{ width: 25%; .el-message-box__message p{ font-size: 18px; color: #000000; } .el-message-box__status.el-icon-error{ font-size: 40px !important; }}
1+
.axios-loading{ font-size: 35px; .el-loading-spinner .el-loading-text{ font-size: 18px; }}.axios-error{ width: 25%; .el-message-box__message p{ font-size: 18px; color: #000000; } .el-message-box__status.el-icon-error{ font-size: 40px !important; }}.confirm-dialog{ padding-bottom: 0; border: 0; width: 25%; .el-message-box__message p{ font-size: 18px; color: #000000; } .el-message-box__status.el-icon-warning{ font-size: 40px !important; } .el-message-box__btns{ padding: 0; button:nth-child(2){ //第二个按钮,即'确定'按钮 width: 100%; margin-left: 0; padding: 20px; margin-top: 40px; font-size: 18px; color: rgb(51, 51, 51); background-color: rgb(209, 218, 231); border-color: rgb(209, 218, 231); } }}

src/components/layout.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
};
104104
</script>
105105

106-
<style lang="scss">
106+
<style lang="scss" scoped>
107107
.logo{
108108
109109
}

src/components/modal.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { MessageBox, Message } from 'element-ui';
2+
import 'components/common.scss';
3+
4+
const Modal = {
5+
confirmModal(data, ok) {
6+
MessageBox.confirm(data, {
7+
confirmButtonText: '确定',
8+
customClass: 'confirm-dialog',
9+
center: true,
10+
type: 'warning',
11+
showCancelButton: false
12+
}).then(() => {
13+
// ok确认回调可放到调用的地方,单独定义
14+
Message({
15+
type: 'success',
16+
message: '全部开启成功!'
17+
});
18+
}).catch(() => {
19+
Message({
20+
type: 'info',
21+
message: '已取消开启操作'
22+
});
23+
});
24+
}
25+
};
26+
27+
export default Modal;
28+

src/pages/item1/item1.vue

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,28 @@
22
<Layout>
33
<div slot="content" class="item1">
44
<div class="text">
5-
item1
5+
<el-button type="primary" @click="handleOpen">全部打开</el-button>
66
</div>
77
</div>
88
</Layout>
99
</template>
1010

1111
<script>
1212
import Layout from 'components/layout';
13-
// import './item1.scss';
13+
import Modal from 'components/modal';
1414
1515
export default {
1616
components: {
1717
Layout
18+
},
19+
methods: {
20+
handleOpen() {
21+
Modal.confirmModal('确定打开所有设备吗?');
22+
}
1823
}
1924
};
2025
</script>
2126

22-
<style lang="scss">
23-
.item1{
24-
.text{
25-
color: red;
26-
}
27-
}
27+
<style lang="scss" scoped>
28+
2829
</style>

0 commit comments

Comments
 (0)