File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change 11// Import vue component
22import Component from './{{componentName}}.vue'
33
4- // install function executed by Vue.use()
5- export function install ( Vue ) {
6- if ( install . installed ) return
7- install . installed = true
8- Vue . component ( '{{componentNamePascal}}' , Component )
9- }
10-
11- // Create module definition for Vue.use()
12- const plugin = {
13- install
4+ // `Vue.use` automatically prevents you from using
5+ // the same plugin more than once,
6+ // so calling it multiple times on the same plugin
7+ // will install the plugin only once
8+ Component . install = Vue => {
9+ Vue . component ( Component . name , Component )
1410}
1511
1612// To auto-install when vue is found
@@ -21,7 +17,7 @@ if (typeof window !== 'undefined') {
2117 GlobalVue = global . Vue
2218}
2319if ( GlobalVue ) {
24- GlobalVue . use ( plugin )
20+ GlobalVue . use ( Component )
2521}
2622
2723// To allow use as module (npm/webpack/etc.) export component
You can’t perform that action at this time.
0 commit comments