the following is demo
<script>
export default {
props: ["userList", "sessionIndex", "session", "search"],
filters: {
selection (list, sear) {
return list.filter(item => item.name.indexOf(sear) > -1)
}
}
}
</script>
<template>
<div class="m-list">
<ul>
<li v-for="item in userList | selection(search)" :class="{ active: session.userId === item.id }">
<img class="avatar" width="30" height="30" :alt="item.name" :src="item.img">
<p class="name">{{item.name}}
</li>
</ul>
</div>
</template>
console error message is as follows
Vue warn: Property or method "selection" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.
Error in render: "TypeError: _vm.selection is not a function"
TypeError: _vm.selection is not a function