Vuejs Custom Filters Dependent MultiSelect

Vuejs Custom Filters Dependent MultiSelect

Vuejs Custom Filters Dependent MultiSelect

In this Post We Will Explain About is Vuejs Custom Filters Dependent MultiSelect With Example and Demo.Welcome on infinityknow.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to vuejs – How to Create a Custom Filter – CodeExample

In this post we will show you Best way to implement filter in vuejs example, hear for vuejs custom filter ng-repeatwith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

index.html

  home_product
  officeproduct


  blue
  yellow

{{ catlist }}
<ul>
  <li>
    {{ product.name | capitalize }} - {{ product.price | currency }}
  </li>
</ul>

index.js

E-junkie: Sell digital downloads online

E-junkie Provides a Copy-paste buy-now, and cart buttons for selling downloads, codes and tangible products on any website, blog, social media, email and messenger!

Also see:

  1. The Top 10+ Best Webinar Software Platforms For 2020-2021
  2. Build Your Future Godaddy Careers And Jobs
  3. Introduction To Web Hosting Services

 Vue.filter('products', function (value, catlist) {
        var result = [];

        if(!catlist){
            return value;
        }

        catlist = catlist
				console.log(catlist);
        result = value.filter(function(product){
            if(catlist.indexOf(product.products) > -1){
                return product;
            }
        })
        return result;
 })
 
  Vue.filter('colorsearch', function (value, color) {
        var result = [];

        if(!color){
            return value;
        }

        color = color;
        console.log(color)
        result = value.filter(function(product){
            if(color.indexOf(product.color) > -1){
                return product;
            }
        })
        return result;
 })

new Vue({
	el: 'body',
  data: {
    catlist: '',
    color: '',
  	products: [
      {name: 'microphone', price: 25, products: 'home_product',  color: 'yellow'},
      {name: 'LED case', price: 15, products: 'officeproduct', color: 'blue'},
      {name: 'screen cleaner', price: 17, products: 'officeproduct',color: 'yellow'},
      {name: 'LED charger', price: 70, products: 'home_product',color: 'blue'},
      {name: 'mouse', price: 40, products: 'home_product'},
      {name: 'earphones', price: 20, products: 'home_product'},
      {name: 'Computer', price: 120, products: 'home_product'}
    ],
  },
  methods: {
  	 log: function () {
     	console.log(this.products.slice("home_product"));
     },
  }
});

Example

READ :  Restful insert update edit delete using Angularjs and PHP

I hope you have Got What is vuejs – How to Create a Custom Filter – Code Example And how it works.I would Like to have FeadBack From My Blog(infinityknow.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(infinityknow.com) Are Most Always Welcome.