前端 uni-app 重写: 9页面 H5

This commit is contained in:
zhiqui
2026-11-15 15:09:37 +08:00
parent 513b53672e
commit ea7c2529e9
24104 changed files with 3667749 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
var each = require('./each');
var ucs2 = require('./ucs2');
var map = require('./map');
var utf8 = require('./utf8');
exports = function(str) {
try {
return decodeURIComponent(str);
} catch (e) {
var matches = str.match(regMatcher);
if (!matches) {
return str;
}
each(matches, function(match) {
str = str.replace(match, decode(match));
});
return str;
}
};
function decode(str) {
str = str.split('%').slice(1);
var bytes = map(str, hexToInt);
str = ucs2.encode(bytes);
str = utf8.decode(str, true);
return str;
}
function hexToInt(numStr) {
return +('0x' + numStr);
}
var regMatcher = /(%[a-f0-9]{2})+/gi;
module.exports = exports;