@forzoom/vue-router-scroll
npm install @forzoom/vue-router-scroll
Last updated a year ago by forzoom .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @forzoom/vue-router-scroll 
SYNC missed versions from official npm registry.

Installation

npm install @forzoom/vue-router-scroll

Usage

	// index.js
	import router from './router/index.js';
	import VueRouterScroll from 'vue-router-scroll';

	Vue.use(VueRouterScroll, {
		router,
	});

	// router/index.js
	[
		{
			path: '/path/to/example',
			meta: {
				scrollBehavior: 'restore', // top | restore
				scrollDefaultPosition: '100', // window.scrollY = 100 by default
			},
			name: 'test',
			component: Component,
		},
	],

Options

options

router

VueRouter

Vue router instance

checkParams

Boolean: true by default

whether check param as part of key or not

	e.g.

	var route = {
		path: '/a/b/c',
	}

	Vue.use(VueRouteScroll, {
		router,
		checkParams: false,
	});

checkQuery

Boolean: true by default

options in meta

scrollBehavior

进入页面时,控制显示的位置。允许的值包括top或者restore

value description
top 每次都回到顶部
restore 回到上一次离开的位置

scrollDefaultPosition

scrollBehavior = 'restore'时生效。进入页面时,如果没有可以用于展示的位置,将会使用该位置展示页面。 例如设置为0的情况下,进入页面将默认显示页面顶部。

Current Tags

  • 0.1.7                                ...           latest (a year ago)

10 Versions

  • 0.1.7                                ...           a year ago
  • 0.1.6                                ...           a year ago
  • 0.1.5                                ...           a year ago
  • 0.1.4                                ...           a year ago
  • 0.1.3                                ...           a year ago
  • 0.1.1                                ...           2 years ago
  • 0.0.4                                ...           2 years ago
  • 0.0.3                                ...           2 years ago
  • 0.0.2                                ...           2 years ago
  • 0.0.1                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 11
Last Day 1
Last Week 11
Last Month 38
Dependencies (1)
Dev Dependencies (15)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |