txtViewer.vue 783 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <template>
  2. <div class="vue-office-txt">
  3. <div class="txt-wrapper">{{ textValue }}</div>
  4. </div>
  5. </template>
  6. <script>
  7. export default {
  8. props: {
  9. src: { type: String, default: "" }
  10. },
  11. data() {
  12. return {
  13. textValue: null
  14. }
  15. },
  16. mounted() {
  17. this.txtDecode();
  18. },
  19. methods: {
  20. txtDecode() {
  21. this.$API.common.minio.download(this.src, true).then(res => {
  22. this.textValue = res;
  23. this.$emit("rendered");
  24. }).catch(() => this.$emit("error"));
  25. }
  26. }
  27. }
  28. </script>
  29. <style lang="scss" scoped>
  30. .vue-office-txt {background: gray;padding: 0 20px 16px;}
  31. .vue-office-txt .txt-wrapper {padding: 30px;background: #fff;white-space: pre-wrap;}
  32. </style>