<template>
  <div class="tag-layer" @click.stop>
    <img class="close" @click.stop="close"
      :src="require('@/assets/images/icon/material_preview_close@2x.png')" alt="" />

    <div class="linkcon">
      <div class="linkbody">
        <iframe :src="link" frameborder="0"></iframe>
      </div>
    </div>
  </div>

</template>

<script setup>
import { reactive, defineEmits, onBeforeMount, onMounted, ref, watchEffect, computed, watch, nextTick } from "vue";
import { useStore } from "vuex";
const store = useStore();

const metadata = computed(() => store.getters["scene/metadata"]);


const link = computed(() => {
  return metadata.value.customButton ? metadata.value.customButton.find(item => item.name == '链接').value : false
});

const close = () => {
  store.commit("functions/setShowLink", false);
};

</script>

<style lang="scss" scoped>

.tag-layer {
  width: 100vw;
  height: 100vh;
  z-index: 10000;
  top: 0;
  position: fixed;
  left: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);

  .linkcon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;

  .linkbody {
    width: 90%;
    height: 90%;
    background: rgba(255,255,255,1);
    border-radius: 2px;
    color: #fff;
    >iframe{
      width: 100%;
      height: 100%;
    }
  }

  .title {
    position: absolute;
    left: 20px;
    top: 20px;
    height: 36px;
    line-height: 36px;
    padding: 0 30px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 20px;
    color: #fff;
    font-size: 14px;

    >i {
      margin-right: 4px;
    }
  }
}
  .close {
    width: 36px;
    height: 36px;
    right: 30px;
    top: 30px;
    position: absolute;
    cursor: pointer;
    z-index: 999;
  }
}

</style>