chenrui 3 лет назад
Родитель
Сommit
969f8a911b
1 измененных файлов с 18 добавлено и 20 удалено
  1. 18 20
      src/views/common/commonModal.vue

+ 18 - 20
src/views/common/commonModal.vue

@@ -5,18 +5,14 @@
     :footer="null"
     :maskClosable="false"
     v-model="isShow"
+    :title="modalTit"
+    :bodyStyle="{padding: modalTit?'25px 32px 20px':'50px 32px 15px'}"
     @cancle="isShow=false"
     :width="416">
     <a-spin :spinning="spinning" tip="Loading...">
-      <div class="common-main">
-        <a-icon type="question-circle" style="color: #faad14;font-size: 22px;margin-right: 16px;" />
-        <div class="common-cont">
-          <p class="common-tit">提示</p>
-          <p class="common-txt">{{ content }}</p>
-        </div>
-      </div>
+      <div class="common-main" v-html="modalHtml"></div>
       <div class="btn-box">
-        <a-button type="primary" class="button-warning" @click="handleCommonFail" v-if="isCancel">{{ cancelText }}</a-button>
+        <a-button type="primary" class="button-warning" @click="handleCommonCancel" v-if="isCancel">{{ cancelText }}</a-button>
         <a-button type="primary" class="button-info" @click="handleCommonOk">{{ okText }}</a-button>
       </div>
     </a-spin>
@@ -31,23 +27,27 @@ export default {
       type: Boolean,
       default: false
     },
-    content: {
+    modalTit: { // 弹框标题
+      type: String,
+      default: null
+    },
+    modalHtml: {
       type: String,
-      default: '请点击下方按钮确认操作?'
+      default: ''
     },
-    okText: {
+    okText: { // 确定 按钮文字
       type: String,
       default: '确定'
     },
-    cancelText: {
+    cancelText: { // 取消 按钮文字
       type: String,
       default: '取消'
     },
-    isCancel: {
+    isCancel: { // 是否显示  取消 按钮
       type: Boolean,
       default: true
     },
-    spinning: {
+    spinning: { // 加载中
       type: Boolean,
       default: false
     }
@@ -63,8 +63,8 @@ export default {
       this.$emit('ok')
     },
     // 取消
-    handleCommonFail () {
-      this.$emit('fail')
+    handleCommonCancel () {
+      this.$emit('cancel')
     }
   },
   watch: {
@@ -84,11 +84,9 @@ export default {
 
 <style lang="less">
   .common-modal{
-    .ant-modal-body{
-      padding: 32px 32px 24px;
-    }
     .common-main{
       display: flex;
+      line-height: 20px;
       .common-cont{
         .common-tit{
           color: rgba(0, 0, 0);
@@ -107,7 +105,7 @@ export default {
     }
     .btn-box{
       text-align: right;
-      margin-top: 24px;
+      margin-top: 20px;
     }
   }
 </style>