Skip to content

Commit 5170191

Browse files
Minor refactoring
1 parent 5660eff commit 5170191

File tree

4 files changed

+32
-30
lines changed

4 files changed

+32
-30
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ Vue.use(VueScrollIndicator);
3838

3939
Display the component using default style:
4040

41-
```html
41+
``` vue
4242
<vue-scroll-indicator></vue-scroll-indicator>
4343
```
4444

45-
Display the component using custom style _(any valid use of css units will do)_:
45+
Display the component using custom style:
4646

47-
```html
47+
``` vue
4848
<vue-scroll-indicator
4949
height="7px"
5050
color="#11998e"

dist/index.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
126126
});
127127
exports.default = {
128128
name: 'vue-scroll-indicator',
129+
129130
props: {
130131
height: {
131132
type: String,
@@ -143,8 +144,13 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
143144
required: false
144145
}
145146
},
146-
mounted: function mounted() {
147-
//
147+
148+
data: function data() {
149+
return {
150+
scrolled: '',
151+
docHeight: '',
152+
width: ''
153+
};
148154
},
149155
created: function created() {
150156
window.addEventListener('load', this.scrollHandler);
@@ -154,13 +160,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
154160
window.removeEventListener('load', this.scrollHandler);
155161
window.removeEventListener('scroll', this.scrollHandler);
156162
},
157-
data: function data() {
158-
return {
159-
scrolled: '',
160-
docHeight: '',
161-
width: ''
162-
};
163-
},
163+
164164

165165
methods: {
166166
scrollHandler: function scrollHandler() {

docs/build/app.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11154,6 +11154,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1115411154
});
1115511155
exports.default = {
1115611156
name: 'vue-scroll-indicator',
11157+
1115711158
props: {
1115811159
height: {
1115911160
type: String,
@@ -11171,8 +11172,13 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1117111172
required: false
1117211173
}
1117311174
},
11174-
mounted: function mounted() {
11175-
//
11175+
11176+
data: function data() {
11177+
return {
11178+
scrolled: '',
11179+
docHeight: '',
11180+
width: ''
11181+
};
1117611182
},
1117711183
created: function created() {
1117811184
window.addEventListener('load', this.scrollHandler);
@@ -11182,13 +11188,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1118211188
window.removeEventListener('load', this.scrollHandler);
1118311189
window.removeEventListener('scroll', this.scrollHandler);
1118411190
},
11185-
data: function data() {
11186-
return {
11187-
scrolled: '',
11188-
docHeight: '',
11189-
width: ''
11190-
};
11191-
},
11191+
1119211192

1119311193
methods: {
1119411194
scrollHandler: function scrollHandler() {

src/components/VueScrollIndicator.vue

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<script>
2323
export default {
2424
name: 'vue-scroll-indicator',
25+
2526
props: {
2627
height: {
2728
type: String,
@@ -39,24 +40,25 @@ export default {
3940
required: false,
4041
},
4142
},
42-
mounted() {
43-
//
43+
44+
data() {
45+
return {
46+
scrolled: '',
47+
docHeight: '',
48+
width: '',
49+
};
4450
},
51+
4552
created() {
4653
window.addEventListener('load', this.scrollHandler);
4754
window.addEventListener('scroll', this.scrollHandler);
4855
},
56+
4957
destroyed() {
5058
window.removeEventListener('load', this.scrollHandler);
5159
window.removeEventListener('scroll', this.scrollHandler);
5260
},
53-
data() {
54-
return {
55-
scrolled: '',
56-
docHeight: '',
57-
width: '',
58-
};
59-
},
61+
6062
methods: {
6163
scrollHandler() {
6264
this.scrolled = document.body.scrollTop || document.documentElement.scrollTop;

0 commit comments

Comments
 (0)