文本輸入框、文本域擴展工具條,支持輸入字數統計、最大字數 maxlength 顯示、復制輸入框文本、重置和清空輸入框內容??墒掌鸹蛘归_(kāi)工具條、自定義工具條按鈕和按鈕順序等。
layui.config({ base: 'js/modules/' }).extend({
numinput: 'textool/textool.min'
}).use(['form', 'textool'], function() {
var $ = layui.$, form = layui.form, textool = layui.textool;
textool.init({
// 根據元素 id 值單獨渲染,為空默認根據 class='layext-text-tool' 批量渲染
eleId: null,
// 批量設置輸入框最大長(cháng)度,可結合 eleId 單獨設置最大長(cháng)度
maxlength: -1,
// 初始化回調,無(wú)參
initEnd: $.noop,
// 顯示回調,參數為當前輸入框和工具條面板的 jQuery 對象
showEnd: $.noop,
// 隱藏回調,參數為當前輸入框和工具條面板的 jQuery 對象
hideEnd: $.noop,
// 初始化展開(kāi),默認展開(kāi),否則收起
initShow: true,
// 啟用指定工具模塊,默認依次為字數統計、復制內容、重置內容、清空內容,按數組順序顯示
tools: ['count', 'copy', 'reset', 'clear'],
// 工具按鈕提示類(lèi)型,默認為 'title' 屬性,可選 'laytips',使用 layer 組件的吸附提示, 其他值不顯示提示
tipType: 'title',
// 吸附提示背景顏色
tipColor: '#01AAED',
// 對齊方向,默認右對齊,可選左對齊 'left'
align: 'right',
// 工具條字體顏色
color: '#666666',
// 工具條背景顏色
bgColor: '#FFFFFF',
// 工具條邊框顏色
borderColor: '#E6E6E6',
// 工具條附加樣式類(lèi)名
className: '',
// z-index
zIndex: 19891014
});
});