Skip to content

Commit 4bd3ffb

Browse files
feat: add custom tag option
1 parent d2bf365 commit 4bd3ffb

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,10 @@ better suited for universal/SSR code and can be loaded asynchronously as well!
9494
| Prop | Optional? | Comment |
9595
|---| --- | --- |
9696
| target | :white_check_mark: | Can be any query selector you want (or a function that returns such). Will be passed to the scroll function |
97+
| tag | :white_check_mark: | Defaults to `div`. The HTML tag used for the VueNextLevelScroll component |
9798
| 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. |
9899
| shouldNavigate | :white_check_mark: | If set, VueRouter will reflect navigation changes in the url(top: no hash, target: hash) |
99-
| navigationType | :white_check_mark: | Default to `push`. The navigation type of that VueRouter should use. Usually either `push` or `replace` |
100+
| navigationType | :white_check_mark: | Defaults to `push`. The navigation type of that VueRouter should use. Usually either `push` or `replace` |
100101

101102

102103
### Default scroll function explained

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
export default {
22
functional: true,
3-
render(h, { children, data, props: { target, scrollFunction, shouldNavigate = false, navigationType = 'push' }, parent: { $router }, _ssrNode }) {
3+
render(h, { children, data, props: { target, scrollFunction, shouldNavigate = false, navigationType = 'push', tag = 'div' }, parent: { $router }, _ssrNode }) {
44
const clickFunction = () => {
55
const fn = scrollFunction || defaultScrollFunction
66
fn(target, { shouldNavigate, navigationType, $router })
77
}
88

9-
return h('div', {
9+
return h(tag, {
1010
...data,
1111
on: {
1212
// Ignore scroll function on server side

0 commit comments

Comments
 (0)