向用户显示通知的重要性众所周知。通知向用户提供有关其操作成功或失败的即时反馈,使用户体验更加直观。 vue–toast–notification 插件简化了在 Vue.js 应用……
向用户显示通知的重要性众所周知。通知向用户提供有关其操作成功或失败的即时反馈,使用户体验更加直观。
vue–toast–notification 插件简化了在 Vue.js 应用中显示通知的过程。它提供了一个易于使用且高度可定制的通知系统,可以快速集成到项目中。
安装
npm install vue-toast-notification@^3.0
用法
import {createApp} from 'vue';
import ToastPlugin from 'vue-toast-notification';
// Import one of the available themes
//import 'vue-toast-notification/dist/theme-default.css';
import 'vue-toast-notification/dist/theme-sugar.css';
const app = createApp({});
app.use(ToastPlugin);
app.mount('#app');
let instance = app.$toast.open('You did it!');
// Force dismiss specific toast
instance.dismiss();
// Dismiss all opened toast immediately
app.$toast.clear();
app.$toast.open('Howdy!');
// Can accept an Object of options
app.$toast.open({
message: 'Something went wrong!',
type: 'error',
// all of other options may go here
});
插件地址:https://github.com/ankurk91/vue-toast-notification
还没有评论呢,快来抢沙发~