You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
879 B
36 lines
879 B
4 years ago
|
/**
|
||
|
* mui namespace(optimization)
|
||
|
* @param {type} $
|
||
|
* @returns {undefined}
|
||
|
*/
|
||
|
(function($) {
|
||
|
$.namespace = 'mui';
|
||
|
$.classNamePrefix = $.namespace + '-';
|
||
|
$.classSelectorPrefix = '.' + $.classNamePrefix;
|
||
|
/**
|
||
|
* 返回正确的className
|
||
|
* @param {type} className
|
||
|
* @returns {String}
|
||
|
*/
|
||
|
$.className = function(className) {
|
||
|
return $.classNamePrefix + className;
|
||
|
};
|
||
|
/**
|
||
|
* 返回正确的classSelector
|
||
|
* @param {type} classSelector
|
||
|
* @returns {String}
|
||
|
*/
|
||
|
$.classSelector = function(classSelector) {
|
||
|
return classSelector.replace(/\./g, $.classSelectorPrefix);
|
||
|
};
|
||
|
/**
|
||
|
* 返回正确的eventName
|
||
|
* @param {type} event
|
||
|
* @param {type} module
|
||
|
* @returns {String}
|
||
|
*/
|
||
|
$.eventName = function(event, module) {
|
||
|
return event + ($.namespace ? ('.' + $.namespace) : '') + ( module ? ('.' + module) : '');
|
||
|
};
|
||
|
})(mui);
|