先看下演示效果:

Vue提示框组件vue-notification使用详解

安装方法:
通过 npm install vue-notification 就能使用了。

导入方法:

import Notifications from 'vue-notification';

Vue.use(Notifications);

引用方法:

this.$notify({
  type: 'success',
  title: '提示:',
  text: '参数保存成功!'
});

并且需要在 App.vue 里加入 <notifications position="top right" duration=4 />
其中 duration 参数为持续时间。
position 参数为提示位置,前面的值为纵向的顶部 top 和底部 bottom,后面的值为横向的左 left、中 center、右 right
觉得 top 太靠上的话,
可以加个 css 调整下位置。

/* 设置提示框显示位置 */
.vue-notification-group{
  top: 10% !important;
}

更多参数:

Vue提示框组件vue-notification使用详解

原文地址:https://blog.csdn.net/qq_38161040/article/details/129658661

相关文章:

  • 2022-12-23
  • 2021-08-15
  • 2021-04-04
  • 2022-12-23
  • 2021-05-16
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2023-03-09
  • 2021-12-17
  • 2022-12-23
相关资源
相似解决方案