Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Custom directives #104

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

Custom directives #104

TheAlexLichter opened this issue Jan 21, 2022 · 1 comment

Comments

@TheAlexLichter
Copy link

TheAlexLichter 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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants