转自:https://stackoverflow.com/questions/35835214/vue-js-failed-to-resolve-filter-key

I am following this tutorial https://laracasts.com/series/search-as-a-service/episodes/2 and got stuck on the following error

[Vue warn]: Invalid expression. Generated function body:  scope.keyup:scope.search
[Vue warn]: Failed to resolve filter: key

shown in console.

This is the 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 I missing something? or is the tutorial outdated?

asked Mar 7 '16 at 2:23
Mike

242215
1
 
v-on="keyup: search | key 'enter'"

is a old version declaration, change to this:

v-on:keyup.enter="search"

http://vuejs.org/guide/events.html#Key_Modifiers

Vue.js Failed to resolve filter: key的更多相关文章

  1. vue 过滤器filters的使用以及常见报错小坑(Failed to resolve filter)

    今天使用vue 过滤器中发现一个小坑,网上查到的大都是不正确的解决方法,故分享给大家: 原错误代码: // 过滤器 filter:{ FdishList:function(value){ if (!v ...

  2. Vue.js报错Failed to resolve filter问题原因

    Vue.js报错Failed to resolve filter问题原因 金刚 vue Vue.js js javascript 之前使用vue.js写分页功能时,写了一个过滤器,发现一个比较奇怪的错 ...

  3. Failed to resolve filter报错原因

    问题 页面写过滤器,控制台报错,Failed to resolve filter 分析 语法错误?先检查 ``` {{ params | filterA }} filters: { filterA: ...

  4. electron-vue [Vue warn]: Failed to resolve directive: decorator

    electron-vue引入ant-desigin-vue使用ant自定义指令 v-decorator报销 <a-form-item> <a-input v-decorator=&q ...

  5. 解决IE报错[vue router]Failed to resolve async component default:strict 模式下不允许分配到只读属性

    之前遇到过一个奇怪的问题,在其他浏览器下一切正常,但在万恶的IE下,却一直不行. 具体问题场景就是:比如orderDetail页面出现问题,那么只要是路由跳转的,点第1次无法跳转,必须得点第2次才可以 ...

  6. 简单易懂的 Vue.js 基础知识 !

    根 vue 实例 let viewModel = new Vue({ // 包含数据.模板.挂载元素.方法.生命周期钩子等选项 }) Hello Wrold  <!-- 这是我们的 View - ...

  7. Vue自定义指令报错:Failed to resolve directive: xxx

    Vue自定义指令报错 Failed to resolve directive: modle 这个报错有2个原因: 1.指令单词拼错 2.Vue.directive() 这个方法没有写在 new Vue ...

  8. Vue.js 的几点总结Watchers/router key/render

    Vue.js 的几点总结,下面就是实战案例,一起来看一下. 第一招:化繁为简的Watchers 场景还原: 1 2 3 4 5 6 7 8 created(){   this.fetchPostLis ...

  9. Vue.js(2.x)之列表渲染(v-for/key)

    1.v-for是Vue里的循环语句,与其他语言的循环大同小异.首先得有需要循环且不为空的数组,循环的关键字为in或of. 需要索引时的写法: v-for里的in可以使用of代替: 还可以使用v-for ...

随机推荐

  1. hive中的表

    一.内部表与外部表的比较 Hive表概念和关系型数据库表概念差不多.在Hive里表会和HDFS的一个目录相对应,这个目录会存放表的数据.目录默认是/usr/hive/warehouse/. 比如你在h ...

  2. 弹性势能,position,min用法,获取元素的宽

    弹性势能: 网页div移动的mousemove的次数,跟div移动的距离没有关系,跟鼠标移动的快慢有关,浏览器自身有个计数事件,几毫秒 _this.seed*=0.95 //摩擦系数的写法 posit ...

  3. WireGuard协议介绍

    原文: https://www.jianshu.com/p/32c3e62c2711

  4. 头皮溢脂性皮炎推荐联合治疗:采乐50ml+希尔生100g(请看详情页)维生素B2维生素B6

    治疗头皮脂溢性皮炎采乐50ml+希尔生100g联合用药用法:用药先用一般香皂清洗头发及头皮,头皮处于湿润状态,取适量希尔生洗剂涂于头皮表面,充分揉搓出泡沫样5 min后用清水冲净抹干,再将适量采乐洗剂 ...

  5. [UE4]把枪打飞addImpulse

    一.武器如果没有开启模拟物理,会漂浮在空中 二.武器开启模拟物理,运行游戏的时候就会掉到地上了.之所以要加“Delay”延迟,是因为创建武器在先(没有持有人),持有武器动作在后,加上“delay”延迟 ...

  6. [UE4]蓝图函数库

    在任何蓝图上都可以调用“蓝图函数库”的方法

  7. 高可用hadoop的hdfs启动的时候namenode启动不了

    启动的时候,一直要求输入namenode密码: 查看namenode的日志如下: 2019-03-28 18:38:08,961 INFO org.apache.hadoop.ipc.Client: ...

  8. MySQL 之 MyTop实时监控MySQL

    CentOS下使用MyTop实时监控MySQL MyTop的项目页面为:http://jeremy.zawodny.com/mysql/mytop/ MyTop安装 安装依赖包  yum instal ...

  9. [SQL]用SQL语句断开某个数据库的所有活动连接

    USE master go IF EXISTS ( SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[P_KillConnectio ...

  10. 第15课 右值引用(2)_std::move和移动语义

    1. std::move (1)std::move的原型 template<typename T> typename remove_reference<T>::type& ...