Skip to content

Commit d7615c6

Browse files
committed
Change to component import instead of plugin use
1 parent 360350c commit d7615c6

File tree

8 files changed

+31
-21
lines changed

8 files changed

+31
-21
lines changed

README.md

+9-4
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,20 @@ yarn add vue-bot-ui
2323

2424
## Usage
2525

26-
Include plugin in your `main.js` file.
26+
Import & register the component
2727

2828
```javascript
29-
import VueBotUI from 'vue-bot-ui'
29+
import { VueBotUI } from 'vue-bot-ui'
3030

31-
Vue.use(VueBotUI)
31+
export default {
32+
components: {
33+
VueBotUI,
34+
},
35+
...
36+
}
3237
```
3338

34-
Use it:
39+
And use it:
3540

3641
```vue
3742
<VueBotUI

dist/vue-bot-ui.common.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -546,12 +546,12 @@ if (typeof window !== 'undefined') {
546546
// Indicate to webpack that this file can be concatenated
547547
/* harmony default export */ var setPublicPath = (null);
548548

549-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"721d366b-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/pug-plain-loader!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/BotUI.vue?vue&type=template&id=530ce492&lang=pug&
549+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"721d366b-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/pug-plain-loader!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/BotUI.vue?vue&type=template&id=20c1632b&lang=pug&
550550
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"qkb-bot-ui",class:_vm.uiClasses},[_c('transition',{attrs:{"name":"qkb-fadeUp"}},[(_vm.botActive)?_c('div',{staticClass:"qkb-board"},[_c('BoardHeader',{attrs:{"bot-title":_vm.optionsMain.botTitle},on:{"close-bot":_vm.botToggle}}),_c('BoardContent',{attrs:{"bot-typing":_vm.botTyping,"main-data":_vm.messages}}),_c('BoardAction',{attrs:{"input-disable":_vm.inputDisable,"input-placeholder":_vm.optionsMain.inputPlaceholder,"input-disable-placeholder":_vm.optionsMain.inputDisablePlaceholder},on:{"msg-send":_vm.sendMessage}})],1):_vm._e()]),_c('div',{staticClass:"qkb-bot-bubble"},[_c('button',{staticClass:"qkb-bubble-btn",on:{"click":_vm.botToggle}},[_vm._t("bubbleButton",[_c('transition',{attrs:{"name":"qkb-scaleUp"}},[(!_vm.botActive)?_c('BubbleIcon',{key:"1",staticClass:"qkb-bubble-btn-icon"}):_c('CloseIcon',{key:"2",staticClass:"qkb-bubble-btn-icon qkb-bubble-btn-icon--close"})],1)])],2)]),_c('AppStyle',{attrs:{"options":_vm.optionsMain}}),_c('div',{staticClass:"qkb-preload-image"},[(_vm.optionsMain.botAvatarImg)?_c('div',{staticClass:"qkb-msg-avatar__img"}):_vm._e()])],1)}
551551
var staticRenderFns = []
552552

553553

554-
// CONCATENATED MODULE: ./src/components/BotUI.vue?vue&type=template&id=530ce492&lang=pug&
554+
// CONCATENATED MODULE: ./src/components/BotUI.vue?vue&type=template&id=20c1632b&lang=pug&
555555

556556
// EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
557557
var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__("8bbf");
@@ -1338,7 +1338,7 @@ function BotUIvue_type_script_lang_js_defineProperty(obj, key, value) { if (key
13381338

13391339

13401340
/* harmony default export */ var BotUIvue_type_script_lang_js_ = ({
1341-
name: 'VBotUI',
1341+
name: 'VueBotUi',
13421342
components: {
13431343
BoardHeader: Header,
13441344
BoardContent: Content,
@@ -1368,7 +1368,7 @@ function BotUIvue_type_script_lang_js_defineProperty(obj, key, value) { if (key
13681368
},
13691369
data: function data() {
13701370
return {
1371-
botActive: true,
1371+
botActive: false,
13721372
defaultOptions: {
13731373
botTitle: 'Chatbot',
13741374
colorScheme: '#1b53d0',
@@ -1465,7 +1465,9 @@ var Plugin = {
14651465
}
14661466
};
14671467
/* harmony default export */ var vue_bot_ui = (Plugin);
1468+
14681469
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
1470+
/* concated harmony reexport VueBotUI */__webpack_require__.d(__webpack_exports__, "VueBotUI", function() { return BotUI; });
14691471

14701472

14711473
/* harmony default export */ var entry_lib = __webpack_exports__["default"] = (vue_bot_ui);

dist/vue-bot-ui.umd.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -555,12 +555,12 @@ if (typeof window !== 'undefined') {
555555
// Indicate to webpack that this file can be concatenated
556556
/* harmony default export */ var setPublicPath = (null);
557557

558-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"721d366b-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/pug-plain-loader!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/BotUI.vue?vue&type=template&id=530ce492&lang=pug&
558+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"721d366b-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/pug-plain-loader!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/BotUI.vue?vue&type=template&id=20c1632b&lang=pug&
559559
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"qkb-bot-ui",class:_vm.uiClasses},[_c('transition',{attrs:{"name":"qkb-fadeUp"}},[(_vm.botActive)?_c('div',{staticClass:"qkb-board"},[_c('BoardHeader',{attrs:{"bot-title":_vm.optionsMain.botTitle},on:{"close-bot":_vm.botToggle}}),_c('BoardContent',{attrs:{"bot-typing":_vm.botTyping,"main-data":_vm.messages}}),_c('BoardAction',{attrs:{"input-disable":_vm.inputDisable,"input-placeholder":_vm.optionsMain.inputPlaceholder,"input-disable-placeholder":_vm.optionsMain.inputDisablePlaceholder},on:{"msg-send":_vm.sendMessage}})],1):_vm._e()]),_c('div',{staticClass:"qkb-bot-bubble"},[_c('button',{staticClass:"qkb-bubble-btn",on:{"click":_vm.botToggle}},[_vm._t("bubbleButton",[_c('transition',{attrs:{"name":"qkb-scaleUp"}},[(!_vm.botActive)?_c('BubbleIcon',{key:"1",staticClass:"qkb-bubble-btn-icon"}):_c('CloseIcon',{key:"2",staticClass:"qkb-bubble-btn-icon qkb-bubble-btn-icon--close"})],1)])],2)]),_c('AppStyle',{attrs:{"options":_vm.optionsMain}}),_c('div',{staticClass:"qkb-preload-image"},[(_vm.optionsMain.botAvatarImg)?_c('div',{staticClass:"qkb-msg-avatar__img"}):_vm._e()])],1)}
560560
var staticRenderFns = []
561561

562562

563-
// CONCATENATED MODULE: ./src/components/BotUI.vue?vue&type=template&id=530ce492&lang=pug&
563+
// CONCATENATED MODULE: ./src/components/BotUI.vue?vue&type=template&id=20c1632b&lang=pug&
564564

565565
// EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
566566
var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__("8bbf");
@@ -1347,7 +1347,7 @@ function BotUIvue_type_script_lang_js_defineProperty(obj, key, value) { if (key
13471347

13481348

13491349
/* harmony default export */ var BotUIvue_type_script_lang_js_ = ({
1350-
name: 'VBotUI',
1350+
name: 'VueBotUi',
13511351
components: {
13521352
BoardHeader: Header,
13531353
BoardContent: Content,
@@ -1377,7 +1377,7 @@ function BotUIvue_type_script_lang_js_defineProperty(obj, key, value) { if (key
13771377
},
13781378
data: function data() {
13791379
return {
1380-
botActive: true,
1380+
botActive: false,
13811381
defaultOptions: {
13821382
botTitle: 'Chatbot',
13831383
colorScheme: '#1b53d0',
@@ -1474,7 +1474,9 @@ var Plugin = {
14741474
}
14751475
};
14761476
/* harmony default export */ var vue_bot_ui = (Plugin);
1477+
14771478
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
1479+
/* concated harmony reexport VueBotUI */__webpack_require__.d(__webpack_exports__, "VueBotUI", function() { return BotUI; });
14781480

14791481

14801482
/* harmony default export */ var entry_lib = __webpack_exports__["default"] = (vue_bot_ui);

dist/vue-bot-ui.umd.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/App.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
</template>
1616
<script>
1717
import BotIcon from '@/assets/icons/bot.png'
18+
import { VueBotUI } from './vue-bot-ui'
1819
import { messageService } from '@/helpers/message'
1920
2021
export default {
2122
components: {
22-
BotIcon
23+
BotIcon,
24+
VueBotUI
2325
},
2426
2527
data () {

src/components/BotUI.vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ import BubbleIcon from '@/assets/icons/bubble.svg'
4646
import CloseIcon from '@/assets/icons/close.svg'
4747
4848
export default {
49-
name: 'VBotUI',
49+
name: 'VueBotUI',
50+
5051
components: {
5152
BoardHeader,
5253
BoardContent,
@@ -79,7 +80,7 @@ export default {
7980
8081
data () {
8182
return {
82-
botActive: true,
83+
botActive: false,
8384
defaultOptions: {
8485
botTitle: 'Chatbot',
8586
colorScheme: '#1b53d0',

src/main.js

-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import Vue from 'vue'
22
import App from './App.vue'
3-
import VueBotUI from './vue-bot-ui'
43

54
Vue.config.productionTip = false
65

7-
Vue.use(VueBotUI)
8-
96
new Vue({
107
render: (h) => h(App)
118
}).$mount('#app')

src/vue-bot-ui.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import BotUI from '@/components/BotUI.vue'
1+
import VueBotUI from '@/components/BotUI.vue'
22

33
const Plugin = {
44
install (Vue, options) {
5-
Vue.component('VueBotUI', BotUI)
5+
Vue.component('VueBotUI', VueBotUI)
66

77
if (options) {
88
// console.log('options', options)
@@ -11,3 +11,4 @@ const Plugin = {
1111
}
1212

1313
export default Plugin
14+
export { VueBotUI }

0 commit comments

Comments
 (0)