Skip to content

Latest commit

 

History

History
34 lines (22 loc) · 2.43 KB

File metadata and controls

34 lines (22 loc) · 2.43 KB

v-focus medium #Directives

By webfansplz @webfansplz

Take the Challenge    简体中文

For this challenge, we'll start by creating a custom directive. Lets start with v-focus 👇:

<script setup lang='ts'>
import { ref } from "vue"

const state = ref(false)

/**
 * Implement the custom directive
 * Make sure the input element focuses/blurs when the 'state' is toggled
 *
*/

const VFocus = {

}

setInterval(() => {
  state.value = !state.value
}, 2000)

</script>

<template>
  <input v-focus="state" type="text">
</template>

Back Share your Solutions Check out Solutions