WishMeLz

生活其实很有趣

Vue中可以选择文字高亮的插件

npm install --save vue-text-highlight

import TextHighlight from ‘vue-text-highlight’;
Vue.component(‘text-highlight’, TextHighlight);

<text-highlight :queries="queries">{{ description }}</text-highlight>

data() {
  return {
    queries: ['birds', 'scatt'],//需要高亮的文字
    description: 'Tropical birds scattered as Drake veered the Jeep' 
  };
}

https://blog.csdn.net/zqyzqy22/article/details/101362411