@@ -17,23 +17,53 @@ Simply include `vue2-filters` after Vue and it will install itself automatically
1717
1818``` html
1919<script src =" https://unpkg.com/vue/dist/vue.js" ></script >
20- <script src =" https://cdn.jsdelivr.net/vue2-filters/0.1.9 /vue2-filters.min.js" ></script >
20+ <script src =" https://cdn.jsdelivr.net/vue2-filters/0.2.0 /vue2-filters.min.js" ></script >
2121```
2222
2323### NPM
2424
2525```
2626npm install vue2-filters
2727```
28+
2829When used with a module system, you must explicitly install the filters via ` Vue.use() ` :
30+
2931``` js
3032import Vue from ' vue'
3133import Vue2Filters from ' vue2-filters'
3234
3335Vue .use (Vue2Filters)
3436```
37+
3538You don't need to do this when using global script tags.
3639
40+ ### Nuxt.js
41+
42+ ```
43+ npm install vue2-filters
44+ ```
45+
46+ When create file ` plugins/vue2-filters.js ` :
47+
48+ ``` js
49+ import Vue from ' vue'
50+ import Vue2Filters from ' vue2-filters'
51+
52+ Vue .use (Vue2Filters)
53+ ```
54+
55+ Then, add the file inside the ` plugins ` key of ` nuxt.config.js ` :
56+
57+ ``` js
58+ module .exports = {
59+ // ...
60+ plugins: [
61+ ' ~/plugins/vue2-filters'
62+ ],
63+ // ...
64+ }
65+ ```
66+
3767## Usage
3868
3969#### capitalize
@@ -127,7 +157,6 @@ You don't need to do this when using global script tags.
127157 // 5 => '5th'
128158 ```
129159
130-
131160#### limitBy
132161
133162+ Arguments:
@@ -144,7 +173,6 @@ You don't need to do this when using global script tags.
144173 <div v-for =" item in limitBy(items, 10, 5)" ></div >
145174 ```
146175
147-
148176#### filterBy
149177
150178+ Arguments:
@@ -163,6 +191,22 @@ You don't need to do this when using global script tags.
163191 <div v-for =" user in filterBy(users, 'Bonnie', 'name', 'age')" >
164192 ```
165193
194+ #### find
195+
196+ + Arguments:
197+ * ` {Array} [items] `
198+ * ` {String} [query] `
199+ * ` {String} [searchKey] `
200+
201+ + Example:
202+
203+ ``` html
204+ <!-- only the first item that contains the target string "hello" will be displayed -->
205+ <div v-for =" item in find(items, 'hello')" >
206+ <!-- the filter will only search for "Bonnie" in the name or age fields of each user object and return the first result -->
207+ <div v-for =" user in find(users, 'Bonnie', 'name', 'age')" >
208+ ```
209+
166210#### orderBy
167211
168212+ Arguments:
@@ -197,4 +241,4 @@ If you find a bug or want to contribute to the code or documentation, you can he
197241
198242## License
199243
200- [ MIT] ( http://opensource.org/licenses/MIT )
244+ [ MIT] ( http://opensource.org/licenses/MIT )
0 commit comments