How to use the layui.mobile function in layui

To help you get started, we’ve selected a few layui examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RAOE / show-videos / scetc-show-videos-admin / src / main / resources / static / js / layui.js View on Github external
}());
      }
    }
    
    //回调
    function onCallback(){
      exports.push(layui[item]);
      apps.length > 1 ?
        that.use(apps.slice(1), callback, exports)
      : ( typeof callback === 'function' && callback.apply(layui, exports) );
    }
    
    //如果使用了 layui.all.js
    if(apps.length === 0 
    || (layui['layui.all'] && modules[item]) 
    || (!layui['layui.all'] && layui['layui.mobile'] && modules[item])
    ){
      return onCallback(), that;
    }

    //首次加载模块
    if(!config.modules[item]){
      var node = doc.createElement('script')
      
      //如果是内置模块,则按照 dir 参数拼接模块路径
      //如果是扩展模块,则判断模块路径值是否为 {!} 开头,
      //  如果路径值是 {/} 开头,则模块路径即为后面紧跟的字符。
      //  否则,则按照 base 参数拼接模块路径
      ,url = ( modules[item] ? (dir + 'lay/') 
        : (/^\{\/\}/.test(that.modules[item]) ? '' : (config.base || ''))
      ) + (that.modules[item] || item) + '.js';
github weizhiqiang1995 / skyeye / skyeye-promote / src / main / resources / template / assets / lib / layui / layui.js View on Github external
}());
			}
		}

		// 回调
		function onCallback() {
			exports.push(layui[item]);
			apps.length > 1 ?
				that.use(apps.slice(1), callback, exports) :
				(typeof callback === 'function' && callback.apply(layui, exports));
		}

		// 如果使用了 layui.all.js
		if(apps.length === 0 ||
			(layui['layui.all'] && modules[item]) ||
			(!layui['layui.all'] && layui['layui.mobile'] && modules[item])
		) {
			return onCallback(), that;
		}

		// 首次加载模块
		if(!config.modules[item]) {
			var node = doc.createElement('script'),
				// 如果是内置模块,则按照 dir 参数拼接模块路径
				// 如果是扩展模块,则判断模块路径值是否为 {/} 开头,
				// 如果路径值是 {/} 开头,则模块路径即为后面紧跟的字符。
				// 否则,则按照 base 参数拼接模块路径
				url = (modules[item] ? (dir + 'lay/') :
					(/^\{\/\}/.test(that.modules[item]) ? '' : (config.base || ''))
				) + (that.modules[item] || item) + '.js';
			url = url.replace(/^\{\/\}/, '');
			//判断URL拼接可访问路径
github nabaonan / layui-operating / frame / layui / layui.js View on Github external
if(item === 'jquery'){
        apps.splice(index, 1);
      }
    });
    layui.jquery = jQuery;
  }

  var item = apps[0], timeout = 0;
  exports = exports || [];

  //静态资源host
  config.host = config.host || (dir.match(/\/\/([\s\S]+?)\//)||['//'+ location.host +'/'])[0];

  if(apps.length === 0
  || (layui['layui.all'] && modules[item])
  || (!layui['layui.all'] && layui['layui.mobile'] && modules[item])
  ){
    return onCallback(), that;
  }

  //加载完毕
  function onScriptLoad(e, url){
    var readyRegExp = navigator.platform === 'PLaySTATION 3' ? /^complete$/ : /^(complete|loaded)$/
    if (e.type === 'load' || (readyRegExp.test((e.currentTarget || e.srcElement).readyState))) {
      config.modules[item] = url;
      head.removeChild(node);
      (function poll() {
        if(++timeout > config.timeout * 1000 / 4){
          return error(item + ' is not a valid module');
        };
        config.status[item] ? onCallback() : setTimeout(poll, 4);
      }());
github flyhero / flyapi / flyapi-web / src / main / webapp / static / layui / layui.js View on Github external
}());
      }
    }
    
    //回调
    function onCallback(){
      exports.push(layui[item]);
      apps.length > 1 ?
        that.use(apps.slice(1), callback, exports)
      : ( typeof callback === 'function' && callback.apply(layui, exports) );
    }
    
    //如果使用了 layui.all.js
    if(apps.length === 0 
    || (layui['layui.all'] && modules[item]) 
    || (!layui['layui.all'] && layui['layui.mobile'] && modules[item])
    ){
      return onCallback(), that;
    }

    //首次加载模块
    if(!config.modules[item]){
      var node = doc.createElement('script')
      
      //如果是内置模块,则按照 dir 参数拼接模块路径
      //如果是扩展模块,则判断模块路径值是否为 {/} 开头,
      //如果路径值是 {/} 开头,则模块路径即为后面紧跟的字符。
      //否则,则按照 base 参数拼接模块路径
      ,url = ( modules[item] ? (dir + 'lay/') 
        : (/^\{\/\}/.test(that.modules[item]) ? '' : (config.base || ''))
      ) + (that.modules[item] || item) + '.js';
github Joyrocky / DormitoryManager / web / lib / layui / layui.js View on Github external
n.prototype.cache = o, n.prototype.define = function (e, t) {
        var n = this, r = "function" == typeof e, i = function () {
            var e = function (e, t) {
                layui[e] = t, o.status[e] = !0
            };
            return "function" == typeof t && t(function (n, r) {
                e(n, r), o.callback[n] = function () {
                    t(e)
                }
            }), this
        };
        return r && (t = e, e = []), layui["layui.all"] || !layui["layui.all"] && layui["layui.mobile"] ? i.call(n) : (n.use(e, i), n)
    }, n.prototype.use = function (e, n, l) {
        function s(e, t) {
github yelog / layui-select-multiple / layui / layui.js View on Github external
};
      typeof factory === 'function' && factory(function(app, exports){
        setApp(app, exports);
        config.callback[app] = function(){
          factory(setApp);
        }
      });
      return this;
    };
    
    type && (
      factory = deps,
      deps = []
    );
    
    if(layui['layui.all'] || (!layui['layui.all'] && layui['layui.mobile'])){
      return callback.call(that);
    }

    that.use(deps, callback);
    return that;
  };
github hnzzmsf / layui-formSelects / UI / layui-v2.3.0-rc1 / layui / layui.js View on Github external
};
      typeof factory === 'function' && factory(function(app, exports){
        setApp(app, exports);
        config.callback[app] = function(){
          factory(setApp);
        }
      });
      return this;
    };
    
    type && (
      factory = deps,
      deps = []
    );
    
    if(layui['layui.all'] || (!layui['layui.all'] && layui['layui.mobile'])){
      return callback.call(that);
    }

    that.use(deps, callback);
    return that;
  };
github wenjunzhangp / becatMvc / src / main / webapp / resource / js / layui / layui.js View on Github external
var that = this
  ,type = typeof deps === 'function'
  ,mods = function(){
    typeof callback === 'function' && callback(function(app, exports){
      layui[app] = exports;
      config.status[app] = true;
    });
    return this;
  };
  
  type && (
    callback = deps,
    deps = []
  );
  
  if(layui['layui.all'] || (!layui['layui.all'] && layui['layui.mobile'])){
    return mods.call(that);
  }
  
  that.use(deps, mods);
  return that;
};
github RAOE / show-videos / scetc-show-videos-admin / src / main / resources / static / js / layui.js View on Github external
var that = this
    ,type = typeof deps === 'function'
    ,mods = function(){
      typeof callback === 'function' && callback(function(app, exports){
        layui[app] = exports;
        config.status[app] = true;
      });
      return this;
    };
    
    type && (
      callback = deps,
      deps = []
    );
    
    if(layui['layui.all'] || (!layui['layui.all'] && layui['layui.mobile'])){
      return mods.call(that);
    }
    
    that.use(deps, mods);
    return that;
  };

layui

Classic modular Front-End UI library

MIT
Latest version published 1 day ago

Package Health Score

92 / 100
Full package analysis

Popular layui functions