petritr
164
3
Vue

Re-use the same search components multiple times

Posted 6 months ago by petritr

How can i re-use the same search component multiple times with the same data.

I have an search like:

<input class="search" type="search" name="search[]" v-model="search"  placeholder="Search Article">

        computed: {
            filteredCustomer() {
                return this.customers.filter((customer) => {
                    return `${customer.id} ${customer.description}`.toLowerCase().includes(this.search.toLowerCase());
                });
            }
        },

I need to use the <input> multiple times in the same component/page, but i need each search to work separately. Each input search should work alone and display results when its used.

Best and smart way to do this ?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.