javascript - Vue.js Failed to resolve filter: key -
i following tutorial https://laracasts.com/series/search-as-a-service/episodes/2 , got stuck on following error
[vue warn]: invalid expression. generated function body: scope.keyup:scope.search [vue warn]: failed resolve filter: key
shown in console.
this code.
<input type="text" v-model="query" v-on="keyup: search | key 'enter'"> <div class="results"> <article v-for="movie in movies"> <h2> @{{ movie.name }}</h2> <h4> @{{ movie.rating }}</h4> </article> </div> </div> <script src="http://cdn.jsdelivr.net/algoliasearch/3/algoliasearch.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.17/vue.js"></script> <script> new vue ({ el: 'body', data: { query: '' , movies: [] }, ready: function (){ this.client = algoliasearch('ah9xu5726u', '58fd00912ce725b3f627cfa6cb8292ee'); this.index = this.client.initindex('getstarted_actors'); }, methods: { search: function () { this.index.search(this.query, function(error, results){ this.movies = results.hits; }.bind(this)); } } }); </script>
am missing something? or tutorial outdated?
v-on="keyup: search | key 'enter'"
is old version declaration, change this:
v-on:keyup.enter="search"
Comments
Post a Comment