栏目分类:
子分类:
返回
文库吧用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
文库吧 > IT > 软件开发 > Web开发 > Vue.js

vue2.0与1.0的改变对比总结

Vue.js 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

vue2.0与1.0的改变对比总结

标签(空格分隔): vue2.0
  • 在绑定原生HTML时,弃用了原来的{{{message}}},只保留了的写法。
  • 在标签里的属性中,弃用了的写法,只保留了
  • filters只能在{{message|filter}}里使用,弃用了在指令里使用过滤器的用法,要实现相同的效果,需要在计算属性上实现。
  • 对于原生事件要加修饰符native
  • 生命周期里删除了beforeCompile,compiled,ready,新增了beforeMount,mounted,beforUpdate,updated。
  • for循环里,取消了原有的$index,需要改为ES6语法形式自己获取
  • el属性绑定的元素,限制为一个普通元素,不能再绑定在body、html等元素上。
  • 另一个特别喜欢的改变是,在自定义组件上绑定class后,对应的类名会传递到组件根元素上,如果存在同名的,则不会覆盖。这对设置组件样式非常有好处。
  • v-for 里的track-by被替换成了key,
  • v-model增加了.trim,.number等后缀修饰符
  • Custom events can also be used to create custom inputs that work with v-model. Remember:

    is just syntactic sugar for:

  • 原来的改为了标签用法,并且可以选择过渡时的动画模式。
  • 同时过渡多个元素时,使用transition-group标签
    transitiongroup ,appear是标识在初始化的时候执行。
    另外,

Unlike , it renders an actual element: a by default. You can change the element that’s rendered with the tag attribute.
Elements inside are always required to have a unique key attribute

  • 增加了directives属性自定义指令,也可以定义全局的指令:
    // Register a global custom directive called v-focus Vue.directive('focus', { // When the bound element is inserted into the DOM... inserted: function (el) { // Focus the element el.focus() } })

随着工作和学习中碰到的持续更新中···

基于vue和websocket的多人在线聊天室
基于react的gallery
XMLHttpRequest2的一些测试和实践
css3 制作3D色子并动画讲解原理

转载请注明:文章转载自 www.wk8.com.cn
本文地址:https://www.wk8.com.cn/it/241770.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 wk8.com.cn

ICP备案号:晋ICP备2021003244-6号