excel.vue 662 B

123456789101112131415161718192021222324252627282930313233
  1. <template>
  2. <VueOfficeExcel :src="excel" @rendered="renderedHandler" @error="errorHandler" style="height: 100vh;width: 100vh"/>
  3. </template>
  4. <script>
  5. export default {
  6. name: 'Excel'
  7. }
  8. </script>
  9. <script setup>
  10. //引入VueOfficeExcel组件
  11. import VueOfficeExcel from '@vue-office/excel'
  12. //引入相关样式
  13. import '@vue-office/excel/lib/index.css'
  14. import {ref, watch} from 'vue'
  15. const props = defineProps({
  16. modelValue: {
  17. type: String,
  18. default: () => ""
  19. }
  20. })
  21. const excel = ref('')
  22. watch(() => props.modelValue, val => excel.value = val, {immediate: true})
  23. const renderedHandler = () => {
  24. }
  25. const errorHandler = () => {
  26. }
  27. </script>
  28. <style>
  29. </style>