index.vue 3.04 KB
<template>
  <div>
    <el-dialog :title="title" :visible.sync="isVisible" :before-close="handleClose" :close-on-click-modal="false" :width="width" :show-close="isShowCloseBtn" class="app-dialog">
      <!-- :modal-append-to-body="false"
      :append-to-body="true" -->
      <div class="container">
        <slot></slot>
      </div>

      <div slot="footer">
        <slot name="btn-front"></slot>
        <el-button @click="handleClose">取消</el-button>
        <el-button type="primary" @click="handleConfirm" :loading="btnLoading">{{ btnOkLabel }}</el-button>
        <el-button v-if="isShowThirdBtn" @click="btnClick">创建标签</el-button>

        <slot name="btn-behind"></slot>
      </div>
    </el-dialog>
  </div>
</template>
<script>
export default {
  name: 'basic-dialog',
  props: {
    title: {
      type: String,
      default: ''
    },
    isShowCloseBtn: {
      type: Boolean,
      default: false
    },
    isShowThirdBtn: {
      type: Boolean,
      default: false
    },
    isVisible: {
      type: Boolean,
      default: false
    },
    btnOkLabel: {
      type: String,
      default: '确定'
    },
    width: {
      type: String,
      default: '580px'
    },
    btnLoading: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    handleClose() {
      this.$emit('closeDialog')
    },
    handleConfirm() {
      this.$emit('confirmDialog')
    },
    btnClick() {
      this.$emit('btnEvent')
    }
  }
}
</script>

<style lang="scss">
.app-dialog {
  .el-dialog__header {
    padding: 20px 20px 10px;
  }
  .el-dialog__footer {
    padding: 15px;
    background: #fff;
  }
  .el-dialog__body {
    padding: 0;
    border-top: 1px solid #eaeefb;
    border-bottom: 1px solid #eaeefb;
    min-height: 250px;
    max-height: 636px;
    overflow-y: auto;

    .container {
      > span {
        display: block;
      }
      overflow-y: auto;
      // max-height: 638px;
      padding: 20px 20px;
    }
    &::-webkit-scrollbar {
      width: 10px;
      height: 10px;
    }

    /*正常情况下滑块的样式*/

    &::-webkit-scrollbar-thumb {
      background-color: rgba(0, 0, 0, 0.05);
      border-radius: 10px;
      box-shadow: inset 1px 1px 0 rgba(0, 0, 0, 0.1);
    }
    /*鼠标悬浮在该类指向的控件上时滑块的样式*/

    &::-webkit-scrollbar-thumb {
      // background-color: rgba(0, 0, 0, 0.2);
      background: #e9e8ff;

      border-radius: 10px;

      box-shadow: inset 1px 1px 0 rgba(0, 0, 0, 0.1);
    }

    /*鼠标悬浮在滑块上时滑块的样式*/

    // &::-webkit-scrollbar-thumb:hover {
    //   background-color: rgba(0, 0, 0, 0.4);

    //   box-shadow: inset 1px 1px 0 rgba(0, 0, 0, 0.1);
    // }

    /*正常时候的主干部分*/

    &::-webkit-scrollbar-track {
      border-radius: 10px;

      box-shadow: inset 0 0 6px rgba(0, 0, 0, 0);

      background-color: white;
    }

    /*鼠标悬浮在滚动条上的主干部分*/

    &::-webkit-scrollbar-track:hover {
      box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4);
      background-color: rgba(0, 0, 0, 0.01);
    }
  }
}
</style>