js_ryl 1.0.16 → 1.0.18
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 +16 -0
- package/dist/build.js +1 -1
- package/jsconfig.json +17 -0
- package/package.json +1 -1
- package/src/App.vue +3 -154
- package/src/App2.vue +185 -0
- package/src/filterTable/index.js +26 -0
- package/src/getMonthDays/index.js +7 -0
- package/src/index.js +7 -1
- package/src/App1.vue +0 -3
package/README.md
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
5.运算符 -- num
|
|
16
16
|
6.复制文本信息 -- copy //这是js版本,如果有 componen_ryl,可直接使用指令 v-copy
|
|
17
17
|
7.对象深拷贝 -- deepCopy
|
|
18
|
+
8.验证码 -- verCode
|
|
19
|
+
9.table中的数据补全方法 -- filterTable
|
|
18
20
|
|
|
19
21
|
# 使用方法:
|
|
20
22
|
|
|
@@ -105,6 +107,7 @@
|
|
|
105
107
|
|
|
106
108
|
#7. 对象或数组的深拷贝 -- deepCopy
|
|
107
109
|
|
|
110
|
+
#第一个参数默认为: {}, 第二个参数为:数据源
|
|
108
111
|
let obj2 = deepCopy({},obj)
|
|
109
112
|
|
|
110
113
|
# 如:
|
|
@@ -148,6 +151,17 @@
|
|
|
148
151
|
verCode.PhoneCodeClear()
|
|
149
152
|
}
|
|
150
153
|
|
|
154
|
+
#9.table中的数据补全方法 -- filterTable
|
|
155
|
+
|
|
156
|
+
# 第一个参数为:数据源,第二个参数选填(为补全的符号,默认为 -- )
|
|
157
|
+
let list = filterTable(data)
|
|
158
|
+
|
|
159
|
+
#10.获取当前年份中,指定月份的天数
|
|
160
|
+
|
|
161
|
+
#第一个参数为:年份,第二个参数为:月份
|
|
162
|
+
let day = getMonthDays(year,month)
|
|
163
|
+
|
|
164
|
+
|
|
151
165
|
|
|
152
166
|
# serve with hot reload at localhost:8080
|
|
153
167
|
# npm run dev
|
|
@@ -163,6 +177,8 @@
|
|
|
163
177
|
#1.0.12: number 方法 加 减 小数点后2位调整
|
|
164
178
|
#1.0.15: 结构调整,把验证码效果,从 正则 中提取出来
|
|
165
179
|
#1.0.16: 剔除不用的包,如element
|
|
180
|
+
#1.0.17: 添加 数据补全方法 如:table中有数据为空时,自动补全 ‘--’ 符号
|
|
181
|
+
#1.0.18: 添加 获取当前年份中,指定月份的天数
|
|
166
182
|
```
|
|
167
183
|
|
|
168
184
|
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=1)}([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";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2),o=n(3),i=n(4),u=n(0),a=n(5),c=n(6),l=n(7),s=n(8);e.default={reg:r.a,time:o.a,cookie:i.a,fun:u.a,num:a.a,copy:c.a,deepCopy:l.a,verCode:s.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,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,u=n.getDate(),a=n.getHours(),c=n.getMinutes(),l=n.getSeconds();return"yyyy-MM-dd"==e?o+"-"+r(i)+"-"+r(u):"yyyy-MM-dd HH:mm"==e?o+"-"+r(i)+"-"+r(u)+" "+r(a)+":"+r(c):o+"-"+r(i)+"-"+r(u)+" "+r(a)+":"+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.expires){o=";expires="+(10==String(n.expires).length?new Date(1e3*n.expires):new Date(n.expires)).toGMTString()}document.cookie=t+"="+e+r+o},get:function(t){for(var e=document.cookie,n=e.split("; "),r=0;r<n.length;r++)if(n[r].split("=")[0]===t)return n[r].split("=")[1];return""},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=(n(0),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}}),o=function(t){t=Number(t);var e=r(t),n=t.toString().toUpperCase();return 2===n.split("E").length?Math.round(t*Math.pow(10,e)):Number(n.replace(".",""))},i=function(t,e,n,r){var o=0;switch(t){case"add":o=e+n;break;case"sub":o=e-n;break;case"div":o=e/n;break;case"mul":o=e*n}return Math.abs(r-o)>1?o:r},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,o,u;try{n=r(t)+1}catch(t){n=0}try{o=r(e)+1}catch(t){o=0}u=Math.pow(10,Math.max(n,o));var a=(this.mul(t,u)+this.mul(e,u))/u;return i("add",t,e,a)},sub:function(t,e){t=this.NumFilter(Number(t)),e=this.NumFilter(Number(e));var n,o,u;try{n=r(t)+1}catch(t){n=0}try{o=r(e)+1}catch(t){o=0}u=Math.pow(10,Math.max(n,o));var a=Number((this.mul(t,u)-this.mul(e,u))/u);return i("sub",t,e,a)},div:function(t,e){t=Number(t),e=Number(e);var n,u,a=0,c=0;try{a=r(t)}catch(t){}try{c=r(e)}catch(t){}n=o(t),u=o(e);var l=this.mul(n/u,Math.pow(10,c-a));return i("div",t,e,l)},mul:function(t,e){t=Number(t),e=Number(e);var n=0,u=t.toString(),a=e.toString();try{n+=r(u)}catch(t){}try{n+=r(a)}catch(t){}var c=o(u)*o(a)/Math.pow(10,n);return i("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="",u=null,a={PhoneCode:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:60,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"后重新获取";if(i=t.target.innerText,u=t,!r){r=!0,t.target.innerText=n-1+"s"+a;var c=n-1;o=setInterval(function(){c--,c<=0?(t.target.innerText=i,e.PhoneCodeClear()):t.target.innerText=c+"s"+a},1e3)}},PhoneCodeClear:function(){r=!1,u&&(u.target.innerText=i),clearInterval(o)},phoneCodeStatus:function(){return r}};e.a=a}])});
|
|
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=1)}([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";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2),o=n(3),i=n(4),u=n(0),a=n(5),c=n(6),l=n(7),s=n(8),f=n(9),d=n(10);e.default={reg:r.a,time:o.a,cookie:i.a,fun:u.a,num:a.a,copy:c.a,deepCopy:l.a,verCode:s.a,filterTable:f.a,getMonthDays:d.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,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,u=n.getDate(),a=n.getHours(),c=n.getMinutes(),l=n.getSeconds();return"yyyy-MM-dd"==e?o+"-"+r(i)+"-"+r(u):"yyyy-MM-dd HH:mm"==e?o+"-"+r(i)+"-"+r(u)+" "+r(a)+":"+r(c):o+"-"+r(i)+"-"+r(u)+" "+r(a)+":"+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.expires){o=";expires="+(10==String(n.expires).length?new Date(1e3*n.expires):new Date(n.expires)).toGMTString()}document.cookie=t+"="+e+r+o},get:function(t){for(var e=document.cookie,n=e.split("; "),r=0;r<n.length;r++)if(n[r].split("=")[0]===t)return n[r].split("=")[1];return""},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=(n(0),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}}),o=function(t){t=Number(t);var e=r(t),n=t.toString().toUpperCase();return 2===n.split("E").length?Math.round(t*Math.pow(10,e)):Number(n.replace(".",""))},i=function(t,e,n,r){var o=0;switch(t){case"add":o=e+n;break;case"sub":o=e-n;break;case"div":o=e/n;break;case"mul":o=e*n}return Math.abs(r-o)>1?o:r},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,o,u;try{n=r(t)+1}catch(t){n=0}try{o=r(e)+1}catch(t){o=0}u=Math.pow(10,Math.max(n,o));var a=(this.mul(t,u)+this.mul(e,u))/u;return i("add",t,e,a)},sub:function(t,e){t=this.NumFilter(Number(t)),e=this.NumFilter(Number(e));var n,o,u;try{n=r(t)+1}catch(t){n=0}try{o=r(e)+1}catch(t){o=0}u=Math.pow(10,Math.max(n,o));var a=Number((this.mul(t,u)-this.mul(e,u))/u);return i("sub",t,e,a)},div:function(t,e){t=Number(t),e=Number(e);var n,u,a=0,c=0;try{a=r(t)}catch(t){}try{c=r(e)}catch(t){}n=o(t),u=o(e);var l=this.mul(n/u,Math.pow(10,c-a));return i("div",t,e,l)},mul:function(t,e){t=Number(t),e=Number(e);var n=0,u=t.toString(),a=e.toString();try{n+=r(u)}catch(t){}try{n+=r(a)}catch(t){}var c=o(u)*o(a)/Math.pow(10,n);return i("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="",u=null,a={PhoneCode:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:60,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"后重新获取";if(i=t.target.innerText,u=t,!r){r=!0,t.target.innerText=n-1+"s"+a;var c=n-1;o=setInterval(function(){c--,c<=0?(t.target.innerText=i,e.PhoneCodeClear()):t.target.innerText=c+"s"+a},1e3)}},PhoneCodeClear:function(){r=!1,u&&(u.target.innerText=i),clearInterval(o)},phoneCodeStatus:function(){return r}};e.a=a},function(t,e,n){"use strict";function r(t){return["",void 0,null].some(function(e){return e===t})}var o=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"--",n=[];for(var o in t){for(var i={},u=Object.entries(t[o]),a=0;a<u.length;a++){var c=u[a];r(c[1])&&(c[1]=e),i[c[0]]=c[1]}n.push(i)}return n};e.a=o},function(t,e,n){"use strict";var r=function(t,e){return new Date(t,e,0).getDate()};e.a=r}])});
|
package/jsconfig.json
ADDED
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -1,154 +1,3 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
type="text"
|
|
5
|
-
id="input"
|
|
6
|
-
v-model="name"
|
|
7
|
-
@blur="inputBlur"
|
|
8
|
-
@keydown="inputsLk({id:'11',name:'实力坑爹'},12123)"
|
|
9
|
-
/>
|
|
10
|
-
<button @click="getCookie">点击</button>
|
|
11
|
-
<div
|
|
12
|
-
style="height: 300px; border: 1px solid red; overflow-y: auto"
|
|
13
|
-
@scroll="initScroll"
|
|
14
|
-
>
|
|
15
|
-
<div style="height: 800px">滚动区域</div>
|
|
16
|
-
</div>
|
|
17
|
-
<button @click="copyCli()">Copy</button>
|
|
18
|
-
<br />
|
|
19
|
-
<br>
|
|
20
|
-
<br>
|
|
21
|
-
<!-- <button @click="phoneCode($event)">验证码</button> -->
|
|
22
|
-
<a href="javascript:;" @click="phoneCode($event)">验证码</a>
|
|
23
|
-
<a href="javascript:;" @click="phoneCodeExit()">清空验证码</a>
|
|
24
|
-
</div>
|
|
25
|
-
</template>
|
|
26
|
-
<script>
|
|
27
|
-
import reg from "./reg";
|
|
28
|
-
import time from "./time";
|
|
29
|
-
import cookie from "./cookie";
|
|
30
|
-
import fun from "./function";
|
|
31
|
-
import num from "./number";
|
|
32
|
-
import copy from "./copy";
|
|
33
|
-
import deepCopy from "./deepCopy";
|
|
34
|
-
import verCode from "./verCode";
|
|
35
|
-
export default {
|
|
36
|
-
data() {
|
|
37
|
-
return {
|
|
38
|
-
name: "",
|
|
39
|
-
};
|
|
40
|
-
},
|
|
41
|
-
// directives: {
|
|
42
|
-
// LazyLoad,
|
|
43
|
-
// },
|
|
44
|
-
mounted() {
|
|
45
|
-
console.log(time.toStamp("2021-06-02 18:17:02"), "当前时间戳");
|
|
46
|
-
console.log(time.toDate(1622623502), "当前时间");
|
|
47
|
-
console.log(time.getNow(), "系统当前时间");
|
|
48
|
-
cookie.set("test1", "abcde", {
|
|
49
|
-
path: "/device",
|
|
50
|
-
expires: 1622882702,
|
|
51
|
-
});
|
|
52
|
-
cookie.set("test2", "abcdefghi", { expires: 1622623502 });
|
|
53
|
-
setTimeout(() => {
|
|
54
|
-
console.log(cookie.get("test2"));
|
|
55
|
-
}, 1000);
|
|
56
|
-
setTimeout(() => {
|
|
57
|
-
cookie.remove("test2");
|
|
58
|
-
}, 3000);
|
|
59
|
-
document.onscroll = fun.throole(function () {
|
|
60
|
-
console.log("触发了几次了" + Date.now());
|
|
61
|
-
}, 200);
|
|
62
|
-
// let arr = [729.396, 72.6353, 6.3343, 1.1695];
|
|
63
|
-
let arr = [729.6986, 72.6, 6.119, 23.03,0.502];
|
|
64
|
-
let arr2 = arr.reduce((pre, next) => {
|
|
65
|
-
return pre + next;
|
|
66
|
-
});
|
|
67
|
-
let arr3 = arr.reduce((v, n) => {
|
|
68
|
-
return num.add(v, n);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
console.log(arr2,'22');
|
|
73
|
-
console.log(arr3,'33');
|
|
74
|
-
console.log(num.add(3.29555556,2.63),'+');
|
|
75
|
-
console.log(num.sub(0.11, 0.306),'-');
|
|
76
|
-
console.log(num.mul(0.1, 0.3231),'*');
|
|
77
|
-
console.log(num.div(0.893, 0.3),'/');
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
let obj = {
|
|
81
|
-
name: '张三',
|
|
82
|
-
age:12,
|
|
83
|
-
info: {
|
|
84
|
-
sex: '男',
|
|
85
|
-
like: ['电影','游戏']
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
let obj2 = deepCopy({},obj)
|
|
89
|
-
obj2.age = 18
|
|
90
|
-
obj2.info.sex = '女'
|
|
91
|
-
obj2.info.like = ['耍']
|
|
92
|
-
console.log(obj2,obj,'深拷贝后的值变化')
|
|
93
|
-
|
|
94
|
-
let arr00 = [1,2,3,4,5]
|
|
95
|
-
let arr002 = deepCopy([],arr00)
|
|
96
|
-
arr002[0]=111
|
|
97
|
-
console.log(arr002,arr00)
|
|
98
|
-
},
|
|
99
|
-
methods: {
|
|
100
|
-
phoneCode(e){
|
|
101
|
-
if (verCode.phoneCodeStatus()) {
|
|
102
|
-
console.log('已经发送了')
|
|
103
|
-
return false
|
|
104
|
-
}
|
|
105
|
-
verCode.PhoneCode(e,10)
|
|
106
|
-
},
|
|
107
|
-
phoneCodeExit(){
|
|
108
|
-
verCode.PhoneCodeClear()
|
|
109
|
-
},
|
|
110
|
-
longpress() {
|
|
111
|
-
console.log(112233);
|
|
112
|
-
},
|
|
113
|
-
copyCli() {
|
|
114
|
-
copy("good哈哈哈失败", (res) => {
|
|
115
|
-
if (res.code == 200) {
|
|
116
|
-
// 成功
|
|
117
|
-
alert(res.msg);
|
|
118
|
-
} else {
|
|
119
|
-
// 失败
|
|
120
|
-
alert(res.msg);
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
},
|
|
124
|
-
inputsLk: fun.debounce(function (v,v2) {
|
|
125
|
-
console.log(this.name,v,v2);
|
|
126
|
-
}),
|
|
127
|
-
initScroll: fun.throole(function () {
|
|
128
|
-
console.log("触发了几次了" + Date.now());
|
|
129
|
-
}),
|
|
130
|
-
getCookie() {
|
|
131
|
-
console.log(cookie.get("test2"));
|
|
132
|
-
},
|
|
133
|
-
inputBlur() {
|
|
134
|
-
const regPhone = reg.Phone(this.name);
|
|
135
|
-
if (regPhone == true) {
|
|
136
|
-
console.log("正确", this.name);
|
|
137
|
-
} else {
|
|
138
|
-
console.log("错误", regPhone, "///");
|
|
139
|
-
console.log(
|
|
140
|
-
"错误",
|
|
141
|
-
reg.Phone(this.name, "空手机", "手机唧唧了"),
|
|
142
|
-
"///"
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
};
|
|
148
|
-
</script>
|
|
149
|
-
<style lang="scss" scoped>
|
|
150
|
-
.img {
|
|
151
|
-
width: 100px;
|
|
152
|
-
height: 100px;
|
|
153
|
-
}
|
|
154
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div id="app"></div>
|
|
3
|
+
</template>
|
package/src/App2.vue
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="app">
|
|
3
|
+
<input
|
|
4
|
+
type="text"
|
|
5
|
+
id="input"
|
|
6
|
+
v-model="name"
|
|
7
|
+
@blur="inputBlur"
|
|
8
|
+
@keydown="inputsLk({id:'11',name:'实力坑爹'},12123)"
|
|
9
|
+
/>
|
|
10
|
+
<button @click="getCookie">点击</button>
|
|
11
|
+
<div
|
|
12
|
+
style="height: 300px; border: 1px solid red; overflow-y: auto"
|
|
13
|
+
@scroll="initScroll"
|
|
14
|
+
>
|
|
15
|
+
<div style="height: 800px">滚动区域</div>
|
|
16
|
+
</div>
|
|
17
|
+
<button @click="copyCli()">Copy</button>
|
|
18
|
+
<br />
|
|
19
|
+
<br>
|
|
20
|
+
<br>
|
|
21
|
+
<!-- <button @click="phoneCode($event)">验证码</button> -->
|
|
22
|
+
<a href="javascript:;" @click="phoneCode($event)">验证码</a>
|
|
23
|
+
<a href="javascript:;" @click="phoneCodeExit()">清空验证码</a>
|
|
24
|
+
<br>
|
|
25
|
+
<br>
|
|
26
|
+
<ul>
|
|
27
|
+
<li v-for="(item,index) in list" :key="index">
|
|
28
|
+
<span>{{item.name}}</span>
|
|
29
|
+
<span>{{item.age}}</span>
|
|
30
|
+
<span>{{item.sex}}</span>
|
|
31
|
+
</li>
|
|
32
|
+
</ul>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
<script>
|
|
36
|
+
import reg from "./reg";
|
|
37
|
+
import time from "./time";
|
|
38
|
+
import cookie from "./cookie";
|
|
39
|
+
import fun from "./function";
|
|
40
|
+
import num from "./number";
|
|
41
|
+
import copy from "./copy";
|
|
42
|
+
import deepCopy from "./deepCopy";
|
|
43
|
+
import verCode from "./verCode";
|
|
44
|
+
import filterTable from "./filterTable";
|
|
45
|
+
import getMonthDays from "./getMonthDays";
|
|
46
|
+
export default {
|
|
47
|
+
data() {
|
|
48
|
+
return {
|
|
49
|
+
name: "",
|
|
50
|
+
list: [
|
|
51
|
+
{
|
|
52
|
+
name:'d',
|
|
53
|
+
age:99,
|
|
54
|
+
sex:'男'
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name:null,
|
|
58
|
+
age:'',
|
|
59
|
+
sex: '女'
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name:'hf',
|
|
63
|
+
age:1,
|
|
64
|
+
sex:''
|
|
65
|
+
},
|
|
66
|
+
]
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
// directives: {
|
|
70
|
+
// LazyLoad,
|
|
71
|
+
// },
|
|
72
|
+
mounted() {
|
|
73
|
+
this.list = filterTable(this.list)
|
|
74
|
+
console.log(time.toStamp("2021-06-02 18:17:02"), "当前时间戳");
|
|
75
|
+
console.log(time.toDate(1622623502), "当前时间");
|
|
76
|
+
console.log(time.getNow(), "系统当前时间");
|
|
77
|
+
cookie.set("test1", "abcde", {
|
|
78
|
+
path: "/device",
|
|
79
|
+
expires: 1622882702,
|
|
80
|
+
});
|
|
81
|
+
cookie.set("test2", "abcdefghi", { expires: 1622623502 });
|
|
82
|
+
setTimeout(() => {
|
|
83
|
+
console.log(cookie.get("test2"));
|
|
84
|
+
}, 1000);
|
|
85
|
+
setTimeout(() => {
|
|
86
|
+
cookie.remove("test2");
|
|
87
|
+
}, 3000);
|
|
88
|
+
document.onscroll = fun.throole(function () {
|
|
89
|
+
console.log("触发了几次了" + Date.now());
|
|
90
|
+
}, 200);
|
|
91
|
+
// let arr = [729.396, 72.6353, 6.3343, 1.1695];
|
|
92
|
+
let arr = [729.6986, 72.6, 6.119, 23.03,0.502];
|
|
93
|
+
let arr2 = arr.reduce((pre, next) => {
|
|
94
|
+
return pre + next;
|
|
95
|
+
});
|
|
96
|
+
let arr3 = arr.reduce((v, n) => {
|
|
97
|
+
return num.add(v, n);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
console.log(arr2,'22');
|
|
102
|
+
console.log(arr3,'33');
|
|
103
|
+
console.log(num.add(3.29555556,2.63),'+');
|
|
104
|
+
console.log(num.sub(0.11, 0.306),'-');
|
|
105
|
+
console.log(num.mul(0.1, 0.3231),'*');
|
|
106
|
+
console.log(num.div(0.893, 0.3),'/');
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
let obj = {
|
|
110
|
+
name: '张三',
|
|
111
|
+
age:12,
|
|
112
|
+
info: {
|
|
113
|
+
sex: '男',
|
|
114
|
+
like: ['电影','游戏']
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
let obj2 = deepCopy({},obj)
|
|
118
|
+
obj2.age = 18
|
|
119
|
+
obj2.info.sex = '女'
|
|
120
|
+
obj2.info.like = ['耍']
|
|
121
|
+
console.log(obj2,obj,'深拷贝后的值变化')
|
|
122
|
+
|
|
123
|
+
let arr00 = [1,2,3,4,5]
|
|
124
|
+
let arr002 = deepCopy([],arr00)
|
|
125
|
+
arr002[0]=111
|
|
126
|
+
console.log(arr002,arr00),
|
|
127
|
+
|
|
128
|
+
console.log(getMonthDays(2022,11), '// 获取当前年份中,指定月份的天数')
|
|
129
|
+
},
|
|
130
|
+
methods: {
|
|
131
|
+
phoneCode(e){
|
|
132
|
+
if (verCode.phoneCodeStatus()) {
|
|
133
|
+
console.log('已经发送了')
|
|
134
|
+
return false
|
|
135
|
+
}
|
|
136
|
+
verCode.PhoneCode(e,10)
|
|
137
|
+
},
|
|
138
|
+
phoneCodeExit(){
|
|
139
|
+
verCode.PhoneCodeClear()
|
|
140
|
+
},
|
|
141
|
+
longpress() {
|
|
142
|
+
console.log(112233);
|
|
143
|
+
},
|
|
144
|
+
copyCli() {
|
|
145
|
+
copy("good哈哈哈失败", (res) => {
|
|
146
|
+
if (res.code == 200) {
|
|
147
|
+
// 成功
|
|
148
|
+
alert(res.msg);
|
|
149
|
+
} else {
|
|
150
|
+
// 失败
|
|
151
|
+
alert(res.msg);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
},
|
|
155
|
+
inputsLk: fun.debounce(function (v,v2) {
|
|
156
|
+
console.log(this.name,v,v2);
|
|
157
|
+
}),
|
|
158
|
+
initScroll: fun.throole(function () {
|
|
159
|
+
console.log("触发了几次了" + Date.now());
|
|
160
|
+
}),
|
|
161
|
+
getCookie() {
|
|
162
|
+
console.log(cookie.get("test2"));
|
|
163
|
+
},
|
|
164
|
+
inputBlur() {
|
|
165
|
+
const regPhone = reg.Phone(this.name);
|
|
166
|
+
if (regPhone == true) {
|
|
167
|
+
console.log("正确", this.name);
|
|
168
|
+
} else {
|
|
169
|
+
console.log("错误", regPhone, "///");
|
|
170
|
+
console.log(
|
|
171
|
+
"错误",
|
|
172
|
+
reg.Phone(this.name, "空手机", "手机唧唧了"),
|
|
173
|
+
"///"
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
</script>
|
|
180
|
+
<style lang="scss" scoped>
|
|
181
|
+
.img {
|
|
182
|
+
width: 100px;
|
|
183
|
+
height: 100px;
|
|
184
|
+
}
|
|
185
|
+
</style>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// table中的数据 空值 转为 --
|
|
2
|
+
|
|
3
|
+
// 自定义需要状态的条件
|
|
4
|
+
function filterType(i){
|
|
5
|
+
let type = ['',undefined,null]
|
|
6
|
+
return type.some(v=>{
|
|
7
|
+
return v === i
|
|
8
|
+
})
|
|
9
|
+
}
|
|
10
|
+
const filterTable = (data,params="--")=>{
|
|
11
|
+
let newArr = []
|
|
12
|
+
for (let key in data) {
|
|
13
|
+
let obj = {}
|
|
14
|
+
let re = Object.entries(data[key])
|
|
15
|
+
for (let i = 0; i < re.length; i++) {
|
|
16
|
+
let d= re[i]
|
|
17
|
+
if (filterType(d[1])) {
|
|
18
|
+
d[1] = params
|
|
19
|
+
}
|
|
20
|
+
obj[d[0]]=d[1]
|
|
21
|
+
}
|
|
22
|
+
newArr.push(obj)
|
|
23
|
+
}
|
|
24
|
+
return newArr
|
|
25
|
+
}
|
|
26
|
+
export default filterTable
|
package/src/index.js
CHANGED
|
@@ -15,6 +15,10 @@ import copy from "./copy";
|
|
|
15
15
|
import deepCopy from "./deepCopy";
|
|
16
16
|
// 验证码
|
|
17
17
|
import verCode from "./verCode";
|
|
18
|
+
// table中 空值 转为 --
|
|
19
|
+
import filterTable from "./filterTable";
|
|
20
|
+
// 获取当前年份中,指定月份的天数
|
|
21
|
+
import getMonthDays from "./getMonthDays";
|
|
18
22
|
|
|
19
23
|
export default {
|
|
20
24
|
reg,
|
|
@@ -24,5 +28,7 @@ export default {
|
|
|
24
28
|
num,
|
|
25
29
|
copy,
|
|
26
30
|
deepCopy,
|
|
27
|
-
verCode
|
|
31
|
+
verCode,
|
|
32
|
+
filterTable,
|
|
33
|
+
getMonthDays
|
|
28
34
|
};
|
package/src/App1.vue
DELETED