npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-words-highlight

v1.1.2

Published

Highlight words for Vue.js

Downloads

29

Readme

Vue Words Highlight

NPM version NPM downloads

用于高亮关键词的vue组件,可以用于类似于搜索的功能。

Installation

    npm install --save vue-words-highlight
    # or
    yarn add vue-words-highlight

Usage

Use Directive

    import { highlight } from 'vue-words-highlight';
    Vue.use(highlight, {
        name: 'highlight',
        className: 'red',
        style: 'color: #0f0',
        caseSensitive: false
    });

    // new Vue...

Use Component

    import Hightlight from 'vue-words-highlight';
    Vue.component('hight-light', Hightlight);

Component.vue

    <template>
        <!-- Component -->
        <high-light :highlight="{keyword: 'word'}">Hello, word.</high-light>
        <!-- Directive -->
        <div v-highlight="{keyword: 'hello', separator: ' '}">Hello, word.</div>
    </template>

More Options

所有参数都可以在Vue.use(highlight, {...options})中进行定义,也可以在v-highlight="{...override}"中进行定义或覆盖,使用组件的形式时,参数将以对象的形式通过highlight进行传递

  • name: String

默认值:highlight。只在Vue.use(highlight, {name: 'highlight'})时使用,用于定义Directive的name.

  • keyword: Array<String>|String|Number

用于高亮的关键词。当传入的是字符串或数字时,将格式化成字符串,并将使用 **separator**分隔成数组。

  • separator String

当且仅当 **keyword**为字符串时有效;传入为空时,默认全值匹配。默认值:

  • caseSensitive Boolean

大小写是否敏感。默认值:false

  • className String|Array<String|Object>|Object

高亮的类名。

  • style String|Object

高亮的样式。