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. 「七天自制PHP框架」应用:JSON生成器

    刚刚开始学做一个WebAPP,数据查询的一般套路是通过一张PHP页面读取数据库,获得列表后“嵌写”在PHP页面中,虽然写法上丑陋至极,但也有“快糙猛”出效果的成就感,如图. 后来想想,不对啊,难道以后 ...

  2. Jeson老师写的nginx切割脚本

    #Jeson #Email:jeson@iaskjob.com #变量定义:access.error日志文件列表 NGINX_LOG=(imoocc_com_access iaskjob_com er ...

  3. 分享一个数据库sql_mode 引起的坑

    sql_mode坑 MySQL 5.7.x 默认值: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR ...

  4. CSS浏览器兼容问题集-第三部分

    FF与IE 1. Div居中问题 div设置 margin-left, margin-right 为 auto 时已经居中,IE 不行,IE需要设定body居中,首先在父级元素定义text-algin ...

  5. opencv 高级拼接函数Stitcher

    Stitcher https://docs.opencv.org/trunk/d8/d19/tutorial_stitcher.html http://blog.csdn.net/czl389/art ...

  6. 在Java中,你真的会日期转换吗

    1.什么是SimpleDateFormat 在java doc对SimpleDateFormat的解释如下: SimpleDateFormat is a concrete class for form ...

  7. 微信小程序导航设置

    "tabBar": { "backgroundColor": "#ffffff", "color": "#00 ...

  8. 爬虫--Scrapy框架的基本使用

    流程框架 安装Scrapy: (1)在pycharm里直接就可以进行安装Scrapy      (2)若在conda里安装scrapy,需要进入cmd里输入指令conda install scrapy ...

  9. Google Gapps – Download Gapps for Android【转】

    http://wiki.rootzwiki.com/Google_Apps http://productforums.google.com/forum/#!forum/apps http://www. ...

  10. u-boot启动第一阶段

    目标板:2440开发板 u-boot启动的第一阶段是在文件start.S中完成的,这个过程对不同硬件平台的设置是不同的.下面进入start.S _start: b reset //跳转到reset / ...