小编Mak*_*ten的帖子

Vue js文本高亮显示过滤器

我需要帮助使用vuejs编写文本高亮显示过滤器.我们的想法是遍历给定的单词数组,如果匹配,则将带有类的span应用于该单词.我遇到的问题是,我似乎无法使用vuejs返回带有html格式的数据.任何想法将受到高度赞赏.我真的很困惑.

Vue.filter('highlight', function(words, query){
    //loop through **words** and if there is a match in **query**
   //apply a <span> with some style
   //At the end return formatted string to html page
})
Run Code Online (Sandbox Code Playgroud)

javascript formatting text vue.js

10
推荐指数
4
解决办法
9315
查看次数

标签 统计

formatting ×1

javascript ×1

text ×1

vue.js ×1