<template>
  <div style="height: 100%">
    <FixedDialog
      v-if="position === 'fixed'"
      :imgUrl="imgUrl"
      :title="title"
      :subtitle="subtitle"
      v-bind="$attrs"
      @onClickImg="onClickImg"
    />
    <SuspensionDialog
      v-else
      v-bind="$attrs"
      :imgUrl="imgUrl"
      :title="title"
      :subtitle="subtitle"
      @onClickIcon="onClickIcon"
      @onClickImg="onClickImg"
    />
  </div>
</template>
<script>
/*
 * @Author: yangxin
 * @Date: 2021-09-18 14:22:36
 * @Last Modified by: mikey.zhaopeng
 * @Last Modified time: 2021-11-23 16:21:26
 */
import FixedDialog from "./component/FixedDialog/index.vue";
import SuspensionDialog from "./component/SuspensionDialog/index.vue";
export default {
  name: "CodeDialog",
  components: { SuspensionDialog, FixedDialog },
  props: {
    position: {
      type: String,
      default: "suspension",
    },
    imgUrl: {
      type: String,
      default: "",
    },
    title: {
      type: String,
      default: "",
    },
    subtitle: {
      type: String,
      default: "",
    },
  },
  methods: {
    onClickImg() {
      this.$emit("onClickImg", {
        title: this.title,
        subtitle: this.subtitle,
        url: this.imgUrl,
      });
    },
    onClickIcon() {
      this.$emit("onClickIcon", {
        title: this.title,
        subtitle: this.subtitle,
        url: this.imgUrl,
      });
    },
  },
};
</script>
<style lang="scss" scoped></style>
