| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- <template>
- <div class="confirm_dialog">
- <el-dialog
- :visible.sync="dialogVisible"
- width="400px"
- :show-close="false"
- :before-close="handleClose"
- class="confirm_dialog_custom"
- >
- <div class="confirm_dialog_content">
- <h3 class="confirm_dialog_title">
- <span>{{ title }}</span>
- <div class="modal-close" @click="handleClose">×</div>
- </h3>
- <p class="confirm_dialog_message" v-html="message"></p>
- </div>
- <div class="confirm_dialog_footer">
- <el-button @click="handleCancel" class="cancel_btn">{{ cancelText }}</el-button>
- <el-button type="primary" @click="handleConfirm" class="confirm_btn">{{ confirmText }}</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- export default {
- name: 'ConfirmDialog',
- props: {
- visible: {
- type: Boolean,
- default: false
- },
- title: {
- type: String,
- default: ''
- },
- message: {
- type: String,
- default: ''
- },
- confirmText: {
- type: String,
- default: '确认'
- },
- cancelText: {
- type: String,
- default: '取消'
- }
- },
- data() {
- return {
- dialogVisible: this.visible
- }
- },
- watch: {
- visible: {
- handler(newVal) {
- this.dialogVisible = newVal;
- },
- immediate: true
- }
- },
- methods: {
- handleClose() {
- this.dialogVisible = false;
- this.$emit('update:visible', false);
- },
- handleCancel() {
- this.dialogVisible = false;
- this.$emit('update:visible', false);
- this.$emit('cancel');
- },
- handleConfirm() {
- this.dialogVisible = false;
- this.$emit('update:visible', false);
- this.$emit('confirm');
- }
- }
- }
- </script>
- <style scoped>
- .confirm_dialog_custom >>> .el-dialog {
- border-radius: 15px;
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
- }
- .confirm_dialog_custom >>> .el-dialog__header {
- display: none;
- }
- .confirm_dialog_custom >>> .el-dialog__body {
- padding: 20px;
- }
- .confirm_dialog_title {
- font-size: 18px;
- font-weight: bold;
- margin-bottom: 16px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .modal-close {
- font-size: 24px;
- color: #909399;
- cursor: pointer;
- transition: color 0.3s;
- width: 30px;
- height: 30px;
- line-height: 30px;
- border-radius: 5px;
- text-align: center;
- font-weight: 500;
- }
- .modal-close:hover {
- /* color: #409eff; */
- background-color: #f3f4f6;
- }
- .confirm_dialog_message {
- font-size: 14px;
- line-height: 1.5;
- color: #666;
- margin-bottom: 24px;
- }
- .confirm_dialog_footer {
- display: flex;
- justify-content: flex-end;
- /* gap: 12px; */
- }
- .cancel_btn {
- border-radius: 10px;
- border: 1px solid #DCDFE6;
- background-color: #FFFFFF;
- color: #606266;
- }
- .confirm_btn {
- border-radius: 10px;
- background-color: #FF9400;
- border: none;
- color: #FFFFFF;
- }
- .confirm_btn:hover {
- background-color: #FFA500;
- }
- </style>
|