<template>
  <el-dialog :title="content.title" width="800px" append-to-body
             :close-on-click-modal="false"
             :visible.sync="visible"
             center
             lock-scroll
             @close="dataFormClose()">
    <div class="head">
      <div class="item-author item">
                    作者：{{ content.user.name }}
      </div>
      <div class="item-author item">
                    热度：{{ content.count }}
      </div>
    </div>
    <mavon-editor
              ref="mdedit"
              v-model="content.content"
              :subfield = "false"
              :defaultOpen = "'preview'"
              :toolbarsFlag = "false"
              :boxShadow="false"
              :transition="false"></mavon-editor>
  </el-dialog>
</template>

<script>
import MavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
export default {
  data () {
    return {
      visible: false,
      content: {

      }
    }
  },
  components: {
    'mavon-editor': MavonEditor.mavonEditor
  },
  activated () {
  },
  methods: {
    init (id) {
      this.visible = true
      this.$http({
        url: this.$http.adornUrl('/pattern/gettextbook'),
        method: 'get',
        params: this.$http.adornParams({
          'id': id
        })
      }).then(({ data }) => {
        if (data && data.successful) {
          this.content = data.resultValue
        }
      })
    }
  }
}
</script>
<style scoped>
.head{
  display: flex;
  flex-direction: row;
  justify-content: space-between
}
</style>
