<template>
  <el-drawer :title="title" :visible.sync="drawerVisible" :class="['ps-drawer__wrapper', large && 'large']" :destroy-on-close="true" :before-close="closeDrawer">
    <div class="ps-drawer">
      <div class="ps-drawer--body">
        <el-scrollbar style="height: 100%">
          <div class="ps-drawer--body__con">
            <slot name="body">

            </slot>
          </div>
        </el-scrollbar>
      </div>
      <div class="ps-drawer--footer">
        <slot name="footer">

        </slot>
      </div>
    </div>
  </el-drawer>
</template>

<script>
export default {
  name: "PsDrawer",
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    title: {
      type: String,
      default: null,
    },
    large: {
      type: Boolean,
      default: false
    },
    id: { type: String, default: "" }
  },
  watch: {
    visible: {
      handler(val) {
        this.drawerVisible = val
      },
      immediate: true
    }
  },
  data() {
    return {
      drawerVisible: false,
      isLoading: false,
    };
  },
  created() {

  },
  mounted() {
  },
  methods: {
    closeDrawer(){
      console.log('------------------')
      this.drawerVisible = false
      this.$emit('update:visible', false)
      this.$emit('close', false)
    }
  },
};
</script>

<style></style>
