# @mathewparet/vue-filter-box

> A Vue.Js filter box to initiate search based on filter.

Latest version **1.0.4** (published 2019-01-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install @mathewparet/vue-filter-box
pnpm add @mathewparet/vue-filter-box
yarn add @mathewparet/vue-filter-box
bun add @mathewparet/vue-filter-box
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2019-01-04 |
| First published | 2018-12-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.6 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Mathew Paret |
| Maintainers | mathewparet |

## Links

- npm: https://www.npmjs.com/package/@mathewparet/vue-filter-box
- npm.io page: https://npm.io/package/@mathewparet/vue-filter-box

## Dependencies (1)

- [vue](https://npm.io/package/vue.md) ^2.5.11

## Recent versions

- 1.0.4 (latest) — 2019-01-04
- 1.0.3 — 2018-12-31
- 1.0.2 — 2018-12-20

## README

# @mathewparet/vue-filter-box

> A Vue.Js filter box to initiate search based on filter.

## Installation

``` bash
npm install @mathewparet/vue-filter-box
```

## Global Initialization

``` js
import Vue from 'vue';
import FilterBox from '@mathewparet/vue-filter-box';
Vue.use(FilterBox);
```

## Local Initialization

``` js
import FilterBox from '@mathewparet/vue-filter-box';
export default {
    components: {
        FilterBox,
    }
}
```

## Usage

``` html
<template>
    <div>
        <filter-box class="form-control form-control-sm" @filter="loadData" v-model="searchKey"></filter-box>
    </div>
</template>
<script>
    export default {
        data()
        {
            return {
                searchKey: '', 
                results: [],
            }
        }
        mounted()
        {
            this.loadData();
        }
        methods: {
            loadData(filterString=null)
            {
                // the function argument filterString will also have the filter string. You can use wither that or the v-model.
                
                let filter = this.filterString == null ? '' : this.filterString;

                axios.get(`/api/countries?filter=${filter}`)
                    .then(response => this.results = response.data);
            }
        }
    }
</script>
```

---
_Source: https://npm.io/package/@mathewparet/vue-filter-box · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
