Skip to content

Commit edfcbce

Browse files
Improve component export
1 parent c9fff45 commit edfcbce

File tree

5 files changed

+17
-18
lines changed

5 files changed

+17
-18
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.2",
4+
"version": "0.0.3",
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 --hot",
24+
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
2525
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
2626
},
2727
"dependencies": {

src/components/VueScrollIndicator.vue

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

2020
<script>
2121
export default {
22+
name: 'vue-scroll-indicator',
23+
2224
props: {
2325
height: {
2426
type: String,
@@ -36,20 +38,23 @@ export default {
3638
required: false
3739
}
3840
},
41+
3942
mounted() {
4043
this.scrollHandler()
41-
4244
},
45+
4346
created(){
4447
window.addEventListener('scroll', this.scrollHandler)
4548
},
49+
4650
data() {
4751
return {
4852
winScroll: '',
4953
docHeight: '',
5054
indicatorWidth: '',
5155
}
5256
},
57+
5358
methods: {
5459
scrollHandler(){
5560
this.winScroll = document.body.scrollTop || document.documentElement.scrollTop

src/index.js

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

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

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 }
9+
export { VueScrollIndicator };

0 commit comments

Comments
 (0)