<!--  -->
<template>
  <div class="web-box" :style="metasHeight ? `height:${metasHeight}px;` : ''">
    <div class="show-tips" v-if="link.length == 0">
      <span>{{ $t('tag.toolbox.webShow') }}</span>
    </div>
    <div class="iframe-box" v-if="link.length > 0">
      <iframe :key="i.sid" v-for="i in link" :src="i.src" frameborder="0"></iframe>
    </div>
  </div>
</template>

<script setup lang="ts">
  import { computed, defineProps } from 'vue';
  import { tagType } from '/@/store/modules/scene';

  const props = defineProps({
    data: {
      type: Object,
      default: {} as any as tagType,
    },
    metasHeight: {
      type: Number,
      default: null,
    },
  });
  // const linkNum = ref(0);
  // const hotData = computed(() => store.getters['tag/hotData']);
  const link = computed(() => {
    return props.data.media.link;
  });
</script>
<style lang="scss" scoped>
  .del-btn {
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    position: absolute;
    cursor: pointer;
    top: 10px;
    right: 10px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .web-box {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: absolute;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    top: 0;
    left: 0;
    z-index: 10;
    .show-tips {
      width: 100%;
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      span {
        color: rgba(255, 255, 255, 0.3);
        font-size: 16px;
        font-weight: bold;
      }
    }
    .iframe-box {
      width: 100%;
      height: 100%;
      position: absolute;
      top: 0;
      left: 0;
      iframe {
        width: 100%;
        height: 100%;
      }
    }
    .input-web {
      height: 32px;
      background: linear-gradient(180deg, rgba(0, 0, 0, 0.25) 0%, #000000 200%) !important;
      border-radius: 0px 0px 4px 4px;
      position: absolute;
      bottom: 0;
      left: 0;
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 10px 0 0;
      &.disabled {
        background: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, #000000 200%) !important;
        opacity: 0.8 !important;
      }
      input {
        background: none;
        border: none;
        padding: 0 0 0 10px;
        width: 94%;
        box-sizing: border-box;
        &:focus {
          border: none;
        }
        &::placeholder {
          color: rgba(255, 255, 255, 0.6);
        }
      }
      .ok-web {
        width: 16px;
        height: 16px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.6);
        color: rgba(0, 0, 0, 0.6);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
      }
    }
  }
</style>
