Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
typescript + vue
import { ListItem } from '@/types/index';
import { Component, Vue } from 'vue-property-decorator';
import LIST from '../data/mockData.json';
import SearchItem from './SearchItem.vue';
import SearchForm from './SearchForm.vue';
// setting child components
name: 'Search',
components: {
// class member variables and methods
export default class Search extends Vue {
public list: ListItem[] = LIST;
public results: ListItem[] = [];
private mounted() {
this.results = this.list;
private onSeachTextChanged(val: string) {
this.results = this.list.filter((i: ListItem) => {
return i.title.toLowerCase().includes(val.toLowerCase());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.