Skip to content

Commit 9e34477

Browse files
committed
Merge branch 'dev'
2 parents 5a67aa3 + 37a2db1 commit 9e34477

File tree

11 files changed

+333
-203
lines changed

11 files changed

+333
-203
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
node_modules
2-
npm-debug.log
2+
npm-debug.log
3+
index.html
4+
package-lock.json

README.md

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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
```
2626
npm install vue2-filters
2727
```
28+
2829
When used with a module system, you must explicitly install the filters via `Vue.use()`:
30+
2931
```js
3032
import Vue from 'vue'
3133
import Vue2Filters from 'vue2-filters'
3234

3335
Vue.use(Vue2Filters)
3436
```
37+
3538
You 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

Comments
 (0)