vue-text-highlight-advanced v1.0.0
See working example here.
Installation
npm install --save vue-text-highlight
# or
yarn add vue-text-highlightUsage
Basic Usage
import Vue from 'vue';
import TextHighlight from 'vue-text-highlight';
Vue.component('text-highlight', TextHighlight);
// new Vue ...SomeComponent.vue
<template>
<text-highlight :queries="queries">{{ description }}</text-highlight>
</template>data() {
queries: ['birds', 'scatt'],
description: 'Tropical birds scattered as Drake veered the Jeep'
}Output
More Options
All available props in TextHighlight component are:
queries:Array<String|RegExp>|String|RegExpThis prop accepts string, regex, and array of strings or regex. If array is given, it will highlight the union of matched strings/regex globally.
[caseSensitive]:BooleanWhether string being searched is case sensitive.
[highlightStyle]:Object|Array|StringStyles to be applied to highlighted
<span>. Similar to style bindings in vue, it acceptsArraysyntax,Objectsyntax, or plain styling asString. This prop will then be merged with default highlight styles inTextHighlightcomponent. See style binding in Vue.js.[highlightClass]:Object|Array|StringClasses to be added to highlighted
<span>. Similar to class bindings in vue, it acceptsArraysyntax,Objectsyntax, or class asString. See class binding in Vue.js.
Changelog
Changes are tracked in the changelog.
License
vue-text-highlight is available under the MIT License.
7 years ago