Skip to content

Commit 7fdf625

Browse files
committed
Add .lazy modifier to the docs and example
1 parent 2ff5ebf commit 7fdf625

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ From CDN:
4545

4646
### `focus`
4747

48-
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`.
48+
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`.
4949

5050
``` js
5151
import { focus } from 'vue-focus';
@@ -61,6 +61,8 @@ export default {
6161
};
6262
```
6363

64+
> 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"`.
65+
6466
### `mixin`
6567

6668
A mixin that makes the `v-focus` directive available to the component under the default name.

examples/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<h3><code>Example 1: Autofocus</code></h3>
1212
<div id="example1">
1313
<p><label><input type="checkbox" v-model="shown"> Show the field</label></p>
14-
<p v-if="shown"><input type="text" v-focus="true"></p>
14+
<p v-if="shown"><input type="text" v-focus.lazy="true"></p>
1515
<p>NOTE: field is focused from the start, and gains focus whenever it enters the DOM.</p>
1616
</div>
1717

0 commit comments

Comments
 (0)