文本輸入框、文本域擴(kuò)展工具條,支持輸入字?jǐn)?shù)統(tǒng)計(jì)、最大字?jǐn)?shù) maxlength 顯示、復(fù)制輸入框文本、重置和清空輸入框內(nè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({
    // 根據(jù)元素 id 值單獨(dú)渲染,為空默認(rèn)根據(jù) class='layext-text-tool' 批量渲染
    eleId: null,
    // 批量設(shè)置輸入框最大長度,可結(jié)合 eleId 單獨(dú)設(shè)置最大長度
    maxlength: -1,
    // 初始化回調(diào),無參
    initEnd: $.noop,
    // 顯示回調(diào),參數(shù)為當(dāng)前輸入框和工具條面板的 jQuery 對象
    showEnd: $.noop,
    // 隱藏回調(diào),參數(shù)為當(dāng)前輸入框和工具條面板的 jQuery 對象
    hideEnd: $.noop,
    // 初始化展開,默認(rèn)展開,否則收起
    initShow: true,
    // 啟用指定工具模塊,默認(rèn)依次為字?jǐn)?shù)統(tǒng)計(jì)、復(fù)制內(nèi)容、重置內(nèi)容、清空內(nèi)容,按數(shù)組順序顯示
    tools: ['count', 'copy', 'reset', 'clear'],
    // 工具按鈕提示類型,默認(rèn)為 'title' 屬性,可選 'laytips',使用 layer 組件的吸附提示, 其他值不顯示提示
    tipType: 'title',
    // 吸附提示背景顏色
    tipColor: '#01AAED',
    // 對齊方向,默認(rèn)右對齊,可選左對齊 'left'
    align: 'right',
    // 工具條字體顏色
    color: '#666666',
    // 工具條背景顏色
    bgColor: '#FFFFFF',
    // 工具條邊框顏色
    borderColor: '#E6E6E6',
    // 工具條附加樣式類名
    className: '',
    // z-index
    zIndex: 19891014
  });
});