Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom directives #104

Closed
manniL opened this issue Jan 21, 2022 · 1 comment
Closed

Custom directives #104

manniL opened this issue Jan 21, 2022 · 1 comment

Comments

@manniL
Copy link

manniL commented Jan 21, 2022

Hey 👋🏻

I was wondering whether custom directives are supported inside the <script setup> tag.
From my current test it seems they are not but I might do sth. wrong 🤔

Example component:

<script setup>
// enables v-focus in templates
const vFocus = {
  mounted: (el) => el.focus()
}
</script>
1
<template>
  <input v-focus />
</template>

UPDATE

Seems that const focus = {} works but const vFocus = {} does not.

@xiaoxiangmoe
Copy link
Collaborator

Try move vFocus to another file and import this.

xiaoxiangmoe added a commit to xiaoxiangmoe/unplugin-vue2-script-setup that referenced this issue Feb 22, 2022
xiaoxiangmoe added a commit to xiaoxiangmoe/unplugin-vue2-script-setup that referenced this issue Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants