Created
February 24, 2019 22:43
-
-
Save rdumi7ru/a8dfccc5bdb74c0c6d713016b17c5b58 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="container"> | |
<div class="row"> | |
<form class="form-inline mt-3 pl-3"> | |
<input class="form-control" type="text" placeholder="Search Game" aria-label="Search" v-model="search"> | |
</form> | |
</div> | |
<div class="row"> | |
<div class="col-md-4 col-lg-3 d-flex align-items-stretch" v-for="data in filtred" :key="data.id"> | |
<div class="card mt-3"> | |
<div class="card-body"> | |
<h5 class="card-title">{{data.name}}</h5> | |
<h6 class="card-subtitle mb-2 text-muted">Author: {{data.vendor}}</h6> | |
<p class="card-text"> | |
{{data.description}} | |
</p> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</template> | |
<script> | |
import json from '../json/games.json'; | |
export default { | |
props:['myJson'], | |
data:function(){ | |
return{ | |
search:'' | |
} | |
}, | |
computed:{ | |
filtred: function(){ | |
return this.myJson.filter((data) =>{ | |
return data.name.match(this.search) | |
}); | |
} | |
// filtred: function(){ | |
// var self = this; | |
// return this.myJson.filter( | |
// function(value){ | |
// var lc = value.toLowerCase(); | |
// var lci = self.search.toLowerCase(); | |
// return (lc.indexOf(lci) !== -1); | |
} | |
// ) | |
// } | |
// }, | |
} | |
</script> | |
<style> | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment