VueJS Custom Filters Example

In this Post We Will Explain About is VueJS Custom Filters Example 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 Building Custom VueJS Filters Example

In this post we will show you Best way to implement Custom Filters with Arguments in VueJs, hear for Simple Uppercase Filter Example in VueJs with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Vue – Simple Limit Custom Filter

In this Example,First of all Add or Inluce External Libs Like as a(jQuery, css etc..), and then create a simple index.php or index.html page.After that crate a simple javascript file like as a index.js or main.js, It is also add your web-application First Header Part to some priorty set.After that Include your relavant CSS Class.

READ :  VueJS Directory Application Structure Example

VueJS Filter Example with Syntax

    liveFilter() {
      return this.livepostdataList.filter(livepostdata => {
        return livepostdata.title.toLowerCase().includes(this.livesearch.toLowerCase())
      })
    }

index.html

<div id="liveApp">
  <div class="livesearch-livewp">
    
        <label>Search title:</label>
  </div>
  <div class="livewp">
    <div class="card">
      <a target="_blank">
        <img />
        <small>livepostdataed by: {{ livepostdata.descauth }}</small>
        {{ livepostdata.title }}
      </a>
    </div>
  </div>
</div>

index.js

class Post {
  constructor(title, url, descauth, img) {
    this.title = title;
    this.url = url;
    this.descauth = descauth;
    this.img = img;
  }
}

const liveApp = new Vue ({
  el: '#liveApp',
  data: {
    livesearch: '',
    livepostdataList : [
      new Post(
        'Vue.js', 
        'https://infinityknow.com/tools/live-editor.html', 
        'Jaydeep', 
        'https://vuejs.org//images/logo.png'
      ),
      new Post(
        'React.js', 
        'https://infinityknow.com/defination/', 
        'DSP',
        'https://daynin.github.io/clojurescript-presentation/img/react-logo.png'
      ),
      new Post(
        'Angular.js', 
        'https://infinityknow.com/free-proxy/', 
        'Krunal', 
        'https://angularjs.org/img/ng-logo.png'
      ),
      new Post(
        'Ember.js', 
        'https://infinityknow.com/', 
        'Ankit',
        'http://www.gravatar.com/avatar/0cf15665a9146ba852bf042b0652780a?s=200'
      ),
      new Post(
        'Meteor.js', 
        'https://infinityknow.com/tutorials', 
        'Chirag', 
        'http://hacktivist.in/introduction-to-nodejs-mongodb-meteor/img/meteor.png'
      ),
      new Post(
        'Rakesh', 
        'https://infinityknow.com/status', 
        'Tim',
        'https://cdn.auth0.com/blog/aurelia-logo.png'
      ),
      new Post(
        'Node.js', 
        'https://infinityknow.com/w3free', 
        'angular king',
        'https://code-maven.com/img/node.png'
      ),
      new Post(
        'Pusher', 
        'https://infinityknow.com/', 
        'PHP king', 
        'https://infinityknow.com/u/739550?v=3&s=400'
      ),
      new Post(
        'Feathers.js', 
        'http://feathersjs.com/', 
        'Gediya Mayur',
        'https://cdn.infinityknow.com/logos/feathersjs.svg'
      ),
]
  },
  computed: {
    liveFilter() {
      return this.livepostdataList.filter(livepostdata => {
        return livepostdata.title.toLowerCase().includes(this.livesearch.toLowerCase())
      })
    }
  }
})

style.css

div#liveApp {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  
  .livesearch-livewp {
    position: relative;
    label {
      position: absolute;
      font-size: 13px;
      color: rgba(0,0,0,.50);
      top: 8px;
      left: 13px;
      z-index: -1;
      transition: .15s all ease-in-out;
    }
    input {
      padding: 3px 13px;
      color: rgba(0,0,0,.70);
      border: 1px solid rgba(0,0,0,.12);
      transition: .15s all ease-in-out;
      background: white;
      &:focus {
        outline: none;
        transform: scale(1.05);
        & + label  {
          font-size: 10px;
          transform: translateY(-23px) translateX(-13px);
        }
      }
      &::-webkit-input-placeholder {
          font-size: 13px;
          color: rgba(0,0,0,.50);
          font-weight: 100;
      }
    }
  }

  .livewp {
    display: flex;
    max-width: 443px;
    flex-wrap: wrap;
    padding-top: 13px;
  }

  .card {
    box-shadow: rgba(0, 0, 0, 0.117647) 0px 1px 6px, rgba(0, 0, 0, 0.117647) 0px 1px 3px;
    max-width: 123px;
    margin: 13px;
    transition: .15s all ease-in-out;
    &:hover {
      transform: scale(1.1);
    }
    a {
      text-decoration: none;
      padding: 13px;
      color: #03A9F4;
      font-size: 23px;
      display: flex;
      flex-direction: column;
      align-items: center;
      img {
        height: 100px;
      }
      small {
        font-size: 10px;
        padding: 3px;
      }
    }
  }

  .hotpink {
    background: hotpink;
  }

  .green {
    background: green;
  }

  .box {
    width: 100px;
    height: 100px;
    border: 1px solid rgba(0,0,0,.12);
  }
}

You are Most welcome in my youtube Channel Please shubscibe my channel. and give me FeedBackMore Details……
Angularjs Example

READ :  VueJs Filters and custom filter in Vuejs Example

Example

I hope you have Got What is Simple Uppercase Filter Example in VueJs And how it works.I would Like to have FeedBack From My Blog(infinityknow.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(infinityknow.com) Are Most Always Welcome.