我需要帮助使用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)