Vue v-html标签使用过滤器

前端需要展示HTML格式内容,还要使用过滤器,限制内容展示长度

1.创建过滤器。

filters: {

  ellipsis (value, num) {

    // code there... 

  }

}

2.使用过滤器

<h2 v-html="$options.filters.ellipsis(content, 30)">

posted @ 2022-04-24 14:33  Miracle丶MoRanT  阅读(501)  评论(0编辑  收藏  举报