0 votes
in VueJS by
What are the drawbacks of dynamic directive arguments?

1 Answer

0 votes
by

Apart from the benefits of dynamic directives arguments, it brings two drawbacks or considerations on the usage

  1. Constraints on expressions: When you perform complex JavaScript expressions, make sure that html attribute names cannot contain spaces and quotes. The below expression doesn't work as expected
    <div :[key + 'unique']="value"></div>
    Instead you may need to use string template syntax
    <div :[`${key}unique`]="value"></div>
  2. Custom Directives: The custom directive implementations need to have potential argument changes in addition to value changes.

Related questions

0 votes
asked Sep 6, 2023 in VueJS by DavidAnderson
+1 vote
asked Feb 6, 2023 in VueJS by john ganales
...