Skip to content

Commit 729cded

Browse files
authored
Merge pull request #16 from ycs77/feature/add_custom_scroll_el_option
Feature: add custom scroll el option (#12)
2 parents d6a94a3 + 1cd4d7c commit 729cded

16 files changed

+29
-21
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ import vueScrollBehavior from 'vue-scroll-behavior'
8787
// Using vueScrollBehavior
8888
Vue.use(vueScrollBehavior, {
8989
router: router, // The router instance
90+
el: '#app', // Custom element
9091
maxLength: 100, // Saved history List max length
9192
ignore: [/\/boo/, /\/zoo/], // ignore some routes, they will directly scroll to the top
9293
delay: 0 // Delay by a number of milliseconds
@@ -112,6 +113,7 @@ List of available Options:
112113
Prop | Data Type | Default | Description
113114
-------------- | ---------- | --------- | -----------
114115
`router` | Object | | The router instance: `const router = new VueRouter({})`
116+
`el` | String | null | CSS selector: `#app`
115117
`ignore` | Array | `[ ]` | **RegExp** list to ignore some routes, they will directly scroll to the top
116118
`maxLength` | Number | `50` | Saved history List max length
117119
`delay` | Number | `0` | Delay scroll by a number of milliseconds

demo/App.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ export default {
3636
text-align: center;
3737
color: #2c3e50;
3838
margin-top: 60px;
39+
40+
/* If you set the el option, you can open bottom code */
41+
/* height: 80vh;
42+
overflow-x: hidden;
43+
overflow-y: scroll; */
3944
}
4045
4146
h1, h2 {

demo/dist/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!DOCTYPE html><html><head><meta charset=utf-8><title>vue-scroll-behavior-examples</title><meta name=viewport content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"><link rel=icon type=image/x-icon href=./assets/logo.png><link href=./static/css/app.3a175396ac155d5c78f1d7ea9dca40cd.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.6a9ed5caa9de9342b2c0.js></script><script type=text/javascript src=./static/js/vendor.8f147e6a84ca0c238e63.js></script><script type=text/javascript src=./static/js/app.ded39a9d9c9e1b2828d9.js></script></body></html>
1+
<!DOCTYPE html><html><head><meta charset=utf-8><title>vue-scroll-behavior-examples</title><meta name=viewport content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"><link rel=icon type=image/x-icon href=./assets/logo.png><link href=./static/css/app.3a175396ac155d5c78f1d7ea9dca40cd.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.05344922165dc8e69f1c.js></script><script type=text/javascript src=./static/js/vendor.40116025a8bdf8e03de6.js></script><script type=text/javascript src=./static/js/app.a3009b26db111c863edd.js></script></body></html>

demo/dist/static/css/app.3a175396ac155d5c78f1d7ea9dca40cd.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/dist/static/js/app.a3009b26db111c863edd.js

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/dist/static/js/app.a3009b26db111c863edd.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/dist/static/js/app.ded39a9d9c9e1b2828d9.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

demo/dist/static/js/app.ded39a9d9c9e1b2828d9.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

demo/dist/static/js/manifest.05344922165dc8e69f1c.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)