Skip to content

Commit

Permalink
Add .lazy modifier to the docs and example
Browse files Browse the repository at this point in the history
  • Loading branch information
simplesmiler committed Nov 14, 2016
1 parent 2ff5ebf commit 7fdf625
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ From CDN:

### `focus`

A directive that binds focus to the expression in a one-way manner, so that the element receives focus when the expression becomes `truthy` and loses focus when the expression becomes `falsy`.
A directive that binds focus to the expression in a one-way manner, so that the element receives focus when the expression is `truthy` and loses focus when the expression is `falsy`.

``` js
import { focus } from 'vue-focus';
Expand All @@ -61,6 +61,8 @@ export default {
};
```

> NOTE: As opposed to 1.x, in Vue 2.0, directives are updated every time the host component rerenders, not just when the directive expression chages. Somethimes this may be undesirable, especially for the "autofocus" use case. If you want to mimic the 1.x behavior, then add the `.lazy` modifier to the directive, e.g. `v-focus.lazy="true"`.
### `mixin`

A mixin that makes the `v-focus` directive available to the component under the default name.
Expand Down
2 changes: 1 addition & 1 deletion examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<h3><code>Example 1: Autofocus</code></h3>
<div id="example1">
<p><label><input type="checkbox" v-model="shown"> Show the field</label></p>
<p v-if="shown"><input type="text" v-focus="true"></p>
<p v-if="shown"><input type="text" v-focus.lazy="true"></p>
<p>NOTE: field is focused from the start, and gains focus whenever it enters the DOM.</p>
</div>

Expand Down

0 comments on commit 7fdf625

Please sign in to comment.