Vue.js 0.12.8 发布,轻量级 JavaScript 库

jopen 5年前

Vue.js 0.12.8 发布,主要更新如下:


  • Strict mode: When Vue.config.strict is set to true, asset lookup will be limited to the current component only. This means a component will only inherit assets from the inheritance chain (via Vue.extend), but not from their parents in the view hierarchy. When strict mode is enabled, assets should be either registered globally, or explicitly depended on by the component that needs them. When enforced, it could result in better encapsulated components in larger projects.


  • Source code refactored for better minification when using module bundlers. See instructions.

  • Computed properties now have their values automatically cached, and is re-evaluated lazily only when needed. This avoids expensive computations being re-run multiple times when a dependency changes.

  • v-attr now also sets the corresponding property on the element if the property exists. For example, <input value="{{val}}"> will not only update the attribute, but also set the value property. If the element doesn't have a corresponding property for the bound attribute, it will not be set.

  • v-repeat now supports item in array syntax:

    <div v-repeat="item in array"></div>
  • props declarations can now specify twoWay: true, which will throw a warning if the prop's binding type doesn't match.

  • When providing default value for a prop, you can now provide a function that returns Object/Array values to avoid having the same reference shared across multiple vms. (#1032)

  • You can now prefix any prop attribute with data- and it will just work. For example, a prop named myProp can be supplied in the template as data-my-prop. (#1034)


  • Fixed dependency tracking when $adding properties to objects nested inside arrays.

  • #1028 v-cloak not removed correctly on conditionally compiled elements.

  • #1044 "leaveCancelled" not called properly in transitions

  • #1063 path parser accepting invalid path

  • #1065 class interpolation and v-class not working together

  • #1067 two-way binding not properly stabilized

  • #1071 & #1072 props default values not respected when data option is also present


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


Vue.js 0.12.8 发布,轻量级 JavaScript 库