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-lga-filter

v0.1.7

Published

Vue-lga-filter is a dynamic select box based on bootstrap4

Downloads

10

Readme

LgaFilter

Usage

Vue-lga-filter is a dynamic select box based on bootstrap4

Prerequisites

Make sure you have installed all of the following prerequisites on your development machine:

  • Bootstrap

You can install Bootstrap in your Node.js powered apps with the npm package:

npm install bootstrap

Import Bootstrap css in your index.scss

@import 'node_modules/bootstrap/scss/bootstrap';
  • Popper.js
npm install popper.js

From bootstrap website:

Dropdowns are toggleable, contextual overlays for displaying lists of links and more. They’re made interactive with the included Bootstrap dropdown JavaScript plugin. They’re toggled by clicking, not by hovering; this is an intentional design decision.

Dropdowns are built on a third party library, Popper.js, which provides dynamic positioning and viewport detection. Be sure to include popper.min.js before Bootstrap’s JavaScript or use bootstrap.bundle.min.js / bootstrap.bundle.js which contains Popper.js. Popper.js isn’t used to position dropdowns in navbars though as dynamic positioning isn’t required.

If you’re building our JavaScript from source, it requires util.js.

https://getbootstrap.com/docs/4.5/components/dropdowns/

Installation

Install via NPM...

npm install vue-lga-filter --save

...and require the component like so:

import VueLgaFilter from 'vue-lga-filter'
Vue.use(VueLgaFilter)

...and import css:

@import 'node_modules/vue-lga-filter/dist/vue-lga-filter';

Usage

Simply set an id and an array as describe under and you're good to go. At least two arguments are expected.

<template>
 <FilterCustom
      :filters="filters"   
      :idUniq="'idExample'"
      :title="'defaultTitle'"
      v-on:sendToParent="onChildClick">
 </FilterCustom>
</template>
<script>
export default {
  name: "AppExample",
  components: {},
  data() {
    return {
      selectedSort: { label: "Popular", value: "nbLike" },
      filters: [
        { label: "Popular", value: "nbLike" },
        { label: "Latest", value: "dateCreate" },
        { label: "Alphabetical", value: "name" },
      ],
    };
  },
  methods: {
    onChildClick(value) {
      this.selectedSort = value;
    },
  },
};
</script>

Passing Your Data

Required params

When you use this component, you have to pass two params: an array and an uniq id.

filters: Array

This array filters will be display the values on the selectbox. You have to create an array with two values label and value.

You have to define your own values of label and their values.

var filters = [
        { label: "Popular", value: "nbLike" },
        { label: "Latest", value: "dateCreate" },
        { label: "Alphabetical", value: "name" },
        { label: "My_own_label", value: "my_own_value" },
      ];

idUniq: String

You have to define an uniq id to identify the component.

Optional params

title: String

You can choose to display a title above the selectbox.

When you choose to display a title, an new label Clear is displayed next the title. This new label Clear unselects the current label and places the current label to the first item of filters array.

Get Your Selected Data

You can retrieve the selected data via the selectbox thanks to sendToParent method .

<template>
 <FilterCustom
      :filters="filters"   
      :idUniq="'idExample'"
      :title="'defaultTitle'"
      v-on:sendToParent="onChildClick">
 </FilterCustom>
</template>
<script>
export default {
  name: "AppExample",
  components: {},
  data() {
    return {
      selectedSort: { label: "Popular", value: "nbLike" },
      filters: [
        { label: "Popular", value: "nbLike" },
        { label: "Latest", value: "dateCreate" },
        { label: "Alphabetical", value: "name" },
      ],
    };
  },
  methods: {
    onChildClick(value) {
      this.selectedSort = value;
    },
  },
};
</script>

License

MIT