Search code examples
vuejs3vue-script-setup

How to not to expose some variables from script setup to the template?


As it mentions here all the top level bindinigs introduced in script setup are exposed to template.

Question: How to exclude some of them? Something like private vairables which are only available inside script setup but not then passed to template


Solution

  • There is no way to do that with script setup. For advanced use cases use a setup function, where you can choose what to expose:

    https://vuejs.org/api/composition-api-setup.html