vuejs / docs

📄 Documentation for Vue 3
https://vuejs.org
Other
2.81k stars 4.1k forks source link

Docs: unobvious warning in custom-directives #2849

Closed xiaodong2008 closed 2 weeks ago

xiaodong2008 commented 2 weeks ago

In the Usage on Components of custom-directives page, there is an unobvious warning: In general, it is not recommended to use custom directives on components.

I think we need to change this to a warning block.

Refers to: https://vuejs.org/guide/reusability/custom-directives.html#usage-on-components

NataliaTepluhina commented 2 weeks ago

@xiaodong2008 we are trying to avoid warnings in the docs as much as possible (as they tend to break the reader's flow and are quite distracting). Do you think the benefits of having a warning outweigh the distraction from the warning?

xiaodong2008 commented 2 weeks ago

Yes, as per the description in the document, the custom directives part may cause some unexpected results and it is not recommended, so I think adding a warning is better than just adding a conclusion at the end.

The warning should be added at the top part of custom directives.

NataliaTepluhina commented 2 weeks ago

@xiaodong2008 would you like me to add the change or would you prefer to create a PR?

xiaodong2008 commented 2 weeks ago

I’ll create a PR to make this change, thanks for your suggestion!