<template>
    <el-tooltip :open-delay="300" class="item" effect="dark" :content="text" :disabled="!text || text.length < (num + 1)" placement="top">
      <span>{{showString}}</span>
    </el-tooltip>
</template>
<script>
export default {
    name: 'AegleEllipsis',
    props: {
        num: {
            type: Number,
            default: 8
        },
        text: String
    },
    computed: {
        showString() {
            if(!this.text) return '';
            if(this.text.length > this.num) {
                return this.text.substring(0,this.num) + '...'
            }
            return this.text
        }
    }
}
</script>