N
N
Nikita Kudinov2017-03-08 14:14:36
Laravel
Nikita Kudinov, 2017-03-08 14:14:36

How to fix display with filterBy, Laravel and Vue.js?

There is this code

<div id="app">
<input type="text" v-model="input">
<ul>
  <li v-for="item in array">@{{ item.name }}</li>
</ul>
</div>

and like this
new Vue({
            el: '#app',
            data: {
                input: '',
                array: [
                {
                    name: 'Agel',
                    ag: 23
                },
                {
                    name: 'Mark',
                    ag: 26
                }
                ]
            }
        });

and when I add the line " | filterBy 'name'" to the v-for so that it turns out
<li v-for="item in array | filterBy 'name'">@{{ item.name }}</li>

He completely refuses to display the entire<div id="app"></div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yeldos Adetbekov, 2017-03-08
@dosya97

What version of vue are you using? If 2.0+, then vue.js refused to include native filters in the code (Probably due to a vulnerability or file weight). And instead, they suggest using third-party functions (libraries). https://lodash.com/docs/4.17.4#filter . It's a pity that they were removed, but you can write them yourself, make a custom filter, but here again, you need to use the filter as a function, that is, pass it as attributes in parentheses . Read about filters in the docks.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question