An open API service indexing awesome lists of open source software.

https://github.com/ospoon/toastcomponent


https://github.com/ospoon/toastcomponent

Last synced: 2 months ago
JSON representation

Awesome Lists containing this project

README

          

# 94Toast

## 安装

```bash
npm i 94-toast
```

## 导入

```bash
// main.ts

import '94-toast/style.css'
import { ToastPlugin } from '94-toast';

const app = createApp(App);
app.use(ToastPlugin);
app.mount('#app');
```

## 使用

```typescript

export default {
name: "App",
methods: {
toast() {
this.$toast.show('Hello Vuejs')
}
}
}

```

```typescript

import { getCurrentInstance } from 'vue';
const global = getCurrentInstance()?.appContext.config.globalProperties;

const toast = () => {
global?.$toast.show('Hello Vuejs')
}

```

```typescript

import { defineComponent, getCurrentInstance } from 'vue';
export default defineComponent({
name: "App",
setup() {

const global = getCurrentInstance()?.appContext.config.globalProperties;

const toast = () => {
global?.$toast.show('Hello Vuejs')
}

return {
toast,
}
}
})

```