iview Message(全局提示)与Notice(通知提醒)

2017-11-07  本文已影响0人  vueLover

在使用iview 的Message与Notice组件时,可以对提示框的显示位置与显示时长进行配置。

iview提供了两个配置属性。分别是:

可以对这两个组件进行全局配置:

//在某个组件中全局配置,只需要在mouted()钩子函数中写入
mounted() {
    this.$Message.config({
      top: 100,
      duration: 3
  });
    this.$Notice.config({
      top: 100,
      duration: 3
    });
}
//在整个项目中全局配置,需要在main.js中写入

Vue.prototype.$Message.config({
    top: 100,
    duration: 3
});
Vue.prototype.$Notice.config({
    top: 50,
    duration: 3
});
上一篇 下一篇

猜你喜欢

热点阅读