Skip to content

Commit f0cfcb0

Browse files
docs: add to the list of drawbacks for mixins (#1004)
1 parent 2b0801e commit f0cfcb0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/guide/mixins.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,14 @@ app.mixin({
213213
})
214214
```
215215

216-
## Precautions
216+
## Drawbacks
217217

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

220-
- 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.
220+
- 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.
221221

222-
- Reusability is limited: we cannot pass any parameters to the mixin to change its logic which reduces their flexibility in terms of abstracting logic
222+
- Properties seem to appear from nowhere: If a component uses multiple mixins it isn't necessarily obvious which properties came from which mixin.
223+
224+
- Reusability is limited: we cannot pass any parameters to the mixin to change its logic, which reduces their flexibility in terms of abstracting logic.
223225

224226
To address these issues, we added a new way to organize code by logical concerns: the [Composition API](composition-api-introduction.html).

0 commit comments

Comments
 (0)