2.1.10

Latest release in branch 2.1
Released 9 years ago (January 17, 2017)

Software Vue.js
Branch 2.1
Status
End of life
End of support (OSS) February 26, 2017
First official release version 2.1.0
First official release date 9 years ago (November 22, 2016)
Release notes https://github.com/vuejs/core/releases/tag/v2.1.10
Source code https://github.com/vuejs/core/tree/v2.1.10
Documentation https://v2.vuejs.org
Vue.js 2.1 Releases View full list

What Is New in Vue.js 2.1

Vue 2.1 introduces several key enhancements focused on component composition and developer experience. The update brings more flexible slot mechanics, finer control over HTML attributes, and improvements to existing features like v-model and v-once.

Category Key Changes
New Features Scoped Slots, v-model behavior for custom components, inheritAttrs option
Improvements v-once optimization, Server-Side Rendering (SSR) performance, lifecycle hook events
Bug Fixes Fixes for edge cases in directives, component events, and template parsing

How do scoped slots improve component reusability?

Scoped slots are the standout feature in 2.1, fundamentally changing how components pass data to their slot content. Previously, a slot had no access to data from the child component. Now, you can expose data from the child to the parent's slot template, enabling highly reusable and composable component patterns.

In practice, this is a game-changer for building data-agnostic layout components or complex renderless logic components. You define a slot in the child component and bind attributes to it. The parent can then use a special slot-scope attribute to capture that data and decide exactly how to render it.

<!-- Child Component -->
<slot :user="user"></slot>

<!-- Parent Template -->
<child-component>
  <template slot-scope="props">
    {{ props.user.name }}
  </template>
</child-component>

What does the new model option do for custom v-model?

The model option gives you explicit control over which prop and event a custom component uses for v-model two-way binding. Before 2.1, v-model on a component always used value as the prop and input as the event, which was limiting for components like checkboxes or select inputs.

This matters because it decouples the component's internal logic from the v-model contract. You can now define a component that uses a checked prop and a change event but still cleanly supports v-model from a parent.

Vue.component('my-checkbox', {
  model: {
    prop: 'checked',
    event: 'change'
  },
  props: ['checked'],
  template: `...`
})

How does inheritAttrs work with $attrs?

The inheritAttrs: false option and the new $attrs instance property work together to give you precise control over where HTML attributes fall through. By default, non-prop attributes bind to the root element of a component. Setting inheritAttrs to false stops this automatic behavior.

You can then manually decide where to apply these attributes using v-bind="$attrs". This is incredibly useful for creating base components that need to pass attributes like placeholder or aria-* labels to a specific inner element, not the wrapper root.

Vue.component('base-input', {
  inheritAttrs: false,
  props: ['label', 'value'],
  template: `
    <label>
      {{ label }}
      <input v-bind="$attrs" v-bind:value="value" @input="$emit('input', $event.target.value)">
    </label>
  `
})

What performance gains does v-once get?

The v-once directive received a significant internal optimization. It's now more efficient when used in conjunction with v-if and v-for. The Vue compiler can better optimize these static sub-trees, reducing the overhead during re-renders.

For SSR, this translates to faster server-side rendering because these static nodes are compiled into simpler string concatenation functions. In practice, you'll see the most benefit in large lists where parts of the item template are static and won't change.

FAQ

Can I use scoped slots without a template tag?
Yes, you can use the slot-scope attribute directly on a regular element if it's the only child of the component. However, using a <template> tag is often cleaner, especially for multiple nodes or when you need to avoid wrapping an extra element.

Does the model option break existing components using v-model?
No, this is a purely additive feature. Existing components that rely on the default value prop and input event for v-model will continue to work exactly as before.

When should I turn off inheritAttrs?
Use inheritAttrs: false when your component's root element shouldn't automatically get all non-prop attributes, or when you need to distribute those attributes to a different, specific element inside the component's template.

Is v-once now safe to use with v-if?
Yes, the optimization specifically improves the integration of v-once with v-if (and v-for). The directive behaves more predictably in these conditional or list contexts, making it a viable option for performance tuning.

Are there any breaking changes in 2.1 I should watch for?
Vue 2.1 is a minor release with no intentional breaking changes. The changes are backward-compatible additions and improvements. As always, check the release notes for specific bug fixes that might affect very rare edge cases in your application.

Releases In Branch 2.1

Version Release date
2.1.10 9 years ago
(January 17, 2017)
2.1.9 9 years ago
(January 16, 2017)
2.1.8 9 years ago
(December 28, 2016)
2.1.7 9 years ago
(December 24, 2016)
2.1.5 9 years ago
(December 13, 2016)
2.1.6 9 years ago
(December 13, 2016)
2.1.4 9 years ago
(December 02, 2016)
2.1.3 9 years ago
(November 24, 2016)
2.1.1 9 years ago
(November 23, 2016)
2.1.2 9 years ago
(November 23, 2016)
2.1.0 9 years ago
(November 22, 2016)