Commit 1d8f77675245178cb5552b971876f0085de619be
1 parent
4aec6a66
support BackTop to 2.0
Showing
6 changed files
with
24 additions
and
4 deletions
Show diff stats
README.md
examples/app.vue
@@ -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 | </ul> | 48 | </ul> |
48 | </nav> | 49 | </nav> |
49 | <router-view></router-view> | 50 | <router-view></router-view> |
examples/main.js
@@ -140,6 +140,10 @@ const router = new VueRouter({ | @@ -140,6 +140,10 @@ const router = new VueRouter({ | ||
140 | { | 140 | { |
141 | path: '/select', | 141 | path: '/select', |
142 | component: require('./routers/select.vue') | 142 | component: require('./routers/select.vue') |
143 | + }, | ||
144 | + { | ||
145 | + path: '/backtop', | ||
146 | + component: require('./routers/back-top.vue') | ||
143 | } | 147 | } |
144 | ] | 148 | ] |
145 | }); | 149 | }); |
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 | }, |
src/index.js
@@ -3,7 +3,7 @@ import 'core-js/fn/array/find-index'; | @@ -3,7 +3,7 @@ import 'core-js/fn/array/find-index'; | ||
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 './locale'; | @@ -49,7 +49,7 @@ import locale from './locale'; | ||
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, |