From a97a72b7371342de446e7786c5befc92c5ea978e Mon Sep 17 00:00:00 2001 From: skirtle <65301168+skirtles-code@users.noreply.github.com> Date: Thu, 22 Apr 2021 04:57:55 +0100 Subject: [PATCH] docs: add to the list of drawbacks for mixins --- src/guide/mixins.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/guide/mixins.md b/src/guide/mixins.md index 8d21cf11be..63aff4a2ab 100644 --- a/src/guide/mixins.md +++ b/src/guide/mixins.md @@ -213,12 +213,14 @@ app.mixin({ }) ``` -## Precautions +## Drawbacks 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. +- Mixins are conflict-prone: Since properties from each mixin are merged into the same component, you still have to know about every other mixin to avoid property name conflicts. -- Reusability is limited: we cannot pass any parameters to the mixin to change its logic which reduces their flexibility in terms of abstracting logic +- Properties seem to appear from nowhere: If a component uses multiple mixins it isn't necessarily obvious which properties came from which mixin. + +- Reusability is limited: we cannot pass any parameters to the mixin to change its logic, which reduces their flexibility in terms of abstracting logic. To address these issues, we added a new way to organize code by logical concerns: the [Composition API](composition-api-introduction.html).