Skip to content

Commit 0457a93

Browse files
Revert "Improve component export"
This reverts commit edfcbce.
1 parent 8e71702 commit 0457a93

File tree

5 files changed

+18
-17
lines changed

5 files changed

+18
-17
lines changed

dist/vue-scroll-indicator.js

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

dist/vue-scroll-indicator.js.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.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vue-scroll-indicator",
33
"description": "Scroll indicator component using Vue.js",
4-
"version": "0.0.3",
4+
"version": "0.0.4",
55
"author": "Robbin Johansson <robbinfellow@gmail.com>",
66
"main": "dist/vue-scroll-indicator.js",
77
"homepage": "https://github.com/robbinfellow/vue-scroll-indicator#readme",
@@ -21,7 +21,7 @@
2121
],
2222
"scripts": {
2323
"lint": "./node_modules/.bin/eslint --ext .js,.vue src",
24-
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
24+
"dev": "cross-env NODE_ENV=development webpack-dev-server --hot",
2525
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
2626
},
2727
"dependencies": {

src/components/VueScrollIndicator.vue

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919

2020
<script>
2121
export default {
22-
name: 'vue-scroll-indicator',
23-
2422
props: {
2523
height: {
2624
type: String,
@@ -38,23 +36,20 @@ export default {
3836
required: false
3937
}
4038
},
41-
4239
mounted() {
4340
this.scrollHandler()
44-
},
4541
42+
},
4643
created(){
4744
window.addEventListener('scroll', this.scrollHandler)
4845
},
49-
5046
data() {
5147
return {
5248
winScroll: '',
5349
docHeight: '',
5450
indicatorWidth: '',
5551
}
5652
},
57-
5853
methods: {
5954
scrollHandler(){
6055
this.winScroll = document.body.scrollTop || document.documentElement.scrollTop

src/index.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
import VueScrollIndicator from './components/VueScrollIndicator.vue';
1+
import VueScrollIndicator from './components/VueScrollIndicator.vue'
22

3-
export default {
4-
install(Vue) {
5-
Vue.component('vue-scroll-indicator', VueScrollIndicator);
6-
},
7-
};
3+
const plugin = {
4+
install: Vue => {
5+
Vue.component('vue-scroll-indicator', VueScrollIndicator)
6+
}
7+
}
88

9-
export { VueScrollIndicator };
9+
// Automatic installation if Vue has been added to the global scope.
10+
if (typeof window !== 'undefined' && window.Vue) {
11+
window.Vue.use(plugin)
12+
}
13+
14+
export default plugin
15+
export { VueScrollIndicator }

0 commit comments

Comments
 (0)