js_ryl 1.0.24 → 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -10
- package/dist/build.js +1 -1
- package/package.json +1 -1
- package/src/App.vue +28 -12
- package/src/highLight/index.js +11 -0
- package/src/index.js +4 -1
- package/src/reg/index.js +60 -48
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
9.table中的数据补全方法 -- filterTable
|
|
20
20
|
10.获取当前年份中,指定月份的天数 -- getMonthDays
|
|
21
21
|
11.unicode转化emoji表情 -- emoji
|
|
22
|
+
12.根据输入内容,高亮匹配对应的字符串 -- highLight
|
|
22
23
|
|
|
23
24
|
# 使用方法:
|
|
24
25
|
|
|
@@ -32,14 +33,12 @@
|
|
|
32
33
|
Money() #金额
|
|
33
34
|
|
|
34
35
|
# 使用方法
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
console.log("错误",reg.Phone(this.phone, "空手机", "手机唧唧了")); -- 自定义错误内容, 基本不用
|
|
42
|
-
}
|
|
36
|
+
# 第一个参数是值,第二个参数(提示输入,可不填),三个参数(错误后的提示,可不填),第二三个参数有默认值
|
|
37
|
+
reg.Phone(this.name,'请输入...','完犊子').then(()=>{
|
|
38
|
+
console.log('成功')
|
|
39
|
+
}).catch(e=>{
|
|
40
|
+
console.log(e)
|
|
41
|
+
})
|
|
43
42
|
|
|
44
43
|
|
|
45
44
|
#2.时间戳与时间的转化 -- time
|
|
@@ -166,8 +165,16 @@
|
|
|
166
165
|
#11.unicode转化emoji表情,如果不符合emoji的要求,则转化为字符,如果还不符合,则输出原unicode
|
|
167
166
|
|
|
168
167
|
# 方法:
|
|
169
|
-
# emoji()
|
|
168
|
+
# emoji(str)
|
|
170
169
|
|
|
170
|
+
#12.根据输入内容,高亮匹配对应的字符串
|
|
171
|
+
|
|
172
|
+
# 方法:
|
|
173
|
+
# 3个参数
|
|
174
|
+
# 第一个匹配的值,第二个需要匹配的内容,第三个为匹配后的类名
|
|
175
|
+
# 如:<div v-html="setHighLight(name,highLightContent,'initHightLightClassName')"></div>
|
|
176
|
+
# 引入 highLight.js
|
|
177
|
+
# setHighLight:highLight,
|
|
171
178
|
|
|
172
179
|
|
|
173
180
|
# serve with hot reload at localhost:8080
|
|
@@ -189,7 +196,7 @@
|
|
|
189
196
|
#1.0.19: 验证手机号码 优化
|
|
190
197
|
#1.0.21: number精度问题优化
|
|
191
198
|
#1.0.22: 数据补全方法优化
|
|
192
|
-
#1.0.
|
|
199
|
+
#1.0.25: 新增了emoji,highLight方法(还没上传)
|
|
193
200
|
```
|
|
194
201
|
|
|
195
202
|
For detailed explanation on how things work, consult the [docs for vue-loader](http://vuejs.github.io/vue-loader).
|
package/dist/build.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("js_ryl",[],e):"object"==typeof exports?exports.js_ryl=e():t.js_ryl=e()}("undefined"!=typeof self?self:this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=0)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),o=n(2),i=n(3),a=n(4),u=n(5),c=n(6),l=n(7),s=n(8),f=n(9),d=n(10),v=n(11);e.default={reg:r.a,time:o.a,cookie:i.a,fun:a.a,num:u.a,copy:c.a,deepCopy:l.a,verCode:s.a,filterTable:f.a,getMonthDays:d.a,emoji:v.a}},function(t,e,n){"use strict";var r={Phone:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"请输入手机号码",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"手机号码格式有误",r=/^[1][3,4,5,6,7,8,9][0-9]{9}$/;return t?!!r.test(t)||n:e},Email:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"请输入邮箱",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"邮箱格式有误",r=/^([0-9A-Za-z\-_\.]+)@([0-9a-z]+\.[a-z]{2,3}(\.[a-z]{2})?)$/g;return t?!!r.test(t)||n:e},IdCard:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"请输入身份证号码",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"身份证号码格式有误",r=/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;return t?!!r.test(t)||n:e},Common:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"请输入包含数字、字母以及下划线的内容",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"只能包含数字、字母以及下划线",r=/^[a-zA-Z0-9_]+$/;return t?!!r.test(t)||n:e},QQ:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"请输入QQ号码",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"QQ号码格式错误",r=/^[1-9][0-9]{4,10}$/gim;return t?!!r.test(t)||n:e},Money:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"请输入金额(最多保留2位小数点)",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"金额格式错误",r=/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;return t?!!r.test(t)||n:e}};e.a=r},function(t,e,n){"use strict";function r(t){return t<10?"0"+t:t}var o={toDate:function(t,e){var n="";n=10==String(t).length?new Date(1e3*t):new Date(t);var o=n.getFullYear(),i=n.getMonth()+1,a=n.getDate(),u=n.getHours(),c=n.getMinutes(),l=n.getSeconds();return"yyyy-MM-dd"==e?o+"-"+r(i)+"-"+r(a):"yyyy-MM-dd HH:mm"==e?o+"-"+r(i)+"-"+r(a)+" "+r(u)+":"+r(c):o+"-"+r(i)+"-"+r(a)+" "+r(u)+":"+r(c)+":"+r(l)},toStamp:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,n=new Date(t.replace(/-/g,"/")).getTime().toString();return 10==e&&(n=n.substr(0,10)),parseInt(n)},getNow:function(){var t=(new Date).getTime();return o.toDate(t)}};e.a=o},function(t,e,n){"use strict";var r={set:function(t,e,n){n=n||{};var r=n.path?";Path="+n.path:"",o="";if(n.domain&&"domain"==n.domain){o=";domain="+window.location.hostname.split(".").slice(-2).join(".")}var i="";if(n.expires){i=";expires="+(10==String(n.expires).length?new Date(1e3*n.expires):new Date(n.expires)).toGMTString()}document.cookie=t+"="+encodeURIComponent(e)+o+r+i},get:function(t){var e="; "+document.cookie,n=e.split("; "+t+"=");return 2===n.length?decodeURIComponent(n.pop().split(";").shift()):null},remove:function(t,e){e=e||{},e.expires=-1,r.set(t,null,e)}};e.a=r},function(t,e,n){"use strict";var r={throole:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,n=0;return function(){var r=this,o=Date.now();o-n>e&&(t.call(r,arguments),n=o)}},debounce:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,n=null;return function(){var r=arguments,o=this;clearTimeout(n),n=setTimeout(function(){t.apply(o,r)},e)}}};e.a=r},function(t,e,n){"use strict";function r(t){return Math.floor(100*t)===100*t}var o=function(t){var e=0;try{t=Number(t);var n=t.toString().toUpperCase();if(2===n.split("E").length){var r=!1;2===n.split(".").length&&(n=n.split(".")[1],0!==parseInt(n.split("E")[0])&&(r=!0));var o=n.split("E");r&&(e=o[0].length),e-=parseInt(o[1])}else 2===n.split(".").length&&0!==parseInt(n.split(".")[1])&&(e=n.split(".")[1].length)}catch(t){throw t}finally{return(isNaN(e)||e<0)&&(e=0),e}},i=function(t){t=Number(t);var e=o(t),n=t.toString().toUpperCase();return 2===n.split("E").length?Math.round(t*Math.pow(10,e)):Number(n.replace(".",""))},a=function(t,e,n,o){var i=0;switch(t){case"add":i=e+n;break;case"sub":i=e-n;break;case"div":i=e/n;break;case"mul":i=e*n}return Math.abs(o-i)>1?i:(r(o)||(o=Number(o.toFixed(2))),o)},u={NumFilter:function(t){var e=String(t).indexOf(".")+1,n=String(t).length-e;return n>0&&n>=3&&(t=Math.floor(100*t)/100),t},add:function(t,e){t=this.NumFilter(Number(t)),e=this.NumFilter(Number(e));var n,r,i;try{n=o(t)+1}catch(t){n=0}try{r=o(e)+1}catch(t){r=0}i=Math.pow(10,Math.max(n,r));var u=(this.mul(t,i)+this.mul(e,i))/i;return a("add",t,e,u)},sub:function(t,e){t=this.NumFilter(Number(t)),e=this.NumFilter(Number(e));var n,r,i;try{n=o(t)+1}catch(t){n=0}try{r=o(e)+1}catch(t){r=0}i=Math.pow(10,Math.max(n,r));var u=Number((this.mul(t,i)-this.mul(e,i))/i);return a("sub",t,e,u)},div:function(t,e){t=Number(t),e=Number(e);var n,r,u=0,c=0;try{u=o(t)}catch(t){}try{c=o(e)}catch(t){}n=i(t),r=i(e);var l=this.mul(n/r,Math.pow(10,c-u));return a("div",t,e,l)},mul:function(t,e){t=Number(t),e=Number(e);var n=0,r=t.toString(),u=e.toString();try{n+=o(r)}catch(t){}try{n+=o(u)}catch(t){}var c=i(r)*i(u)/Math.pow(10,n);return a("mul",t,e,c)}};e.a=u},function(t,e,n){"use strict";function r(t,e){var n=document.createElement("input");n.setAttribute("readonly","readonly"),n.setAttribute("value",t),document.body.appendChild(n),document.execCommand("copy")?(n.select(),document.execCommand("copy"),e({code:200,msg:"复制成功"})):e({code:100,msg:"当前浏览器不支持,请更换浏览器后重试"}),document.body.removeChild(n)}e.a=r},function(t,e,n){"use strict";function r(t,e){var n=t||{};for(var i in e)"object"===o(e[i])?(n[i]=e[i].constructor===Array?[]:{},r(n[i],e[i])):n[i]=e[i];return n}e.a=r;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t}},function(t,e,n){"use strict";var r=!1,o=null,i="",a=null,u={PhoneCode:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:60,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"后重新获取";if(i=t.target.innerText,a=t,!r){r=!0,t.target.innerText=n-1+"s"+u;var c=n-1;o=setInterval(function(){c--,c<=0?(t.target.innerText=i,e.PhoneCodeClear()):t.target.innerText=c+"s"+u},1e3)}},PhoneCodeClear:function(){r=!1,a&&(a.target.innerText=i),clearInterval(o)},phoneCodeStatus:function(){return r}};e.a=u},function(t,e,n){"use strict";function r(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function o(t){return i.some(function(e){return e===t})}var i=["",void 0,null],a=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"--",n=arguments[2];n&&n.length&&(i=[].concat(r(i),r(n)));var a=[];for(var u in t){for(var c={},l=Object.entries(t[u]),s=0;s<l.length;s++){var f=l[s];o(f[1])&&(f[1]=e),c[f[0]]=f[1]}a.push(c)}return a};e.a=a},function(t,e,n){"use strict";var r=function(t,e){return new Date(t,e,0).getDate()};e.a=r},function(t,e,n){"use strict";function r(t){var e=/U\+([0-9A-Fa-f]{4,6})|\[u\+([0-9A-Fa-f]{4,6})\]|\\u\{([0-9A-Fa-f]{4,6})\}/g;return t?t.replace(e,function(t,e,n,r){var a=e||n||r,u=parseInt(a,16);if(isNaN(u)||u<0||u>1114111)return t;try{var c=String.fromCodePoint(u);return o(u)?c:i(c)?c:t}catch(e){return t}}):t}function o(t){return u.some(function(e){var n=a(e,2),r=n[0],o=n[1];return t>=r&&t<=o})}function i(t){return"�"!==t}e.a=r;var a=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&u.return&&u.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=[[8986,8987],[9193,9196],[9200,9200],[9203,9203],[9642,9643],[9654,9654],[9664,9664],[9723,9726],[9728,9732],[9742,9742],[9745,9745],[9748,9749],[9752,9752],[9757,9757],[9760,9760],[9762,9763],[9766,9766],[9770,9770],[9774,9775],[9784,9786],[9792,9792],[9794,9794],[9800,9811],[9823,9824],[9827,9827],[9829,9830],[9832,9832],[9851,9851],[9855,9855],[9874,9879],[9881,9881],[9883,9884],[9888,9889],[9898,9899],[9904,9905],[9917,9918],[9924,9925],[9928,9928],[9934,9935],[9937,9937],[9939,9940],[9961,9962],[9968,9973],[9975,9978],[9981,9981],[9986,9986],[9989,9989],[9992,9997],[9999,9999],[10002,10002],[10004,10004],[10006,10006],[10013,10013],[10017,10017],[10024,10024],[10035,10036],[10052,10052],[10055,10055],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10083,10084],[10133,10135],[10145,10145],[10160,10160],[10175,10175],[10548,10549],[11013,11015],[11035,11036],[11088,11088],[11093,11093],[126980,126980],[127183,127183],[127344,127345],[127358,127359],[127374,127374],[127377,127386],[127462,127487],[127489,127490],[127514,127514],[127535,127535],[127538,127546],[127568,127569],[127744,128511],[128512,128591],[128640,128767],[128768,128895],[128896,129023],[129024,129279],[129280,129535],[129536,129647],[129648,129791],[129792,130047]]}])});
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("js_ryl",[],e):"object"==typeof exports?exports.js_ryl=e():t.js_ryl=e()}("undefined"!=typeof self?self:this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=0)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),o=n(2),i=n(3),a=n(4),u=n(5),c=n(6),s=n(7),l=n(8),f=n(9),v=n(10),d=n(11),h=n(12);e.default={reg:r.a,time:o.a,cookie:i.a,fun:a.a,num:u.a,copy:c.a,deepCopy:s.a,verCode:l.a,filterTable:f.a,getMonthDays:v.a,emoji:d.a,highLight:h.a}},function(t,e,n){"use strict";var r={Phone:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"请输入手机号码",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"手机号码格式有误";return new Promise(function(r,o){var i=/^[1][3,4,5,6,7,8,9][0-9]{9}$/;t?i.test(t)?r():o(n):o(e)})},Email:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"请输入邮箱",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"邮箱格式有误";return new Promise(function(r,o){var i=/^([0-9A-Za-z\-_\.]+)@([0-9a-z]+\.[a-z]{2,3}(\.[a-z]{2})?)$/g;t?i.test(t)?r():o(n):o(e)})},IdCard:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"请输入身份证号码",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"身份证号码格式有误";return new Promise(function(r,o){var i=/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;t?i.test(t)?r():o(n):o(e)})},Common:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"请输入包含数字、字母以及下划线的内容",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"只能包含数字、字母以及下划线";return new Promise(function(r,o){var i=/^[a-zA-Z0-9_]+$/;t?i.test(t)?r():o(n):o(e)})},QQ:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"请输入QQ号码",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"QQ号码格式错误";return new Promise(function(r,o){var i=/^[1-9][0-9]{4,10}$/gim;t?i.test(t)?r():o(n):o(e)})},Money:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"请输入金额(最多保留2位小数点)",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"金额格式错误";return new Promise(function(r,o){var i=/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;t?i.test(t)?r():o(n):o(e)})}};e.a=r},function(t,e,n){"use strict";function r(t){return t<10?"0"+t:t}var o={toDate:function(t,e){var n="";n=10==String(t).length?new Date(1e3*t):new Date(t);var o=n.getFullYear(),i=n.getMonth()+1,a=n.getDate(),u=n.getHours(),c=n.getMinutes(),s=n.getSeconds();return"yyyy-MM-dd"==e?o+"-"+r(i)+"-"+r(a):"yyyy-MM-dd HH:mm"==e?o+"-"+r(i)+"-"+r(a)+" "+r(u)+":"+r(c):o+"-"+r(i)+"-"+r(a)+" "+r(u)+":"+r(c)+":"+r(s)},toStamp:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,n=new Date(t.replace(/-/g,"/")).getTime().toString();return 10==e&&(n=n.substr(0,10)),parseInt(n)},getNow:function(){var t=(new Date).getTime();return o.toDate(t)}};e.a=o},function(t,e,n){"use strict";var r={set:function(t,e,n){n=n||{};var r=n.path?";Path="+n.path:"",o="";if(n.domain&&"domain"==n.domain){o=";domain="+window.location.hostname.split(".").slice(-2).join(".")}var i="";if(n.expires){i=";expires="+(10==String(n.expires).length?new Date(1e3*n.expires):new Date(n.expires)).toGMTString()}document.cookie=t+"="+encodeURIComponent(e)+o+r+i},get:function(t){var e="; "+document.cookie,n=e.split("; "+t+"=");return 2===n.length?decodeURIComponent(n.pop().split(";").shift()):null},remove:function(t,e){e=e||{},e.expires=-1,r.set(t,null,e)}};e.a=r},function(t,e,n){"use strict";var r={throole:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,n=0;return function(){var r=this,o=Date.now();o-n>e&&(t.call(r,arguments),n=o)}},debounce:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,n=null;return function(){var r=arguments,o=this;clearTimeout(n),n=setTimeout(function(){t.apply(o,r)},e)}}};e.a=r},function(t,e,n){"use strict";function r(t){return Math.floor(100*t)===100*t}var o=function(t){var e=0;try{t=Number(t);var n=t.toString().toUpperCase();if(2===n.split("E").length){var r=!1;2===n.split(".").length&&(n=n.split(".")[1],0!==parseInt(n.split("E")[0])&&(r=!0));var o=n.split("E");r&&(e=o[0].length),e-=parseInt(o[1])}else 2===n.split(".").length&&0!==parseInt(n.split(".")[1])&&(e=n.split(".")[1].length)}catch(t){throw t}finally{return(isNaN(e)||e<0)&&(e=0),e}},i=function(t){t=Number(t);var e=o(t),n=t.toString().toUpperCase();return 2===n.split("E").length?Math.round(t*Math.pow(10,e)):Number(n.replace(".",""))},a=function(t,e,n,o){var i=0;switch(t){case"add":i=e+n;break;case"sub":i=e-n;break;case"div":i=e/n;break;case"mul":i=e*n}return Math.abs(o-i)>1?i:(r(o)||(o=Number(o.toFixed(2))),o)},u={NumFilter:function(t){var e=String(t).indexOf(".")+1,n=String(t).length-e;return n>0&&n>=3&&(t=Math.floor(100*t)/100),t},add:function(t,e){t=this.NumFilter(Number(t)),e=this.NumFilter(Number(e));var n,r,i;try{n=o(t)+1}catch(t){n=0}try{r=o(e)+1}catch(t){r=0}i=Math.pow(10,Math.max(n,r));var u=(this.mul(t,i)+this.mul(e,i))/i;return a("add",t,e,u)},sub:function(t,e){t=this.NumFilter(Number(t)),e=this.NumFilter(Number(e));var n,r,i;try{n=o(t)+1}catch(t){n=0}try{r=o(e)+1}catch(t){r=0}i=Math.pow(10,Math.max(n,r));var u=Number((this.mul(t,i)-this.mul(e,i))/i);return a("sub",t,e,u)},div:function(t,e){t=Number(t),e=Number(e);var n,r,u=0,c=0;try{u=o(t)}catch(t){}try{c=o(e)}catch(t){}n=i(t),r=i(e);var s=this.mul(n/r,Math.pow(10,c-u));return a("div",t,e,s)},mul:function(t,e){t=Number(t),e=Number(e);var n=0,r=t.toString(),u=e.toString();try{n+=o(r)}catch(t){}try{n+=o(u)}catch(t){}var c=i(r)*i(u)/Math.pow(10,n);return a("mul",t,e,c)}};e.a=u},function(t,e,n){"use strict";function r(t,e){var n=document.createElement("input");n.setAttribute("readonly","readonly"),n.setAttribute("value",t),document.body.appendChild(n),document.execCommand("copy")?(n.select(),document.execCommand("copy"),e({code:200,msg:"复制成功"})):e({code:100,msg:"当前浏览器不支持,请更换浏览器后重试"}),document.body.removeChild(n)}e.a=r},function(t,e,n){"use strict";function r(t,e){var n=t||{};for(var i in e)"object"===o(e[i])?(n[i]=e[i].constructor===Array?[]:{},r(n[i],e[i])):n[i]=e[i];return n}e.a=r;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t}},function(t,e,n){"use strict";var r=!1,o=null,i="",a=null,u={PhoneCode:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:60,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"后重新获取";if(i=t.target.innerText,a=t,!r){r=!0,t.target.innerText=n-1+"s"+u;var c=n-1;o=setInterval(function(){c--,c<=0?(t.target.innerText=i,e.PhoneCodeClear()):t.target.innerText=c+"s"+u},1e3)}},PhoneCodeClear:function(){r=!1,a&&(a.target.innerText=i),clearInterval(o)},phoneCodeStatus:function(){return r}};e.a=u},function(t,e,n){"use strict";function r(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function o(t){return i.some(function(e){return e===t})}var i=["",void 0,null],a=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"--",n=arguments[2];n&&n.length&&(i=[].concat(r(i),r(n)));var a=[];for(var u in t){for(var c={},s=Object.entries(t[u]),l=0;l<s.length;l++){var f=s[l];o(f[1])&&(f[1]=e),c[f[0]]=f[1]}a.push(c)}return a};e.a=a},function(t,e,n){"use strict";var r=function(t,e){return new Date(t,e,0).getDate()};e.a=r},function(t,e,n){"use strict";function r(t){var e=/U\+([0-9A-Fa-f]{4,6})|\[u\+([0-9A-Fa-f]{4,6})\]|\\u\{([0-9A-Fa-f]{4,6})\}/g;return t?t.replace(e,function(t,e,n,r){var a=e||n||r,u=parseInt(a,16);if(isNaN(u)||u<0||u>1114111)return t;try{var c=String.fromCodePoint(u);return o(u)?c:i(c)?c:t}catch(e){return t}}):t}function o(t){return u.some(function(e){var n=a(e,2),r=n[0],o=n[1];return t>=r&&t<=o})}function i(t){return"�"!==t}e.a=r;var a=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&u.return&&u.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=[[8986,8987],[9193,9196],[9200,9200],[9203,9203],[9642,9643],[9654,9654],[9664,9664],[9723,9726],[9728,9732],[9742,9742],[9745,9745],[9748,9749],[9752,9752],[9757,9757],[9760,9760],[9762,9763],[9766,9766],[9770,9770],[9774,9775],[9784,9786],[9792,9792],[9794,9794],[9800,9811],[9823,9824],[9827,9827],[9829,9830],[9832,9832],[9851,9851],[9855,9855],[9874,9879],[9881,9881],[9883,9884],[9888,9889],[9898,9899],[9904,9905],[9917,9918],[9924,9925],[9928,9928],[9934,9935],[9937,9937],[9939,9940],[9961,9962],[9968,9973],[9975,9978],[9981,9981],[9986,9986],[9989,9989],[9992,9997],[9999,9999],[10002,10002],[10004,10004],[10006,10006],[10013,10013],[10017,10017],[10024,10024],[10035,10036],[10052,10052],[10055,10055],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10083,10084],[10133,10135],[10145,10145],[10160,10160],[10175,10175],[10548,10549],[11013,11015],[11035,11036],[11088,11088],[11093,11093],[126980,126980],[127183,127183],[127344,127345],[127358,127359],[127374,127374],[127377,127386],[127462,127487],[127489,127490],[127514,127514],[127535,127535],[127538,127546],[127568,127569],[127744,128511],[128512,128591],[128640,128767],[128768,128895],[128896,129023],[129024,129279],[129280,129535],[129536,129647],[129648,129791],[129792,130047]]},function(t,e,n){"use strict";function r(t,e,n){if(console.log(t,e,n,"//"),!t)return e;var r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp("("+r+")","gi");return e.replace(o,'<span class="'+n+'">$1</span>')}e.a=r}])});
|
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
@keydown="inputsLk({id:'11',name:'实力坑爹'},12123)"
|
|
9
9
|
/>
|
|
10
10
|
<button @click="getCookie">点击</button>
|
|
11
|
+
<br>
|
|
12
|
+
<div v-html="setHighLight(name,highLightContent,'initHightLightClassName')"></div>
|
|
11
13
|
<div
|
|
12
14
|
style="height: 300px; border: 1px solid red; overflow-y: auto"
|
|
13
15
|
@scroll="initScroll"
|
|
@@ -44,10 +46,12 @@ import verCode from "./verCode";
|
|
|
44
46
|
import filterTable from "./filterTable";
|
|
45
47
|
import getMonthDays from "./getMonthDays";
|
|
46
48
|
import emoji from "./emoji";
|
|
49
|
+
import highLight from "./highLight";
|
|
47
50
|
export default {
|
|
48
51
|
data() {
|
|
49
52
|
return {
|
|
50
53
|
name: "",
|
|
54
|
+
highLightContent: '234234234234',
|
|
51
55
|
list: [
|
|
52
56
|
{
|
|
53
57
|
name:'d',
|
|
@@ -141,6 +145,7 @@ export default {
|
|
|
141
145
|
|
|
142
146
|
},
|
|
143
147
|
methods: {
|
|
148
|
+
setHighLight:highLight,
|
|
144
149
|
phoneCode(e){
|
|
145
150
|
if (verCode.phoneCodeStatus()) {
|
|
146
151
|
console.log('已经发送了')
|
|
@@ -175,24 +180,35 @@ export default {
|
|
|
175
180
|
console.log(cookie.get("test2"));
|
|
176
181
|
},
|
|
177
182
|
inputBlur() {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
183
|
+
reg.Email(this.name,'请是是是','完犊子').then(()=>{
|
|
184
|
+
console.log('成功')
|
|
185
|
+
}).catch(e=>{
|
|
186
|
+
console.log(e)
|
|
187
|
+
})
|
|
188
|
+
// const regPhone = reg.Phone(this.name);
|
|
189
|
+
// console.log(regPhone,'regPhone')
|
|
190
|
+
// if (regPhone == true) {
|
|
191
|
+
// console.log("正确", this.name);
|
|
192
|
+
// } else {
|
|
193
|
+
// console.log("错误", regPhone, "///");
|
|
194
|
+
// console.log(
|
|
195
|
+
// "错误",
|
|
196
|
+
// reg.Phone(this.name, "空手机", "手机唧唧了"),
|
|
197
|
+
// "///"
|
|
198
|
+
// );
|
|
199
|
+
// }
|
|
189
200
|
},
|
|
190
201
|
},
|
|
191
202
|
};
|
|
192
203
|
</script>
|
|
193
|
-
<style lang="scss"
|
|
204
|
+
<style lang="scss">
|
|
194
205
|
.img {
|
|
195
206
|
width: 100px;
|
|
196
207
|
height: 100px;
|
|
197
208
|
}
|
|
209
|
+
.initHightLightClassName{
|
|
210
|
+
color: #06f;
|
|
211
|
+
font-weight: bold;
|
|
212
|
+
text-decoration: underline;
|
|
213
|
+
}
|
|
198
214
|
</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// 高亮显示搜索匹配的文字
|
|
2
|
+
export default function highlight(searchName,backText,className) {
|
|
3
|
+
console.log(searchName,backText,className,'//')
|
|
4
|
+
if (!searchName) return backText;
|
|
5
|
+
// 转义特殊字符,防止正则错误
|
|
6
|
+
const escapedKeyword = searchName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
7
|
+
// 创建正则,忽略大小写,全局匹配
|
|
8
|
+
const regex = new RegExp(`(${escapedKeyword})`, 'gi');
|
|
9
|
+
// 替换匹配部分,包裹高亮span
|
|
10
|
+
return backText.replace(regex, `<span class="${className}">$1</span>`);
|
|
11
|
+
}
|
package/src/index.js
CHANGED
|
@@ -21,6 +21,8 @@ import filterTable from "./filterTable";
|
|
|
21
21
|
import getMonthDays from "./getMonthDays";
|
|
22
22
|
// emoji表情转化
|
|
23
23
|
import emoji from "./emoji";
|
|
24
|
+
// 高亮显示搜索匹配的文字
|
|
25
|
+
import highLight from "./highLight";
|
|
24
26
|
|
|
25
27
|
export default {
|
|
26
28
|
reg,
|
|
@@ -33,5 +35,6 @@ export default {
|
|
|
33
35
|
verCode,
|
|
34
36
|
filterTable,
|
|
35
37
|
getMonthDays,
|
|
36
|
-
emoji
|
|
38
|
+
emoji,
|
|
39
|
+
highLight
|
|
37
40
|
};
|
package/src/reg/index.js
CHANGED
|
@@ -6,29 +6,33 @@ let reg = {
|
|
|
6
6
|
noValueMsg = "请输入手机号码",
|
|
7
7
|
errValueMsg = "手机号码格式有误"
|
|
8
8
|
) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (
|
|
12
|
-
|
|
9
|
+
return new Promise((resolve,reject)=>{
|
|
10
|
+
let reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
|
|
11
|
+
if (value) {
|
|
12
|
+
if (reg.test(value)) {
|
|
13
|
+
resolve()
|
|
14
|
+
} else {
|
|
15
|
+
reject(errValueMsg)
|
|
16
|
+
}
|
|
13
17
|
} else {
|
|
14
|
-
|
|
18
|
+
reject(noValueMsg)
|
|
15
19
|
}
|
|
16
|
-
}
|
|
17
|
-
return noValueMsg;
|
|
18
|
-
}
|
|
20
|
+
})
|
|
19
21
|
},
|
|
20
22
|
// 邮箱验证
|
|
21
23
|
Email(value, noValueMsg = "请输入邮箱", errValueMsg = "邮箱格式有误") {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (
|
|
25
|
-
|
|
24
|
+
return new Promise((resolve,reject)=>{
|
|
25
|
+
let reg = /^([0-9A-Za-z\-_\.]+)@([0-9a-z]+\.[a-z]{2,3}(\.[a-z]{2})?)$/g;
|
|
26
|
+
if (value) {
|
|
27
|
+
if (reg.test(value)) {
|
|
28
|
+
resolve()
|
|
29
|
+
} else {
|
|
30
|
+
reject(errValueMsg)
|
|
31
|
+
}
|
|
26
32
|
} else {
|
|
27
|
-
|
|
33
|
+
reject(noValueMsg)
|
|
28
34
|
}
|
|
29
|
-
}
|
|
30
|
-
return noValueMsg;
|
|
31
|
-
}
|
|
35
|
+
})
|
|
32
36
|
},
|
|
33
37
|
// 身份证号码验证
|
|
34
38
|
IdCard(
|
|
@@ -36,16 +40,18 @@ let reg = {
|
|
|
36
40
|
noValueMsg = "请输入身份证号码",
|
|
37
41
|
errValueMsg = "身份证号码格式有误"
|
|
38
42
|
) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
+
return new Promise((resolve,reject)=>{
|
|
44
|
+
let reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
|
|
45
|
+
if (value) {
|
|
46
|
+
if (reg.test(value)) {
|
|
47
|
+
resolve()
|
|
48
|
+
} else {
|
|
49
|
+
reject(errValueMsg)
|
|
50
|
+
}
|
|
43
51
|
} else {
|
|
44
|
-
|
|
52
|
+
reject(noValueMsg)
|
|
45
53
|
}
|
|
46
|
-
}
|
|
47
|
-
return noValueMsg;
|
|
48
|
-
}
|
|
54
|
+
})
|
|
49
55
|
},
|
|
50
56
|
// 只能包含数字、字母以及下划线
|
|
51
57
|
Common(
|
|
@@ -53,16 +59,18 @@ let reg = {
|
|
|
53
59
|
noValueMsg = "请输入包含数字、字母以及下划线的内容",
|
|
54
60
|
errValueMsg = "只能包含数字、字母以及下划线"
|
|
55
61
|
) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (
|
|
59
|
-
|
|
62
|
+
return new Promise((resolve,reject)=>{
|
|
63
|
+
let reg = /^[a-zA-Z0-9_]+$/;
|
|
64
|
+
if (value) {
|
|
65
|
+
if (reg.test(value)) {
|
|
66
|
+
resolve()
|
|
67
|
+
} else {
|
|
68
|
+
reject(errValueMsg)
|
|
69
|
+
}
|
|
60
70
|
} else {
|
|
61
|
-
|
|
71
|
+
reject(noValueMsg)
|
|
62
72
|
}
|
|
63
|
-
}
|
|
64
|
-
return noValueMsg;
|
|
65
|
-
}
|
|
73
|
+
})
|
|
66
74
|
},
|
|
67
75
|
// QQ验证
|
|
68
76
|
QQ(
|
|
@@ -70,16 +78,18 @@ let reg = {
|
|
|
70
78
|
noValueMsg = "请输入QQ号码",
|
|
71
79
|
errValueMsg = "QQ号码格式错误"
|
|
72
80
|
) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (
|
|
76
|
-
|
|
81
|
+
return new Promise((resolve,reject)=>{
|
|
82
|
+
let reg = /^[1-9][0-9]{4,10}$/gim;
|
|
83
|
+
if (value) {
|
|
84
|
+
if (reg.test(value)) {
|
|
85
|
+
resolve()
|
|
86
|
+
} else {
|
|
87
|
+
reject(errValueMsg)
|
|
88
|
+
}
|
|
77
89
|
} else {
|
|
78
|
-
|
|
90
|
+
reject(noValueMsg)
|
|
79
91
|
}
|
|
80
|
-
}
|
|
81
|
-
return noValueMsg;
|
|
82
|
-
}
|
|
92
|
+
})
|
|
83
93
|
},
|
|
84
94
|
// 金额
|
|
85
95
|
Money(
|
|
@@ -87,16 +97,18 @@ let reg = {
|
|
|
87
97
|
noValueMsg = "请输入金额(最多保留2位小数点)",
|
|
88
98
|
errValueMsg = "金额格式错误"
|
|
89
99
|
) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (
|
|
93
|
-
|
|
100
|
+
return new Promise((resolve,reject)=>{
|
|
101
|
+
let reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
|
|
102
|
+
if (value) {
|
|
103
|
+
if (reg.test(value)) {
|
|
104
|
+
resolve()
|
|
105
|
+
} else {
|
|
106
|
+
reject(errValueMsg)
|
|
107
|
+
}
|
|
94
108
|
} else {
|
|
95
|
-
|
|
109
|
+
reject(noValueMsg)
|
|
96
110
|
}
|
|
97
|
-
}
|
|
98
|
-
return noValueMsg;
|
|
99
|
-
}
|
|
111
|
+
})
|
|
100
112
|
}
|
|
101
113
|
};
|
|
102
114
|
|