收藏
回答

使用dayjs库后使用代码保护功能报错,如何解决?

求助!使用dayjs库后使用代码保护功能报错,报错信息如下,请问如何解决?


message:miniprogram_npm/dayjs/index.js: 无法使用代码保护功能

in miniprogram_npm/dayjs/index.js

'require' requires one and only one static string literal

  1 | "use strict";var t,e,n=require("../../@babel/runtime/helpers/typeof");module.exports=(t={},e=function(e,r){if(!t[e])return require(r);if(!t[e].status){var i=t[e].m;i._exports=i._tempexports;var s=Object.getOwnPropertyDescriptor(i,"exports");s&&s.configurable&&Object.defineProperty(i,"exports",{set:function(t){"object"===n(t)&&t!==i._exports&&(i._exports.__proto__=t.__proto__,Object.keys(t).forEach((function(e){i._exports[e]=t[e]}))),i._tempexports=t},get:function(){return i._tempexports}}),t[e].status=1,t[e].func(t[e].req,i,i.exports)}return t[e].m.exports},function(e,n,r){t[e]={status:0,func:n,req:r,m:{exports:{},_tempexports:{}}}}(1624102295068,(function(t,e,r){!function(t,i){"object"==n(r)&&void 0!==e?e.exports=i():"function"==typeof define&&define.amd?define(i):t.dayjs=i()}(this,(function(){var t="millisecond",e="second",r="minute",i="hour",s="day",u="week",o="month",a="quarter",f="year",c="date",h=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[^0-9]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,d=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,$={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},l=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},p={s:l,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+l(r,2,"0")+":"+l(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,o),s=n-i<0,u=e.clone().add(r+(s?-1:1),o);return+(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(n){return{M:o,y:f,w:u,d:s,D:c,h:i,m:r,s:e,ms:t,Q:a}[n]||String(n||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},m="en",y={};y[m]=$;var M=function(t){return t instanceof _},v=function(t,e,n){var r;if(!t)return m;if("string"==typeof t)y[t]&&(r=t),e&&(y[t]=e,r=t);else{var i=t.name;y[i]=t,r=i}return!n&&r&&(m=r),r||!n&&m},g=function(t,e){if(M(t))return t.clone();var r="object"==n(e)?e:{};return r.date=t,r.args=arguments,new _(r)},D=p;D.l=v,D.i=M,D.w=function(t,e){return g(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function n(t){this.$L=v(t.locale,null,!0),this.parse(t)}var $=n.prototype;return $.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(D.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(h);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init()},$.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},$.$utils=function(){return D},$.isValid=function(){return!("Invalid Date"===this.$d.toString())},$.isSame=function(t,e){var n=g(t);return this.startOf(e)<=n&&n<=this.endOf(e)},$.isAfter=function(t,e){return g(t)<this.startOf(e)},$.isBefore=function(t,e){return this.endOf(e)<g(t)},$.$g=function(t,e,n){return D.u(t)?this[e]:this.set(n,t)},$.unix=function(){return Math.floor(this.valueOf()/1e3)},$.valueOf=function(){return this.$d.getTime()},$.startOf=function(t,n){var a=this,h=!!D.u(n)||n,d=D.p(t),$=function(t,e){var n=D.w(a.$u?Date.UTC(a.$y,e,t):new Date(a.$y,e,t),a);return h?n:n.endOf(s)},l=function(t,e){return D.w(a.toDate()[t].apply(a.toDate("s"),(h?[0,0,0,0]:[23,59,59,999]).slice(e)),a)},p=this.$W,m=this.$M,y=this.$D,M="set"+(this.$u?"UTC":"");switch(d){case f:return h?$(1,0):$(31,11);case o:return h?$(1,m):$(0,m+1);case u:var v=this.$locale().weekStart||0,g=(p<v?p+7:p)-v;return $(h?y-g:y+(6-g),m);case s:case c:return l(M+"Hours",0);case i:return l(M+"Minutes",1);case r:return l(M+"Seconds",2);case e:return l(M+"Milliseconds",3);default:return this.clone()}},$.endOf=function(t){return this.startOf(t,!1)},$.$set=function(n,u){var a,h=D.p(n),d="set"+(this.$u?"UTC":""),$=(a={},a[s]=d+"Date",a[c]=d+"Date",a[o]=d+"Month",a[f]=d+"FullYear",a[i]=d+"Hours",a[r]=d+"Minutes",a[e]=d+"Seconds",a[t]=d+"Milliseconds",a)[h],l=h===s?this.$D+(u-this.$W):u;if(h===o||h===f){var p=this.clone().set(c,1);p.$d[$](l),p.init(),this.$d=p.set(c,Math.min(this.$D,p.daysInMonth())).$d}else $&&this.$d[$](l);return this.init(),this},$.set=function(t,e){return this.clone().$set(t,e)},$.get=function(t){return this[D.p(t)]()},$.add=function(t,n){var a,c=this;t=Number(t);var h=D.p(n),d=function(e){var n=g(c);return D.w(n.date(n.date()+Math.round(e*t)),c)};if(h===o)return this.set(o,this.$M+t);if(h===f)return this.set(f,this.$y+t);if(h===s)return d(1);if(h===u)return d(7);var $=(a={},a[r]=6e4,a[i]=36e5,a[e]=1e3,a)[h]||1,l=this.$d.getTime()+t*$;return D.w(l,this)},$.subtract=function(t,e){return this.add(-1*t,e)},$.format=function(t){var e=this;if(!this.isValid())return"Invalid Date";var n=t||"YYYY-MM-DDTHH:mm:ssZ",r=D.z(this),i=this.$locale(),s=this.$H,u=this.$m,o=this.$M,a=i.weekdays,f=i.months,c=function(t,r,i,s){return t&&(t[r]||t(e,n))||i[r].substr(0,s)},h=function(t){return D.s(s%12||12,t,"0")},$=i.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},l={YY:String(this.$y).slice(-2),YYYY:this.$y,M:o+1,MM:D.s(o+1,2,"0"),MMM:c(i.monthsShort,o,f,3),MMMM:c(f,o),D:this.$D,DD:D.s(this.$D,2,"0"),d:String(this.$W),dd:c(i.weekdaysMin,this.$W,a,2),ddd:c(i.weekdaysShort,this.$W,a,3),dddd:a[this.$W],H:String(s),HH:D.s(s,2,"0"),h:h(1),hh:h(2),a:$(s,u,!0),A:$(s,u,!1),m:String(u),mm:D.s(u,2,"0"),s:String(this.$s),ss:D.s(this.$s,2,"0"),SSS:D.s(this.$ms,3,"0"),Z:r};return n.replace(d,(function(t,e){return e||l[t]||r.replace(":","")}))},$.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},$.diff=function(t,n,c){var h,d=D.p(n),$=g(t),l=6e4*($.utcOffset()-this.utcOffset()),p=this-$,m=D.m(this,$);return m=(h={},h[f]=m/12,h[o]=m,h[a]=m/3,h[u]=(p-l)/6048e5,h[s]=(p-l)/864e5,h[i]=p/36e5,h[r]=p/6e4,h[e]=p/1e3,h)[d]||p,c?m:D.a(m)},$.daysInMonth=function(){return this.endOf(o).$D},$.$locale=function(){return y[this.$L]},$.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=v(t,e,!0);return r&&(n.$L=r),n},$.clone=function(){return D.w(this.$d,this)},$.toDate=function(){return new Date(this.valueOf())},$.toJSON=function(){return this.isValid()?this.toISOString():null},$.toISOString=function(){return this.$d.toISOString()},$.toString=function(){return this.$d.toUTCString()},n}(),S=_.prototype;return g.prototype=S,[["$ms",t],["$s",e],["$m",r],["$H",i],["$W",s],["$M",o],["$y",f],["$D",c]].forEach((function(t){S[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),g.extend=function(t,e){return t.$i||(t(e,_,g),t.$i=!0),g},g.locale=v,g.isDayjs=M,g.unix=function(t){return g(1e3*t)},g.en=y[m],g.Ls=y,g.p={},g}))}),(function(t){return e({}[t],t)})),e(1624102295068));

appid: wxc91df3a38400bec7

openid: o6zAJs0JpkBa8vzuSY97204JQn-g

ideVersion: 1.05.2106091

osType: win32-x64

time: 2021-06-27 14:32:46

回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容