Newer
Older
xc-business-system / src / views / business / taskMeasure / measureData / list-excel-bak.vue
<!-- 文件预览组件(通过文件名获取文件url) -->
<script lang="ts" setup name="ExcelOreview">
import VueOfficeExcel from '@vue-office/excel'
import '@vue-office/excel/lib/index.css'
// 打印文件url
const props = defineProps({
  printFileName: {
    type: String,
  },
})
const wordUrl = ref('')

watch(() => props.printFileName, (newVal) => {
  // console.log('newVal', newVal)

  if (newVal) {
    // init()
    wordUrl.value = newVal
  }
}, { immediate: true })
const rendered = () => {
  console.log('渲染完成')
}
const errorHandler = () => {
  console.log('渲染失败')
}
onMounted(() => {
  // init()
})
</script>

<template>
  <vue-office-excel src="http://static.shanhuxueyuan.com/demo/excel.xlsx" style="width: 1000px;height: 600px;" @rendered="rendered" @error="errorHandler" />
</template>

<style lang="scss">
// 样式
.docx-wrapper {
  background: transparent !important;
}
</style>