https://github.com/ospoon/toastcomponent
https://github.com/ospoon/toastcomponent
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ospoon/toastcomponent
- Owner: OSpoon
- Created: 2023-04-28T01:22:15.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-04-28T01:27:06.000Z (about 3 years ago)
- Last Synced: 2025-01-26T01:32:21.892Z (over 1 year ago)
- Language: Vue
- Size: 30.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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,
}
}
})
```