<template>
  <el-drawer
    class="noticeDetail"
    title="公告详情"
    :visible.sync="visible"
    direction="rtl"
    :size="drawerWidth"
    :before-close="handleClose"
  >
    <div v-html="content"></div>
    <div style="text-align: center">
      <el-button
        icon="el-icon-back"
        style="margin-left: 15px"
        size="medium"
        @click="handleClose"
      >返回
      </el-button>
    </div>
  </el-drawer>
</template>

<script>
  import api from '@/api/work/notice'

  export default {
    name: "noticeDetail",
    data() {
      return {
        drawerWidth: document.body.clientWidth - 190 + "px",
        content:''
      }
    },
    props: {
      visible: {
        type: Boolean,
        default() {
          return false
        }
      },
      noticeId: {
        type: Number,
        default() {
          return 0
        }
      }
    },
    created() {
      this.getInfo()
    },
    methods: {
      handleClose(){
        this.$emit('handleClose')
      },
      getInfo() {
        api.info(this.noticeId).then(res => {
          this.content=res.data.content
        }).catch(e => {
          this.content=''
        });
      }
    }
  }
</script>

<style lang="less">
  .noticeDetail {

  }
</style>
