Vue.js 0.12.0 Beta2 发布,JavaScript 库

发布于 2015年05月18日
收藏 2



  • paramAttributes option has been renamed to props.

  • v-with has been removed. Now props are the only way to pass data to a child component.

  • v-component has been removed. Now all components should use the custom tag syntax. For dynamic components, a new syntax is introduced: <component type="{{view}}"></component>.

  • v-partial and {{> partial}} have been removed.

目标是移除 API 的一些 cruft。


  • 异步组件。示例:

    components: {  async: function (resolve) {    setTimeout(function () {
            template: '<div>I am async!</div>'
        }, 1000)
  • elementDirectives。示例:

    Vue.elementDirective('my-stuff', {  update: function () { /* ... */ }


  • props now support explicit one-way binding with the syntax of prop="{{* oneway}}"

  • props can now contain multiple mustache tags, e.g. prop="{{a}} b"

  • props can now contain filters, e.g. prop="{{a | reverse}}"

  • props can now contain expressions, e.g. prop="{{a + b}}"

  • When a prop's parent expression is not "settable", the prop binding will be automatically one-way.

  • All props are created and observed by default when a component is instantiated.

  • When a component with replace:true is compiled, attributes on its placeholder node are now properly merged with the attributes on the component's template root node. Details:

    • If both nodes have class attributes, the class names are merged.

    • If both nodes have the same directive attribute, they will be compiled respectively in their own scope. (placeholder directives in parent scope and template root directives in child scope)

    • If both nodes have the same plain attribute, the template root node will take priority.

  • Errors in simple path getters are now suppressed by default. e.g. a.b.c when a === {}


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


转载请注明:文章转载自 开源中国社区 []
本文标题:Vue.js 0.12.0 Beta2 发布,JavaScript 库