您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

Vant Notify 消息提示

Vant Notify 消息是通过顶栏下拉进行消息推送的组件。

import Vue from 'vue';
import { Notify } from 'vant';

Vue.use(Notify);
Notify('');

primary、success、warning、danger四种类型,认为danger

// 主要
Notify({ type: 'primary', message: '' });

// 成功
Notify({ type: 'success', message: '' });

// 危险
Notify({ type: 'danger', message: '' });

// 警告
Notify({ type: 'warning', message: '' });

消息的颜色和展示时长

Notify({
  message: '颜色',
  color: '#ad0000',
  background: '#ffe1e1'
});

Notify({
  message: '时长',
  duration: 1000
});

引入 Notify 组件后,会在 Vue 的 prototype 上挂载 $notify ,便于在组件内。

export default {
  mounted() {
    this.$notify('文案');
  }
}

API

演示


联系我
置顶