<script setup>
import { ref,computed } from 'vue'

const props = defineProps({
  url: {
    type: String
  }
})

const linkUrl = computed(() => {
  if(props.url.endsWith('.doc') || props.url.endsWith('.docx')||props.url.endsWith('.xlsx')){ 
    return `https://view.officeapps.live.com/op/view.aspx?src=${props.url}`
  }else {
    return props.url
  }
  
})

</script>
<template>
  <div>
    <iframe :src="linkUrl" frameborder="0"></iframe>
  </div>
</template>
<style scoped lang="scss">
  iframe {
    width: 100%;
    height: 100vh;
  }
</style>