Skip to content

Commit

Permalink
Allow adding multiple additional classes
Browse files Browse the repository at this point in the history
  • Loading branch information
TahaSh committed Dec 12, 2016
1 parent f6339bb commit c33243b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ Here's an example:
:classes="{
'ul': 'simple-links-container',
'.next > a': 'next-link',
'.prev > a': 'prev-link'
'.prev > a': ['prev-link', 'another-class'] // multiple classes
}"
></paginate-links>
```
Expand Down
9 changes: 7 additions & 2 deletions dist/vue-paginate.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* vue-paginate v3.2.1
* vue-paginate v3.2.2
* (c) 2016 Taha Shashtari
* @license MIT
*/
Expand Down Expand Up @@ -5689,7 +5689,12 @@
linksContainer.classList.add(classes['ul'])
}
linksContainer.querySelectorAll(selector).forEach(function (node) {
node.classList.add(classes[selector])
var selectorValue = classes[selector]
if (Array.isArray(selectorValue)) {
selectorValue.forEach(function (c) { return node.classList.add(c); })
} else {
node.classList.add(selectorValue)
}
})
})
}
Expand Down
6 changes: 3 additions & 3 deletions dist/vue-paginate.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-paginate",
"version": "3.2.1",
"version": "3.2.2",
"description": "A simple vue.js plugin to paginate data",
"main": "dist/vue-paginate.js",
"scripts": {
Expand Down
7 changes: 6 additions & 1 deletion src/components/PaginateLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,12 @@ function addAdditionalClasses (linksContainer, classes) {
linksContainer.classList.add(classes['ul'])
}
linksContainer.querySelectorAll(selector).forEach(node => {
node.classList.add(classes[selector])
const selectorValue = classes[selector]
if (Array.isArray(selectorValue)) {
selectorValue.forEach(c => node.classList.add(c))
} else {
node.classList.add(selectorValue)
}
})
})
}

0 comments on commit c33243b

Please sign in to comment.