Commit f24603ba5839334307d7ef76c24024353ebf3711

Authored by Aresn
Committed by GitHub
2 parents 87c51597 7d535fc9

Merge pull request #345 from DebugIsFalse/2.0-backtop

2.0 backtop
@@ -58,7 +58,7 @@ @@ -58,7 +58,7 @@
58 - [ ] LoadingBar 58 - [ ] LoadingBar
59 - [x] Circle 59 - [x] Circle
60 - [x] Affix 60 - [x] Affix
61 -- [ ] BackTop 61 +- [x] BackTop
62 - [x] Spin 62 - [x] Spin
63 63
64 ## Overview 64 ## Overview
@@ -44,6 +44,7 @@ li + li { border-left: solid 1px #bbb; padding-left: 10px; margin-left: 10px; } @@ -44,6 +44,7 @@ li + li { border-left: solid 1px #bbb; padding-left: 10px; margin-left: 10px; }
44 <li><router-link to="/spin">Spin</router-link></li> 44 <li><router-link to="/spin">Spin</router-link></li>
45 <li><router-link to="/cascader">Cascader</router-link></li> 45 <li><router-link to="/cascader">Cascader</router-link></li>
46 <li><router-link to="/select">Select</router-link></li> 46 <li><router-link to="/select">Select</router-link></li>
  47 + <li><router-link to="/backtop">Backtop</router-link></li>
47 <li><router-link to="/page">Page</router-link></li> 48 <li><router-link to="/page">Page</router-link></li>
48 </ul> 49 </ul>
49 </nav> 50 </nav>
@@ -142,6 +142,10 @@ const router = new VueRouter({ @@ -142,6 +142,10 @@ const router = new VueRouter({
142 component: require('./routers/select.vue') 142 component: require('./routers/select.vue')
143 }, 143 },
144 { 144 {
  145 + path: '/backtop',
  146 + component: require('./routers/back-top.vue')
  147 + },
  148 + {
145 path: '/page', 149 path: '/page',
146 component: require('./routers/page.vue') 150 component: require('./routers/page.vue')
147 } 151 }
examples/routers/back-top.vue 0 → 100644
  1 +<style>
  2 + body{
  3 + height: 2000px;
  4 + }
  5 +</style>
  6 +<template>
  7 + <BackTop>
  8 +
  9 + </BackTop>
  10 +</template>
  11 +<script>
  12 + export default {
  13 + data(){
  14 + return {
  15 +
  16 + }
  17 + },
  18 + mounted(){
  19 +
  20 + }
  21 + }
  22 +</script>
src/components/back-top/back-top.vue
@@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
35 backTop: false 35 backTop: false
36 }; 36 };
37 }, 37 },
38 - ready () { 38 + mounted () {
39 window.addEventListener('scroll', this.handleScroll, false); 39 window.addEventListener('scroll', this.handleScroll, false);
40 window.addEventListener('resize', this.handleScroll, false); 40 window.addEventListener('resize', this.handleScroll, false);
41 }, 41 },
@@ -3,7 +3,7 @@ import &#39;core-js/fn/array/find-index&#39;; @@ -3,7 +3,7 @@ import &#39;core-js/fn/array/find-index&#39;;
3 3
4 import Affix from './components/affix'; 4 import Affix from './components/affix';
5 import Alert from './components/alert'; 5 import Alert from './components/alert';
6 -// import BackTop from './components/back-top'; 6 +import BackTop from './components/back-top';
7 import Badge from './components/badge'; 7 import Badge from './components/badge';
8 import Breadcrumb from './components/breadcrumb'; 8 import Breadcrumb from './components/breadcrumb';
9 import Button from './components/button'; 9 import Button from './components/button';
@@ -49,7 +49,7 @@ import locale from &#39;./locale&#39;; @@ -49,7 +49,7 @@ import locale from &#39;./locale&#39;;
49 const iview = { 49 const iview = {
50 Affix, 50 Affix,
51 Alert, 51 Alert,
52 - // BackTop, 52 + BackTop,
53 Badge, 53 Badge,
54 Breadcrumb, 54 Breadcrumb,
55 BreadcrumbItem: Breadcrumb.Item, 55 BreadcrumbItem: Breadcrumb.Item,