docx.vue 614 B

123456789101112131415161718192021222324252627282930313233343536
  1. <template>
  2. <vue-office-docx :src="docx" @rendered="rendered">
  3. </vue-office-docx>
  4. </template>
  5. <script>
  6. export default {
  7. name: "Docx"
  8. }
  9. </script>
  10. <script setup>
  11. import {ref, watch} from 'vue'
  12. // 引入VueOfficeDocx组件
  13. import VueOfficeDocx from '@vue-office/docx'
  14. // 引入相关样式
  15. import '@vue-office/docx/lib/index.css'
  16. const props = defineProps({
  17. modelValue: {
  18. type: String,
  19. default: () => ""
  20. }
  21. })
  22. const docx = ref(null)
  23. watch(
  24. () => props.modelValue,
  25. value => docx.value = value,
  26. {immediate: true}
  27. )
  28. const rendered = () => {
  29. }
  30. </script>
  31. <style lang="scss" scoped>
  32. </style>