js中命名空间模式下js方法声明的两个写法

第一种写法
var OKK = {}
OKK.Dia = {
    abc: function () {
        alert('abc');
    }
}
调用方式:OKK.Dia.abc();

第二种写法

function Test() { }
Test.Fn = function () {

}
Test.Fn.Loading = function () {
    this.AA = function () {

        alert($('body').height());
    }
    return this;
}

调用方式Test.Fn.Loading().AA();

本文使用Blog_Backup未注册版本导出,请到soft.pt42.com注册。

原文地址:https://www.cnblogs.com/zjypp/p/2319281.html