vue2.0
- 在绑定原生HTML时,弃用了原来的
{{{message}}},只保留了的写法。 - 在标签里的属性中,弃用了
的写法,只保留了 - filters只能在
{{message|filter}}里使用,弃用了在指令里使用过滤器的用法,要实现相同的效果,需要在计算属性上实现。 - 对于原生事件要加修饰符native
点击触发 handleClick - 生命周期里删除了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标签
,appear是标识在初始化的时候执行。 另外,transitiongroup
Unlike
, it renders an actual element: aby default. You can change the element that’s rendered with thetagattribute. Elements inside are always required to have a uniquekeyattribute
增加了
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() } })vuex里,显示的提交一个Mutation的,需要调用
store.commit('increment')- vuex 里增加了mapState,mapGetters,mapActions 函数作为语法糖。
随着工作和学习中碰到的持续更新中···
基于vue和websocket的多人在线聊天室 基于react的gallery XMLHttpRequest2的一些测试和实践 css3 制作3D色子并动画讲解原理