Skip to content

Commit

Permalink
Improve Mixins page (#285)
Browse files Browse the repository at this point in the history
* Improve Mixins page

State that:

1. Mixins are a __simple__ way to reuse component logic, rather than a flexible way to do it. The term __flexible__ goes into conflict with the last chapter of the page, which describes that mixins are in fact inflexible.
2. Add a section title for Precautions.

* Update src/guide/mixins.md

Co-authored-by: Stanislav Lashmanov <[email protected]>

Co-authored-by: Natalia Tepluhina <[email protected]>
  • Loading branch information
CyberAP and NataliaTepluhina committed Sep 20, 2020
1 parent a0345d8 commit 1a80da0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/guide/mixins.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Basics

Mixins are a flexible way to distribute reusable functionalities for Vue components. A mixin object can contain any component options. When a component uses a mixin, all options in the mixin will be "mixed" into the component's own options.
Mixins distribute reusable functionalities for Vue components. A mixin object can contain any component options. When a component uses a mixin, all options in the mixin will be "mixed" into the component's own options.

Example:

Expand Down Expand Up @@ -213,6 +213,8 @@ app.mixin({
})
```

## Precautions

In Vue 2, mixins were the primary tool to abstract parts of component logic into reusable chunks. However, they have a few issues:

- Mixins are conflict-prone: Since properties from each feature are merged into the same component, you still have to know about every other feature to avoid property name conflicts and for debugging.
Expand Down

0 comments on commit 1a80da0

Please sign in to comment.