Skip to content

Commit efa7631

Browse files
Improve plugin export
1 parent 1e679d6 commit efa7631

File tree

3 files changed

+18
-22
lines changed

3 files changed

+18
-22
lines changed

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,21 @@ $ yarn add vue-scroll-indicator --dev
1212
$ npm i vue-scroll-indicator --save-dev
1313
```
1414

15-
#### Setup:
15+
Register the component:
1616

1717
```javascript
18-
// register the plugin
19-
import Vue from 'vue'
20-
import VueScrollIndicator from 'vue-scroll-indicator'
18+
import Vue from 'vue';
19+
import { VueScrollIndicator } from 'vue-scroll-indicator';
2120

22-
Vue.use(VueScrollIndicator)
21+
Vue.component('vue-scroll-indicator', VueScrollIndicator);
22+
```
23+
24+
Alternatively using `Vue.use()` to register the component:
2325

24-
// ... or register the component manually
25-
import Vue from 'vue'
26-
import { VueScrollIndicator } from 'vue-scroll-indicator'
26+
```javascript
27+
import VueScrollIndicator from 'vue-scroll-indicator';
2728

28-
Vue.component('vue-scroll-indicator', VueScrollIndicator)
29+
Vue.use(VueScrollIndicator);
2930
```
3031

3132
## Usage

package.json

Lines changed: 1 addition & 1 deletion
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.4",
4+
"version": "0.0.5",
55
"author": "Robbin Johansson <robbinfellow@gmail.com>",
66
"main": "dist/vue-scroll-indicator.js",
77
"homepage": "https://github.com/robbinfellow/vue-scroll-indicator#readme",

src/index.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
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, options) {
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-
}
9+
export { VueScrollIndicator };
1310

14-
export default plugin
15-
export { VueScrollIndicator }

0 commit comments

Comments
 (0)