This commit is contained in:
2023-08-11 10:45:20 +08:00
commit 161ca982f3
31850 changed files with 2706500 additions and 0 deletions

44
node_modules/vant/lib/utils/create/bem.js generated vendored Normal file
View File

@ -0,0 +1,44 @@
"use strict";
exports.__esModule = true;
exports.createBEM = createBEM;
/**
* bem helper
* b() // 'button'
* b('text') // 'button__text'
* b({ disabled }) // 'button button--disabled'
* b('text', { disabled }) // 'button__text button__text--disabled'
* b(['disabled', 'primary']) // 'button button--disabled button--primary'
*/
function gen(name, mods) {
if (!mods) {
return '';
}
if (typeof mods === 'string') {
return " " + name + "--" + mods;
}
if (Array.isArray(mods)) {
return mods.reduce(function (ret, item) {
return ret + gen(name, item);
}, '');
}
return Object.keys(mods).reduce(function (ret, key) {
return ret + (mods[key] ? gen(name, key) : '');
}, '');
}
function createBEM(name) {
return function (el, mods) {
if (el && typeof el !== 'string') {
mods = el;
el = '';
}
el = el ? name + "__" + el : name;
return "" + el + gen(el, mods);
};
}