vue-sonner
Advanced tools
Comparing version 0.3.1 to 0.3.2
var me = Object.defineProperty; | ||
var pe = (t, e, s) => e in t ? me(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s; | ||
var b = (t, e, s) => (pe(t, typeof e != "symbol" ? e + "" : e, s), s); | ||
import "./assets/index.8b5e0269.css"; | ||
import "./assets/index.a4db810a.css"; | ||
import { defineComponent as j, openBlock as l, createElementBlock as f, createElementVNode as B, Fragment as L, renderList as ne, unref as r, ref as c, computed as p, onMounted as Z, watchEffect as R, onUnmounted as ae, normalizeClass as oe, normalizeStyle as ee, createVNode as he, createCommentVNode as w, createBlock as F, createTextVNode as ie, toDisplayString as U, resolveDynamicComponent as ye, useAttrs as ge } from "vue"; | ||
@@ -6,0 +6,0 @@ let H = 0; |
{ | ||
"name": "vue-sonner", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "author": "xiaoluoboding <xiaoluoboding@gmail.com>", |
@@ -28,2 +28,4 @@ # Sonner for Vue | ||
### For Vue 3 | ||
```html | ||
@@ -33,11 +35,3 @@ <!-- App.vue --> | ||
<Toaster /> | ||
<button | ||
@click=" | ||
() => { | ||
toast('My first toast') | ||
} | ||
" | ||
> | ||
Render a toast | ||
</button> | ||
<button @click="() => toast('My first toast')">Render a toast</button> | ||
</template> | ||
@@ -50,2 +44,67 @@ | ||
### For Nuxt 3 | ||
Define a nuxt plugin | ||
```ts | ||
// plugins/sonner.client.ts | ||
import { Toaster, toast } from 'vue-sonner' | ||
export default defineNuxtPlugin((nuxtApp) => { | ||
nuxtApp.vueApp.component('Toaster', Toaster) | ||
return { | ||
provide: { | ||
toast | ||
} | ||
} | ||
}) | ||
``` | ||
Use `Toaster` component and `$toast` function anywhere in the Vue SFC | ||
```html | ||
<!-- app.vue --> | ||
<template> | ||
<div> | ||
<NuxtPage /> | ||
<Toaster position="top-right" /> | ||
<button @click="() => $toast('My first toast')">Render a toast</button> | ||
</div> | ||
</template> | ||
<script setup lang="ts"> | ||
// alternatively, you can also use it here | ||
const { $toast } = useNuxtApp() | ||
</script> | ||
``` | ||
Add the build transpile for `vue-sonner` | ||
```ts | ||
// nuxt.config.ts | ||
import { defineNuxtConfig } from 'nuxt/config' | ||
export default defineNuxtConfig({ | ||
... | ||
build: { | ||
transpile: ['vue-sonner'] | ||
} | ||
}) | ||
``` | ||
### CDN Link | ||
**EMS version** | ||
```ts | ||
https://cdn.jsdelivr.net/npm/vue-sonner/+esm | ||
``` | ||
**UMD version** | ||
```ts | ||
https://www.unpkg.com/vue-sonner@0.3.1/lib/vue-sonner.umd.cjs | ||
``` | ||
## Types | ||
@@ -52,0 +111,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
233171
810
342