diff --git a/README.md b/README.md index 0d81159..09f421a 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,20 @@ npm install vue-js-modal --save Include plugin in your `main.js` file. ```javascript -import vmodal from 'vue-js-modal' +import VModal from 'vue-js-modal' -Vue.use(vmodal) +Vue.use(VModal) + +/* +By default plugin will use "modal" name for the component. +If you need to change it, you can do so by supplying "componentName" option. + +Example: + +Vue.use(VModal, { componentName: "foo-modal" }) +... + +*/ ``` Create modal: diff --git a/src/index.js b/src/index.js index bb44ed4..c58c659 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,7 @@ import Modal from './Modal.vue' +const defaultComponentName = 'modal' + const Plugin = { install (Vue, options = {}) { if (this.installed) { @@ -23,7 +25,8 @@ const Plugin = { } } - Vue.component('modal', Modal) + const componentName = options.componentName || defaultComponentName + Vue.component(componentName, Modal) } }