<template>
  <qf-dialog class="qf-dialog-doc" :title="title" :confirmText="confirmText" :showCancel="showCancel" @cancel="doCancel" @confirm="doConfirm"
             :style="dialogStyle()">
    <iframe :src="url" frameborder="0"></iframe>
  </qf-dialog>
</template>

<script>
import QfDialog from './def';
import LocaleMixin from '../locale/mixin';
import { t } from '../locale';

export default {
  name: 'QfDialogDoc',
  mixins: [LocaleMixin],
  components: {
    QfDialog
  },
  data() {
    return {
      url: '', // url路径
      title: '',
      confirmText: t('qf.dialogdoc.confirmText'),
      showCancel: false,
      width: 800,
      height: 500
    };
  },

  methods: {
    /**
     * DIALOG确定事件
     */
    doConfirm() {
      this.$emit('hide');
    },

    /**
     * DIALOG关闭事件
     */
    doCancel() {
      this.$emit('hide');
    },

    dialogStyle() {
      return {
        width: this.width + 'px',
        height: this.height + 'px'
      };
    }
  }

};
</script>
