Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue1.x升级到vue2.x需要注意的点 #22

Open
songhlc opened this issue Nov 10, 2016 · 0 comments
Open

vue1.x升级到vue2.x需要注意的点 #22

songhlc opened this issue Nov 10, 2016 · 0 comments
Labels

Comments

@songhlc
Copy link
Owner

songhlc commented Nov 10, 2016

  1. ready事件改变(生命周期事件的改变)
    image
    需要把ready改成mounted

  2. : show 缩写貌似不好用了,需要改成v-show来使用

这里其实我有一点混乱,到底是因为我使用组件的问题还是其他问题,后续来更正

  1. props.coerce被废弃

vue1.0中用于属性转换,可以看到在vue-strap里有了大量的使用,主要通过计算属性来解决了

  1. props.sync props.once 被废除了

其实不管是以往在使用vux还是其他第三方组件的时候,使用了大量的.sync来双向绑定,官方的解释是只保留了单向数据流的绑定,如果子组件需要影响父组件则需要通过事件派发的机制,降低了子组件和父组件的耦合

  1. 新增了render function

本质上 render function和写一个模版是等价的,但是具体为什么要新增render,等我深入了解后再来解答吧。

  1. 废弃了 vm.$dispatch和vm.$broadcast

全局事件或vuex代替

  1. 服务器端渲染
    在下才疏学浅,还没有到这个地步。

这里有一个帮助从vue1.x升级到vue2.0的开源项目,号称是能够覆盖80%需要升级的内容,对于老项目来说是一个很不错的选择哦

PS:关于vue2.0 UI框架的选择:

个人目前决定pc端UI框架从vue-strap转移到element UI上,毕竟基于vue2.0开发,而且vue-strap的文档我一直觉得不够友好。另外如果有其他好的项目,也希望大家推荐给我。

@songhlc songhlc changed the title vue1升级到vue2需要注意的点[future] vue1.x升级到vue2.x需要注意的点[future] Nov 10, 2016
@songhlc songhlc added the plan label Nov 10, 2016
@songhlc songhlc changed the title vue1.x升级到vue2.x需要注意的点[future] vue1.x升级到vue2.x需要注意的点 Nov 10, 2016
@songhlc songhlc added VUE and removed plan labels Nov 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant