<template>
    <div
        v-if="comName"
        :is="comName"
        v-bind="$props"
        v-on="$listeners">
        <!-- :nameText="nameText"
        :row="row" -->
        <slot></slot>
    </div>
</template>

<script>
import TextTmp from './_comm/TextTmp';
import NuTextt from './textt';
import NuTextl from './textl';
import NuTextc from './textc';

export default {
    extends: TextTmp,
    name: 'NuText',
    props: {
        /**
         * 展示的类型（textt,textl,textc）
         */
        type: {
            type: String,
            default: 'textc'
        },
        /**
         * 行数
         */
        row: {
            type: Number,
            default: 2
        }
    },
    components: {
        NuTextt,
        NuTextl,
        NuTextc
    },
    computed: {
        comName() { // 获取组件名
            let res = '';
            switch (this.type) {
                case 'textl':
                    res = 'nu-textl';
                    break;
                case 'textt':
                    res = 'nu-textt';
                    break;
                case 'textc':
                default:
                    res = 'nu-textc';
                    break;
            }
            return res;
        }
    }
};
</script>
