Skip to content

A vue 2.0 directive to keep scroll position for keep-alived components.

License

Notifications You must be signed in to change notification settings

tomorrowdata/vue-keep-scroll-position

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vue-keep-scroll-position

A vue 2.0 directive to keep scroll position for keep-alived components. Forked from vue-keep-scroll and rewritten for vue 2.0 compatibility.

Install

npm i -S vue-keep-scroll-position

Plug into vue

import Vue from 'vue'
import VueKeepScrollPosition from 'vue-keep-scroll-position'
Vue.use VueKeepScrollPosition

Usage

Just add v-keep-scroll-position to your components within <keep-alive>. For router-view:

<keep-alive>
  <router-view v-keep-scroll-position></router-view>
</keep-alive>

For simple dynamic components:

<keep-alive>
  <component :is="someComponentName" v-keep-scroll-position></component>
</keep-alive>

About

A vue 2.0 directive to keep scroll position for keep-alived components.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 55.1%
  • CoffeeScript 44.9%