vue2报错 Failed to resolve directive: el

为什么会报这个错呢,主要还是因为vue升级的时候,v-el在vue2.x以后被淘汰。使用新的标签ref替换v-el,接下来告诉大家怎么使用。

之前v-el的写法

 <div class="menu-wrapper" v-el="menu-wrapper">
<ul class="menu">
<li v-for="item in goods" class="menu-item">
<span class="text">
<span v-if="item.type>0" class="icon" :class="classMap[item.type]"></span>{{item.name}}
</span>
</li>
</ul>
</div>

这是使用ref的写法

*请注意:menuWrapper不能使用menu-wrapper这种写法了

 <div class="menu-wrapper" ref="menuWrapper">
<ul class="menu">
<li v-for="item in goods" class="menu-item">
<span class="text">
<span v-if="item.type>0" class="icon" :class="classMap[item.type]"></span>{{item.name}}
</span>
</li>
</ul>
</div>

 对应的这里通过js获取dom元素的时候,写法也发生变化

 this.menuScroll = new BScroll(this.$refs.menuWrapper, {})

Failed to resolve directive: el vue2报错的更多相关文章

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

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

  2. EL表达式报错:  According to TLD or attribute directive in tag file, attribute value does not accept any expressions

    EL表达式报错: According to TLD or attribute directive in tag file, attribute value does not accept any ex ...

  3. Anaconda Error opening file for writing , failed to create anacoda menu等报错问题解决方案

    安装anaconda的时候可能会遇到这个报错, 原因可能是:路径不允许有空格 此外发生报错failed to create anacoda menu, 解决方案 进入 cmd,找到你安装的位置(我的是 ...

  4. flink clickhouse-jdbc和flink-connector 写入数据到clickhouse因为jar包冲突导致的60 seconds.Please check if the requested resources are available in the YARN cluster和Could not resolve ResourceManager address akka报错血案

    一.问题现象,使用flink on yarn 模式,写入数据到clickhouse,但是在yarn 集群充足的情况下一直报:Deployment took more than 60 seconds. ...

  5. error: Failed dependencies: rpm安装包失败报错依赖包

    error: Failed dependencies: mysql-community-release conflicts with (installed) mysql57-community-rel ...

  6. 完美解决cannot resolve symbol servlet 的报错

    1.右键点击项目,打开open module settings 2.选择Libraries 3.选择中间+号,点击java,然后选择tomcat/lib/servlet-api.jar 4.点击app ...

  7. ssm项目导入activiti依赖后jsp页面el表达式报错

    错误原因:Tomcat8.x与activiti6.0依赖冲突导致 解决方法: 1.修改tomcat版本 2.在pom.xml中修改 在依赖中把 <dependency> <group ...

  8. 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 ...

  9. failed to create process ,pip报错问题

随机推荐

  1. ZOJ 3777 B - Problem Arrangement 状压DP

    LINK:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3777 题意:有N(\( N <= 12 \))道题,排顺序 ...

  2. sql 流水号获取

    经常用到产生订单号等流水单号的场景,sqlserver实现流水号,如下: 表tb_b_Seq(流水号表): CREATE TABLE tb_b_Seq( Year int ,--年份 Month in ...

  3. mongoDB与sql聚合操作对应图

    SQL Terms, Functions, and Concepts MongoDB Aggregation Operators WHERE $match GROUP BY $group HAVING ...

  4. Jenkins 通过ssh 拷贝文件到远程机器上。

    想实现的目的是: 在构建之前,从jenkins master上拷贝脚本到需要运行的机器上(linux ssh). 本来是通过publish over ssh 的transfer set可以直接设置,但 ...

  5. 【leetcode 简单】第九题 移除元素

    给定一个数组 nums 和一个值 val,你需要原地移除所有数值等于 val 的元素,返回移除后数组的新长度. 不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成 ...

  6. js常见易错点

    原文:http://www.jianshu.com/p/1c77853d4f01 前言 本文是我学习JavaScript过程中收集与整理的一些易错知识点,将分别从变量作用域,类型比较,this指向,函 ...

  7. 机器学习-kNN-寻找最好的超参数

    一 .超参数和模型参数 超参数:在算法运行前需要决定的参数 模型参数:算法运行过程中学习的参数 - kNN算法没有模型参数- kNN算法中的k是典型的超参数 寻找好的超参数 领域知识 经验数值 实验搜 ...

  8. 关于angularJS的一些用法

    AngularJS 事件指令: ng-click/dblclick ng-mousedown/up ng-mouseenter/leave ng-mousemove/over/out ng-keydo ...

  9. Hive ORC表的使用

    创建普通临时表: create table if not exists test_orc_tmp(   name string,   gender string,   cnt BIGINT )row ...

  10. PyCharm 自定义文件和代码模板

    PyCharm提供了文件和代码模板功能,可以利用此模板来快捷新建代码或文件.比如在PyCharm中新建一个html文件,新的文件并不是空的,而是会自动填充了一些基础的必备的内容,就像这样: <! ...