设为首页收藏本站

LUPA开源社区

 找回密码
 注册
文章 帖子 博客
LUPA开源社区 首页 业界资讯 软件追踪 查看内容

Vue2.0.0-beta.1发布,轻量级JavaScript框架

2016-7-9 21:29| 发布者: joejoe0332| 查看: 791| 评论: 0|原作者: oschina|来自: oschina

摘要: Vue 2.0.0-beta.1 发布了,Vue.js 是构建 Web 界面的 JavaScript 库,提供数据驱动的组件,还有简单灵活的 API,使得 MVVM 更简单。本次更新意味着API和功能集现在被认为是完整的,在官方2.0版本之前将尽最大努力避 ...

Vue 2.0.0-beta.1 发布了,Vue.js 是构建 Web 界面的 JavaScript 库,提供数据驱动的组件,还有简单灵活的 API,使得 MVVM 更简单。

本次更新意味着API和功能集现在被认为是完整的,在官方2.0版本之前将尽最大努力避免进一步的重大更改。该团队将重点放在稳定、文件和更新支持库上,例如 vue-router 2.0。

注意:如果你是从之前的 2.0-alpha 版本升级或使用 vue-loader 、 vueify,确保完全重新安装NPM的依赖。

Fixed

  • #3176 fix v-for list update edge case

  • #3179 fix v-model on component value always casted to string

  • various other internal stability fixes

重要更新:

  • Custom directive change:

    • update hook will now always be called when the component is updated. This makes the lifecycle more consistent with the new rendering model. The user can simply check forbinding.value !== binding.oldValue to persist the old behavior, or always perform the update (e.g. when the directive is bound to an object that might be mutated instead of replaced).

    • hook naming change: postupdate -> componentUpdated.

  • Transition hooks naming change (now same with 1.x):

    • onEnter -> enter

    • onLeave -> leave

  • Server-side rendering:

    • The component-level caching option server.getCacheKey is renamed to serverCacheKey(no longer necessary to nest under the server block):

      1
      2
      3
      4
      export default {
        // ...
        serverCacheKey: props => props.item.id
      }
    • createRenderer and createBundleRenderer no longer uses lru-cache as the default cache implementation. The user is now responsible for providing the cache implementation which should adhere to the following interface:

      1
      2
      3
      4
      5
      {
        get: (key: string, [cb: Function]) => string | void,
        set: (key: string, val: string) => void,
        has?: (key: string, [cb: Function]) => boolean | void // optional
      }

      更多细节,请看 docs for SSR caching.

  • Functional component render function signature change:

    The first argument is still h which is $createElement bound to the parent instance. Everything else is now passed in the second argument which is a context object:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    export default {
      functional: true,
      render (h, context) {
        // extracted and validated props for the functional component itself
        context.props
     
        // raw data for the functional component's vnode
        // without extracted props
        context.data
     
        // **a function** that returns the child elements
        // nested inside the functional component's tag
        context.children
     
        // the parent component instance
        context.parent
      }
    }

    This avoids having to remember the argument order and makes it easier when you only need some of the arguments:

    1
    2
    3
    4
    5
    6
    7
    export default {
      functional: true,
      render (h, { data, children }) {
        // simple identity higher-order component
        return h(SomeOtherComponent, data, children)
      }
    }


下载地址:


酷毙

雷人

鲜花

鸡蛋

漂亮
  • 快毕业了,没工作经验,
    找份工作好难啊?
    赶紧去人才芯片公司磨练吧!!

最新评论

关于LUPA|人才芯片工程|人才招聘|LUPA认证|LUPA教育|LUPA开源社区 ( 浙B2-20090187 浙公网安备 33010602006705号   

返回顶部