From 1a80da01f454257b8609321c7ec8c5fe2a2421e9 Mon Sep 17 00:00:00 2001 From: Stanislav Lashmanov Date: Sun, 20 Sep 2020 11:04:06 +0300 Subject: [PATCH] Improve Mixins page (#285) * 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 Co-authored-by: Natalia Tepluhina --- src/guide/mixins.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/guide/mixins.md b/src/guide/mixins.md index 9d1590e119..8d21cf11be 100644 --- a/src/guide/mixins.md +++ b/src/guide/mixins.md @@ -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: @@ -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.