zoukankan      html  css  js  c++  java
  • LayUI 使用公共枚举

    1 创建公共枚举 enumFunction.js

    /**
     * 逾期状态 0未逾期 1已逾期
     */
    function overdueStatus(d) {
        if(d ===null || d === '' ){
            return null;
        }
        else if(d === 0)
            return "未逾期";
        else if( d ===1){
            return "已逾期";
        } else {
            return "不存在的类型"
        }
    }
    

    2 在html 中引入枚举 purchaseRepayFlowList.html

    <script th:src="@{/modules/enumFunction.js}"></script>
    <script>
        layui.config({
            base: '/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
            ,purchaseRepayFlowList: '/repayment/purchaseRepayFlowList'
        }).use(['index','purchaseRepayFlowList']);
    </script>
    

    3 在模块中使用枚举 purchaseRepayFlowList.js

    , {field: 'overdueStatus', title: '逾期状态', align: 'center', minWidth: 100,
       templet: function (d) {return overdueStatus(d.overdueStatus);}}
    通过知识/经验的分享,节省开发者的时间.
  • 相关阅读:
    LeetCode
    已知二叉树的先序遍历和中序遍历序列求后序遍历序列
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    TCP协议的基本规则和在Java中的使用
    Java中UDP协议的基本原理和简单用法
    LeetCode
  • 原文地址:https://www.cnblogs.com/ysloong/p/14327204.html
Copyright © 2011-2022 走看看