<!--
 * @Author: zhangqian51
 * @Date: 2021-10-18 11:14:42
 * @LastEditTime: 2021-10-25 17:40:22
-->
<template>
    <view class="tx c-inline">
        <view
            v-for="(text, i) in list"
            :key="i"
            selectable
        >
            {{ text }}
        </view>
    </view>
</template>

<script>
/**
 * @file 文本消息
 * @author zhangqian51
 */
export default {
    config: {
        component: true
    },
    props: {
        item: {
            'type': Object,
            'default': {}
        }
    },
    data() {
        return {
            list: []
        };
    },
    lifetimes: {
        attached() {
            // 兼容换行
            const content = this.item.text;
            if (!Array.isArray(this.item.text)) {
                this.list = content.split(/\n/);
            } else {
                this.list = content;
            }
        }
    }
};
</script>

<style lang="less">
</style>
