vue2报错 Failed to resolve directive: el

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

之前v-el的写法

  1. <div class="menu-wrapper" v-el="menu-wrapper">
  2. <ul class="menu">
  3. <li v-for="item in goods" class="menu-item">
  4. <span class="text">
  5. <span v-if="item.type>0" class="icon" :class="classMap[item.type]"></span>{{item.name}}
  6. </span>
  7. </li>
  8. </ul>
  9. </div>

这是使用ref的写法

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

  1. <div class="menu-wrapper" ref="menuWrapper">
  2. <ul class="menu">
  3. <li v-for="item in goods" class="menu-item">
  4. <span class="text">
  5. <span v-if="item.type>0" class="icon" :class="classMap[item.type]"></span>{{item.name}}
  6. </span>
  7. </li>
  8. </ul>
  9. </div>

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

  1. 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. VS调试程序快捷键和系统快捷键

    调试程序快捷键 编译程序:F7 运行程序:ctrl + F5 打断点:F9 运行到断点位置:F5 单步执行:F10 单步进入函数:F11 结束调试:shift+F5 注释代码:ctrl+k,ctrl+ ...

  2. 【Atcoder】AGC022 C - Remainder Game 搜索

    [题目]C - Remainder Game [题意]给定n个数字的序列A,每次可以选择一个数字k并选择一些数字对k取模,花费2^k的代价.要求最终变成序列B,求最小代价或无解.n<=50,0& ...

  3. 【CodeForces】576 C. Points on Plane

    [题目]C. Points on Plane [题意]给定坐标系中n个点的坐标(范围[0,10^6]),求一种 [ 连边形成链后总长度<=2.5*10^9 ] 的方案.n<=10^6. [ ...

  4. 一般处理程序、ASP.NET核心知识(5)

    初窥 1.新建一个一般处理程序 新建一个一般处理程序 2.看看里头的代码 public class MyHandler : IHttpHandler { public void ProcessRequ ...

  5. python学习笔记(十四)之字典

    字典:是python中唯一的映射类型,字典中每一项都是由键-值对组成的项.字典中没有索引,只有键和值.键的类型可以是整型,变量或字符串. 创建和访问字典: >>> dict1 = { ...

  6. 51Nod - 1127 最短的包含字符串

    给出一个字符串,求该字符串的一个子串s,s包含A-Z中的全部字母,并且s是所有符合条件的子串中最短的,输出s的长度.如果给出的字符串中并不包括A-Z中的全部字母,则输出No Solution. Inp ...

  7. MSSQL 详解SQL Server连接(内连接、外连接、交叉连接)

    在查询多个表时,我们经常会用“连接查询”.连接是关系数据库模型的主要特点,也是它区别于其它类型数据库管理系统的一个标志. 什么是连接查询呢? 概念:根据两个表或多个表的列之间的关系,从这些表中查询数据 ...

  8. docker之安装和基本使用(一)

    前言 开始折腾docker. 主要概念 容器:独立运行的一个或一组应用,与其他应用完全独立. 镜像:用于创建 Docker容器的模板. 仓库:用于收纳镜像文件,可以理解为代码控制中的代码仓库 注意: ...

  9. Java线上应用故障之CPU占用高排查与定位

    最近线上频繁报警CPU空闲不足,故紧急排查后分享给大家 1.使用top命令,获取占用CPU最高的进程号 2.查看线程号对应的进程信息 命令:ps -ef|grep 22630 3.查看进程对应的线程信 ...

  10. js实现图片上传预览

    <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...