天天看點

提示框alertmsg

初始化:

1、Data屬性:DOM添加屬性data-toggle="alertmsg",并定義type及msg參數

示例代碼:

<button type="button" class="btn-green" data-toggle="alertmsg" data-type="info" data-msg="我是一個資訊提示">我是資訊提示</button>      

集合參數:

<button type="button" class="btn-green" data-toggle="alertmsg" data-options="{type:'error',msg:'你犯錯了'}">我是錯誤資訊</button>      

2、jqueryAPI

<script type="text/javascript">
                           $("#doc-alertmsg-demo").click(function(){
                               $(this).alertmsg('confirm','我是确認提示',{displayPosition:'topcenter',okName:'yes',cancelName:'no',title:'我是确認确認标題'});
                           });
                       </script>
                        <a id="doc-alertmsg-demo">測試提示框</a>      

API調用方法:

$(selector).alertmsg(type,msg,options);

參數(options)

DOM方式初始化datagrid的,推薦使用集合屬性data-options定義參數,如果使用data屬性定義參數,注意轉換成對應的名稱。

名稱 類型 預設值 描述
type string null 【必選】資訊提示方式,參數有【‘ok’|‘correct’|‘info’|‘warn’|‘error’|‘confirm’】,其中ok為correct的别名,confirm為确認提示框
msg 【必選】提示的内容
displayPosition topcenter 【可選】提示框顯示位置,參數有【topleft、topcenter、topright、middleleft、middlecenter、middleright、bottomleft、bottomcenter、bottomright】,本參數可以覆寫全局設定
displayMode slide 【可選】提示框顯示動畫(無動畫、漸顯漸隐、滑動),參數(none、fade、slide),本參數可以覆寫全局設定
autoClose boolean 【可選】是否自動關閉提示框,預設在type為ok、correct、info三種方式時參數值為true
alertTime int 【可選】自動關閉提示框的時間(毫秒),autoClose參數為true時生效,本參數可以覆寫全局設定
mask 【可選】是否模态顯示提示框,預設在type為warn、error、confirm三種方式時參數值為true
title 見bjui-regional.zh-CN.js中alertmsg [可選]資訊提示框的标題,設定本參數将會覆寫bjui-regional.zh-CN.js中alertmsg的對應設定
okName 确定 【可選】确定按鈕的名稱,設定本參數将會覆寫bjui-regional.zh-CN.js中alertmsg的對應設定
cancelName 取消
okCall function() [可選]确認按鈕的回調方法,支援字元串類型的方法名,該方法會在提示框關閉後調用
cancelCall [可選]僅type為confirm時有效 取消按鈕的回調方法,支援字元串類型的方法名,該方法會在提示框關閉後被調用