@homebaseai/vue3-intercom
v2.0.2
Published
An Intercom plugin for Vue.js 3
Downloads
4,681
Maintainers
Readme
vue3-intercom
npm i @homebaseai/vue3-intercom
Usage
Apply the plugin via app.use
.
import { createApp } from 'vue'
import VueIntercom from '@homebaseai/vue3-intercom';
import App from '@/App.vue';
const app = createApp(App);
app.use(VueIntercom);
app.mount('#app');
Composition API
<script setup lang="ts">
import { useIntercom } from '@homebaseai/vue3-intercom';
const intercom = useIntercom();
// init intercom
intercom.boot({
app_id: import.meta.env.VITE_APP_INTERCOM_TOKEN,
user_id: 1,
name: 'John Doe',
email: '[email protected]',
});
// display it
intercom.show();
</script>
Options API
<script lang="ts">
import { useIntercom } from '@homebaseai/vue3-intercom';
export default {
setup() {
return {
intercom: useIntercom(),
}
},
data() {
return {
userId: 1,
name: 'John Doe',
email: '[email protected]',
}
},
mounted() {
// init intercom
intercom.boot({
app_id: import.meta.env.VITE_APP_INTERCOM_TOKEN,
user_id: this.userId,
name: this.name,
email: this.email,
});
// display it
intercom.show();
}
}