<template>
    <div>
      <!-- :routerName='routerName' -->
        <functionBar class="F_bar" @isSaved="isSaved"/>
        <b-container fluid>
      <b-row class="no-padding" style="padding-top: 25px;">
            <b-col cols="12" style="margin-top: 80px">
                  <file-review-content style="margin-right:80px" ref="fileReviewContent" />
            </b-col>
      </b-row>
      </b-container>
    </div>
</template>

<script>
import functionBar from '@/views/FileManagement/FileEdit/functionBar.vue'
import fileReviewContent from '@/views/FileManagement/FileEdit/fileReviewContent.vue'

export default {
  data () {
    return {
      // routerName: ''
      isCreate: ''
    }
  },
  // beforeRouteLeave (to, from, next) {
  //   this.routerName = to.name
  //   console.log(to)
  //   next()
  // },
  beforeRouteLeave (to, from, next) {
    if (this.isCreate !== true) {
      const answer = window.confirm('尚未儲存，確定離開當前畫面?')
      if (answer) {
        next()
      } else {
        next(false)
      }
    } else {
      next()
    }
  },
  methods: {
    isSaved (value) {
      console.log(value)
      this.isCreate = true
    }
  },
  components: {
    fileReviewContent,
    functionBar
  }
}
</script>

<style lang="scss" scoped>
//發文內容頂部抬頭間距

.main-content .container-sm, .main-content .container-md, .main-content .container-lg, .main-content .container-xl{
  padding-left: 25px !important;
  padding-right: 25px !important;
}
.no-padding [class*="col-"] {
  padding-left: 0 !important;
  padding-right: 0 !important;

}
</style>
