@bagelink/sdk
v0.0.1006
Published
Bagel core sdk packages
Downloads
4,454
Readme
@bagelink/vue
Features:
Usage
Use component globally
// src/main.ts
import { createApp } from 'vue';
import { BagelVue } from '@bagel/vue';
import App from './App.vue';
const BagelConfig = {
host: import.meta.env.VITE_BAGEL_BASE_URL,
onError: (err: any) => {
// handle error
// example:
// useToast().error(`${$t('anErrorOccurred')}: ${err?.response?.data?.detail || err.message}`);
},
};
const app = createApp(App);
app.use(head as Plugin);
app.mount('#app');
Import component
<script setup lang="ts">
import { useBagel } from '@bagel/vue';
const bagel = useBagel();
</script>
<!-- OR -->
<script lang="ts">
export default defineComponent({
onMounted() {
console.log(this.$bagel.host)
},
});
</script>
<!-- OR -->
<template>
<div>
{{ $bagel.host }}
</div>
</template>
License
MIT