@rovahub/vue-zalo-chat-widget
Version:
This Vue2 plugin injects a Zalo OA widget chat instance into all of your vue instances
86 lines (63 loc) • 1.92 kB
Markdown
<p align="left">
<img src="https://raw.githubusercontent.com/rovahub/vue-zalo-chat-widget/master/images/zalo.svg" alt="Zalo logo">
</p>
[](https://npmjs.com/package/%40rovahub%2Fvue-zalo-chat-widget)
[](https://npmjs.com/package/%40rovahub%2Fvue-zalo-chat-widget)
This Vue2 plugin injects a Zalo OA chat widget chat instance into all of your vue instances
``` bash
npm install @rovahub/vue-zalo-chat-widget --save
yarn add @rovahub/vue-zalo-chat-widget
```
Import the @rovahub/vue-zalo-chat-widget in your main JavaScript file in src/ folder. The Zalo OA ID will be found on your Zalo Dashboard.
```bash
// main.js
import Vue from "vue";
import App from "./App.vue";
import ZaloChatWidgetPlugin from "@rovahub/vue-zalo-chat-widget";
Vue.config.productionTip = false;
Vue.use(ZaloChatWidgetPlugin, {
oaid: "zalo_oa_id"
});
new Vue({
render: h => h(App)
}).$mount("#app");
```
Create JS file in /plugins/ folder and add content to the plugin file.
```bash
import Vue from 'vue';
import ZaloChatWidgetPlugin from "@rovahub/vue-zalo-chat-widget";
Vue.use(ZaloChatWidgetPlugin, {
oaid: "zalo_oa_id"
});
```
In your nuxt.config.js file, add the plugin to the plugins array:
```bash
module.exports = {
// ...
plugins: [
{ src: "~/plugins/zalo-widget.js", mode: "client" }
],
// ...
}
```
You can provide additional options to customize the Zalo Chat Widget:
```bash
Vue.use(ZaloChatWidgetPlugin, {
oaid: "zalo_oa_id",
welcomeMessage: "Rất vui khi được hỗ trợ bạn!",
autopopup: "0",
width: "300",
height: "300"
});
```