1.1.2 • Published 6 years ago

ic-vue-focus v1.1.2

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

v-focus

Use this directive on a form element or a component contains form-elements to let the form-elements focus.

Install

$ npm i ic-vue-focus || yarn add ic-vue-focus

Usage

base:

<input type="text" v-focus>

If you want the element scroll into view when focused, you can specify an modifier like this:

<input type="text" v-focus.into-view>

You can use this directive with an option:

<input type="tel" v-focus="{ block: 'end' }">

The option with a handler prop when you want to do some stuff when the element focused:

<input type="text" v-focus="{ block: 'center', handler: handleFocus }">
{
    method: { handleFocus () {} }
}

Also, the option can be a function directly:

<input type="text" v-focus="handler">

More informations about the option, you can see here.