<template>
    <div class="vue-office-txt">
        <div class="txt-wrapper">{{ textValue }}</div>
    </div>
</template>

<script>
export default {
    props: {
        src: { type: String, default: "" }
    },

    data() {
        return {
            textValue: null
        }
    },

    mounted() {
        this.txtDecode();
    },

    methods: {
        txtDecode() {
            this.$API.common.minio.download(this.src, true).then(res => {
                this.textValue = res;
                this.$emit("rendered");
            }).catch(() => this.$emit("error"));
        }
    }
}
</script>

<style lang="scss" scoped>
.vue-office-txt {background: gray;padding: 0 20px 16px;}
.vue-office-txt .txt-wrapper {padding: 30px;background: #fff;white-space: pre-wrap;}
</style>