无限星辰工作室-客户无限互联网动力之源

标题: Mui v3.7.2 "Uncaught Error: 元素背景颜色必须为RGBA" BUG解决方法 [打印本页]

作者: crx349    时间: 2018-7-21 23:52
标题: Mui v3.7.2 "Uncaught Error: 元素背景颜色必须为RGBA" BUG解决方法
BUG错误信息
[Web浏览器] "Uncaught Error: 元素背景颜色必须为RGBA"        /js/mui.js (8089)

解决方法:改mui.js
搜索
  1. var rgbaRegex = /^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d*(?:\.\d+)?)\)$/;
  2.     var getColor = function(colorStr) {
  3.         var matches = colorStr.match(rgbaRegex);
  4.         if (matches && matches.length === 5) {
  5.             return [
  6.                 matches[1],
  7.                 matches[2],
  8.                 matches[3],
  9.                 matches[4]
  10.             ];
  11.         }
复制代码

改为:

  1. var rgbaRegex = /^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d*(?:\.\d+)?)\)$/;
  2.     var rgbRegex = /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/;
  3.     var getColor = function(colorStr) {
  4.         var matches = colorStr.match(rgbaRegex);
  5.          var matches1 = colorStr.match(rgbRegex);
  6.         console.log(matches1);
  7. if (matches && matches.length === 5) {
  8.             return [
  9.                 matches[1],
  10.                 matches[2],
  11.                 matches[3],
  12.                 matches[4]
  13.             ];
  14.         } else if(matches1 && matches1.length === 4) {
  15.                 return [
  16.                     matches1[1],
  17.                 matches1[2],
  18.                 matches1[3],
  19.                 1.0
  20.                 ];
  21.         }
  22.         return [];
  23.     };
复制代码


错误解决




欢迎光临 无限星辰工作室-客户无限互联网动力之源 (https://www.xmspace.net/) Powered by Discuz! X3.4