99re热视频这里只精品,久久久天堂国产精品女人,国产av一区二区三区,久久久精品成人免费看片,99久久精品免费看国产一区二区三区

Vant Notify 消息提示

2022-05-31 13:33 更新

引入

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

Vue.use(Notify);

代碼演示

基礎(chǔ)用法

Notify('通知內(nèi)容');

通知類型

支持primary、success、warning、danger四種通知類型,默認(rèn)為danger

// 主要通知
Notify({ type: 'primary', message: '通知內(nèi)容' });

// 成功通知
Notify({ type: 'success', message: '通知內(nèi)容' });

// 危險(xiǎn)通知
Notify({ type: 'danger', message: '通知內(nèi)容' });

// 警告通知
Notify({ type: 'warning', message: '通知內(nèi)容' });

自定義通知

自定義消息通知的顏色和展示時(shí)長

Notify({
  message: '自定義顏色',
  color: '#ad0000',
  background: '#ffe1e1'
});

Notify({
  message: '自定義時(shí)長',
  duration: 1000
});

組件內(nèi)調(diào)用

引入 Notify 組件后,會(huì)自動(dòng)在 Vue 的 prototype 上掛載 $notify 方法,便于在組件內(nèi)調(diào)用。

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

API

方法

方法名說明參數(shù)返回值
Notify展示提示options | messagenotify 實(shí)例
Notify.clear關(guān)閉提示-void
Notify.setDefaultOptions修改默認(rèn)配置,對(duì)所有 Notify 生效optionsvoid
Notify.resetDefaultOptions重置默認(rèn)配置,對(duì)所有 Notify 生效-void

Options

參數(shù)說明類型默認(rèn)值
type v2.1.6類型,可選值為 primary success warningstringdanger
message展示文案,支持通過\n換行string-
duration展示時(shí)長(ms),值為 0 時(shí),notify 不會(huì)消失number | string3000
color字體顏色stringwhite
background背景顏色string-
className自定義類名any-
onClick點(diǎn)擊時(shí)的回調(diào)函數(shù)Function-
onOpened完全展示后的回調(diào)函數(shù)Function-
onClose關(guān)閉時(shí)的回調(diào)函數(shù)Function-


實(shí)例演示

以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)