Skip to content
This repository was archived by the owner on Mar 14, 2025. It is now read-only.

Commit 79fd2b5

Browse files
committed
Allow component name to be passed when use as plugin
* Vue.use(flatPickr,'component-name')
1 parent 4c9a7a5 commit 79fd2b5

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

.github/ISSUE_TEMPLATE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
```
77

88
**Tell about your platform**
9-
* flatPickr version : x.x.x
9+
* flatPickr version : 3.x.x
1010
* Vue.js version : 2.x.x
1111
* Browser name and version : Chrome|Firefox|Safari x.x.x
1212
* This package version : x.x.x

src/component.vue

+2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
this.fp.redraw();
8585
this.fp.setDate(this.value, true);
8686
},
87+
8788
/**
8889
* Watch for value changed by date-picker itself and notify parent component
8990
*
@@ -92,6 +93,7 @@
9293
mutableValue (newValue) {
9394
this.$emit('input', newValue);
9495
},
96+
9597
/**
9698
* Watch for changes from parent component and update DOM
9799
*

src/index.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import component from './component.vue';
22

33
const flatPickrPlugin = {
4-
install: function (Vue, options) {
5-
Vue.component('flat-pickr', component);
4+
install: function (Vue, params) {
5+
let name = 'flat-pickr';
6+
if (typeof params === 'string') name = params;
7+
8+
Vue.component(name, component);
69
}
710
};
811

0 commit comments

Comments
 (0)