Subscribe on changes!

Vue directives not working on top-level <template> in SFCs

avatar
Apr 4th 2023

Vue version

3.2.33 on playcode.io, and latest @036914c in Vue SFC playground

Link to minimal reproduction

https://playcode.io/1386836 or https://sfc.vuejs.org/#eNp1UEFqwzAQ/MpaFydQS/RqHEPppQ8I9KJLGm8Sp5JWSHJCMf57V3YSSml1ELur0czOjOLFe3kZUNSiifvQ+wQR0+Bb7XrrKSQYIeABJjgEslAytHw8vZL1y1wLqXKXqbTQTrs9uZjAxiNsMsGqfENjCN4pmK4o1xnSqEWRtbhJaL3ZJQRuAZrTczuO8/9pahR383RWVFw36o5vxZNY9qnszstzJMdmxgzXt4eoRQ3zJM/mFWsuTin5WCsVD/u89zlKCkfFlQyDS71FidFWH4GuEQMTZ2MAk3YTS97d/hHcYv2yRb43i64lZsSuhhWaNWxayBgyKA0dV1pkqBYcCpP/k8qlSgxqm6KqYHvqI3SEERwluFL4LIoCqmrJ6IG40mA6IGe+Zgz0LvYd1vCblAN9fOagszM+t9B/Bj19A5BIvNk=

Steps to reproduce

  1. Register a custom directive, whether that be with app.directive, or just by defining const vDirectiveName
  2. Have the directive do a console.log under mounted event as a test
  3. Add this directive to a component's root