TextEllipsis 超出文本省略

当问题太多时可以只展示部分,后面省略显示

基本调用

《华盛顿自由灯塔报》几天前报道称,美国国防部官员透露中国近日进行第十次东风-41洲际导弹的试射活动,这次试射中东风-41导弹投射了多个弹头并成功命中中国西部靶场目标。...
<template>
  <avue-text-ellipsis :text="text"
                      :height="50"
                      :width="200">
    <template #more>
      <small>...</small>
    </template>
  </avue-text-ellipsis>
</template>
<script>
export default {
  data () {
    return {
      text: "《华盛顿自由灯塔报》几天前报道称,美国国防部官员透露中国近日进行第十次东风-41洲际导弹的试射活动,这次试射中东风-41导弹投射了多个弹头并成功命中中国西部靶场目标。"
    }
  }
}
</script>
显示代码

自定义前缀后缀

new《华盛顿自由灯塔报》几天前报道称,美国国防部官员透露中国近日进行第十次东风-41洲际导弹的试射活动,这次试射中东风-41导弹投射了多个弹头并成功命中中国西部靶场目标。...[09/14]
<template>
  <avue-text-ellipsis :text="text"
                      :height="100"
                      :width="200">
    <template #more>
      <small>...</small>
    </template>
    <template #before>
      <el-tag>new</el-tag>
    </template>
    <template #after>
      <small>[09/14]</small>
    </template>
  </avue-text-ellipsis>
</template>
<script>
export default {
  data () {
    return {
      text: "《华盛顿自由灯塔报》几天前报道称,美国国防部官员透露中国近日进行第十次东风-41洲际导弹的试射活动,这次试射中东风-41导弹投射了多个弹头并成功命中中国西部靶场目标。"
    }
  }
}
</script>
显示代码

当被隐藏文字的时候,使用tooltip提示

《华盛顿自由灯塔报》几天前报道称,美国国防部官员透露中国近日进行第十次东风-41洲际导弹的试射活动,这次试射中东风-41导弹投射了多个弹头并成功命中中国西部靶场目标。...
<template>
  <avue-text-ellipsis :key="text"
                      :text="text"
                      :height="40"
                      :width="200"
                      use-tooltip
                      placement="top">
    <template #more>
      <small>...</small>
    </template>
  </avue-text-ellipsis>
</template>
<script>
export default {
  data () {
    return {
      text: "《华盛顿自由灯塔报》几天前报道称,美国国防部官员透露中国近日进行第十次东风-41洲际导弹的试射活动,这次试射中东风-41导弹投射了多个弹头并成功命中中国西部靶场目标。"
    }
  },
  methods: {
    show () {
      this.$message.success('show');
    },
    hide () {
      this.$message.success('hide')
    }
  }
}
</script>
显示代码

Variables

参数说明类型可选值默认值
text需要省略的文本String--
width限制的宽Number--
height限制的高Number--
is-limit-height是否开启限制Boolean-true
use-tooltip是否使用tooltipBoolean-false
placementtooltip的placementString-

Events

事件名说明参数
show当isLimitHeight为true,文本全部展示的时候-
hide当isLimitHeight为true,文本省略的时候-
Last Updated:
Contributors: smallwei
您正在浏览基于Avue 3.x文档; 点击这里 查看Avue 2.x 的文档