Skip to content

Commit

Permalink
feat: add custom tag option
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAlexLichter committed Oct 14, 2018
1 parent 54e81cc commit 4f99727
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,10 @@ better suited for universal/SSR code and can be loaded asynchronously as well!
| Prop | Optional? | Comment |
|---| --- | --- |
| target | :white_check_mark: | Can be any query selector you want (or a function that returns such). Will be passed to the scroll function |
| tag | :white_check_mark: | Defaults to `div`. The HTML tag used for the VueNextLevelScroll component |
| scrollFunction | :white_check_mark: | You can define an own scroll function that will take the `target` prop as parameter and can do whatever you like. |
| shouldNavigate | :white_check_mark: | If set, VueRouter will reflect navigation changes in the url(top: no hash, target: hash) |
| navigationType | :white_check_mark: | Default to `push`. The navigation type of that VueRouter should use. Usually either `push` or `replace` |
| navigationType | :white_check_mark: | Defaults to `push`. The navigation type of that VueRouter should use. Usually either `push` or `replace` |


### Default scroll function explained
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
export default {
functional: true,
render(h, { children, data, props: { target, scrollFunction, shouldNavigate = false, navigationType = 'push' }, parent: { $router }, _ssrNode }) {
render(h, { children, data, props: { target, scrollFunction, shouldNavigate = false, navigationType = 'push', tag = 'div' }, parent: { $router }, _ssrNode }) {
const clickFunction = () => {
const fn = scrollFunction || defaultScrollFunction
fn(target, { shouldNavigate, navigationType, $router })
}

return h('div', {
return h(tag, {
...data,
on: {
// Ignore scroll function on server side
Expand Down

0 comments on commit 4f99727

Please sign in to comment.