vendor.js 339 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065
  1. (global["webpackJsonp"] = global["webpackJsonp"] || []).push([["common/vendor"],[
  2. /* 0 */,
  3. /* 1 */
  4. /*!************************************************************!*\
  5. !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js ***!
  6. \************************************************************/
  7. /*! no static exports found */
  8. /***/ (function(module, exports, __webpack_require__) {
  9. "use strict";
  10. Object.defineProperty(exports, "__esModule", { value: true });exports.createApp = createApp;exports.createComponent = createComponent;exports.createPage = createPage;exports.createPlugin = createPlugin;exports.createSubpackageApp = createSubpackageApp;exports.default = void 0;var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 2));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;});keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {ownKeys(Object(source), true).forEach(function (key) {_defineProperty(target, key, source[key]);});} else if (Object.getOwnPropertyDescriptors) {Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));} else {ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}}return target;}function _slicedToArray(arr, i) {return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArrayLimit(arr, i) {if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"] != null) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}function _arrayWithHoles(arr) {if (Array.isArray(arr)) return arr;}function _defineProperty(obj, key, value) {if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}function _toConsumableArray(arr) {return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();}function _nonIterableSpread() {throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o, minLen) {if (!o) return;if (typeof o === "string") return _arrayLikeToArray(o, minLen);var n = Object.prototype.toString.call(o).slice(8, -1);if (n === "Object" && o.constructor) n = o.constructor.name;if (n === "Map" || n === "Set") return Array.from(o);if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);}function _iterableToArray(iter) {if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);}function _arrayWithoutHoles(arr) {if (Array.isArray(arr)) return _arrayLikeToArray(arr);}function _arrayLikeToArray(arr, len) {if (len == null || len > arr.length) len = arr.length;for (var i = 0, arr2 = new Array(len); i < len; i++) {arr2[i] = arr[i];}return arr2;}
  11. function b64DecodeUnicode(str) {
  12. return decodeURIComponent(atob(str).split('').map(function (c) {
  13. return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
  14. }).join(''));
  15. }
  16. function getCurrentUserInfo() {
  17. var token = wx.getStorageSync('uni_id_token') || '';
  18. var tokenArr = token.split('.');
  19. if (!token || tokenArr.length !== 3) {
  20. return {
  21. uid: null,
  22. role: [],
  23. permission: [],
  24. tokenExpired: 0 };
  25. }
  26. var userInfo;
  27. try {
  28. userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
  29. } catch (error) {
  30. throw new Error('获取当前用户信息出错,详细错误信息为:' + error.message);
  31. }
  32. userInfo.tokenExpired = userInfo.exp * 1000;
  33. delete userInfo.exp;
  34. delete userInfo.iat;
  35. return userInfo;
  36. }
  37. function uniIdMixin(Vue) {
  38. Vue.prototype.uniIDHasRole = function (roleId) {var _getCurrentUserInfo =
  39. getCurrentUserInfo(),role = _getCurrentUserInfo.role;
  40. return role.indexOf(roleId) > -1;
  41. };
  42. Vue.prototype.uniIDHasPermission = function (permissionId) {var _getCurrentUserInfo2 =
  43. getCurrentUserInfo(),permission = _getCurrentUserInfo2.permission;
  44. return this.uniIDHasRole('admin') || permission.indexOf(permissionId) > -1;
  45. };
  46. Vue.prototype.uniIDTokenValid = function () {var _getCurrentUserInfo3 =
  47. getCurrentUserInfo(),tokenExpired = _getCurrentUserInfo3.tokenExpired;
  48. return tokenExpired > Date.now();
  49. };
  50. }
  51. var _toString = Object.prototype.toString;
  52. var hasOwnProperty = Object.prototype.hasOwnProperty;
  53. function isFn(fn) {
  54. return typeof fn === 'function';
  55. }
  56. function isStr(str) {
  57. return typeof str === 'string';
  58. }
  59. function isPlainObject(obj) {
  60. return _toString.call(obj) === '[object Object]';
  61. }
  62. function hasOwn(obj, key) {
  63. return hasOwnProperty.call(obj, key);
  64. }
  65. function noop() {}
  66. /**
  67. * Create a cached version of a pure function.
  68. */
  69. function cached(fn) {
  70. var cache = Object.create(null);
  71. return function cachedFn(str) {
  72. var hit = cache[str];
  73. return hit || (cache[str] = fn(str));
  74. };
  75. }
  76. /**
  77. * Camelize a hyphen-delimited string.
  78. */
  79. var camelizeRE = /-(\w)/g;
  80. var camelize = cached(function (str) {
  81. return str.replace(camelizeRE, function (_, c) {return c ? c.toUpperCase() : '';});
  82. });
  83. var HOOKS = [
  84. 'invoke',
  85. 'success',
  86. 'fail',
  87. 'complete',
  88. 'returnValue'];
  89. var globalInterceptors = {};
  90. var scopedInterceptors = {};
  91. function mergeHook(parentVal, childVal) {
  92. var res = childVal ?
  93. parentVal ?
  94. parentVal.concat(childVal) :
  95. Array.isArray(childVal) ?
  96. childVal : [childVal] :
  97. parentVal;
  98. return res ?
  99. dedupeHooks(res) :
  100. res;
  101. }
  102. function dedupeHooks(hooks) {
  103. var res = [];
  104. for (var i = 0; i < hooks.length; i++) {
  105. if (res.indexOf(hooks[i]) === -1) {
  106. res.push(hooks[i]);
  107. }
  108. }
  109. return res;
  110. }
  111. function removeHook(hooks, hook) {
  112. var index = hooks.indexOf(hook);
  113. if (index !== -1) {
  114. hooks.splice(index, 1);
  115. }
  116. }
  117. function mergeInterceptorHook(interceptor, option) {
  118. Object.keys(option).forEach(function (hook) {
  119. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  120. interceptor[hook] = mergeHook(interceptor[hook], option[hook]);
  121. }
  122. });
  123. }
  124. function removeInterceptorHook(interceptor, option) {
  125. if (!interceptor || !option) {
  126. return;
  127. }
  128. Object.keys(option).forEach(function (hook) {
  129. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  130. removeHook(interceptor[hook], option[hook]);
  131. }
  132. });
  133. }
  134. function addInterceptor(method, option) {
  135. if (typeof method === 'string' && isPlainObject(option)) {
  136. mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), option);
  137. } else if (isPlainObject(method)) {
  138. mergeInterceptorHook(globalInterceptors, method);
  139. }
  140. }
  141. function removeInterceptor(method, option) {
  142. if (typeof method === 'string') {
  143. if (isPlainObject(option)) {
  144. removeInterceptorHook(scopedInterceptors[method], option);
  145. } else {
  146. delete scopedInterceptors[method];
  147. }
  148. } else if (isPlainObject(method)) {
  149. removeInterceptorHook(globalInterceptors, method);
  150. }
  151. }
  152. function wrapperHook(hook) {
  153. return function (data) {
  154. return hook(data) || data;
  155. };
  156. }
  157. function isPromise(obj) {
  158. return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
  159. }
  160. function queue(hooks, data) {
  161. var promise = false;
  162. for (var i = 0; i < hooks.length; i++) {
  163. var hook = hooks[i];
  164. if (promise) {
  165. promise = Promise.resolve(wrapperHook(hook));
  166. } else {
  167. var res = hook(data);
  168. if (isPromise(res)) {
  169. promise = Promise.resolve(res);
  170. }
  171. if (res === false) {
  172. return {
  173. then: function then() {} };
  174. }
  175. }
  176. }
  177. return promise || {
  178. then: function then(callback) {
  179. return callback(data);
  180. } };
  181. }
  182. function wrapperOptions(interceptor) {var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  183. ['success', 'fail', 'complete'].forEach(function (name) {
  184. if (Array.isArray(interceptor[name])) {
  185. var oldCallback = options[name];
  186. options[name] = function callbackInterceptor(res) {
  187. queue(interceptor[name], res).then(function (res) {
  188. /* eslint-disable no-mixed-operators */
  189. return isFn(oldCallback) && oldCallback(res) || res;
  190. });
  191. };
  192. }
  193. });
  194. return options;
  195. }
  196. function wrapperReturnValue(method, returnValue) {
  197. var returnValueHooks = [];
  198. if (Array.isArray(globalInterceptors.returnValue)) {
  199. returnValueHooks.push.apply(returnValueHooks, _toConsumableArray(globalInterceptors.returnValue));
  200. }
  201. var interceptor = scopedInterceptors[method];
  202. if (interceptor && Array.isArray(interceptor.returnValue)) {
  203. returnValueHooks.push.apply(returnValueHooks, _toConsumableArray(interceptor.returnValue));
  204. }
  205. returnValueHooks.forEach(function (hook) {
  206. returnValue = hook(returnValue) || returnValue;
  207. });
  208. return returnValue;
  209. }
  210. function getApiInterceptorHooks(method) {
  211. var interceptor = Object.create(null);
  212. Object.keys(globalInterceptors).forEach(function (hook) {
  213. if (hook !== 'returnValue') {
  214. interceptor[hook] = globalInterceptors[hook].slice();
  215. }
  216. });
  217. var scopedInterceptor = scopedInterceptors[method];
  218. if (scopedInterceptor) {
  219. Object.keys(scopedInterceptor).forEach(function (hook) {
  220. if (hook !== 'returnValue') {
  221. interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
  222. }
  223. });
  224. }
  225. return interceptor;
  226. }
  227. function invokeApi(method, api, options) {for (var _len = arguments.length, params = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {params[_key - 3] = arguments[_key];}
  228. var interceptor = getApiInterceptorHooks(method);
  229. if (interceptor && Object.keys(interceptor).length) {
  230. if (Array.isArray(interceptor.invoke)) {
  231. var res = queue(interceptor.invoke, options);
  232. return res.then(function (options) {
  233. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  234. });
  235. } else {
  236. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  237. }
  238. }
  239. return api.apply(void 0, [options].concat(params));
  240. }
  241. var promiseInterceptor = {
  242. returnValue: function returnValue(res) {
  243. if (!isPromise(res)) {
  244. return res;
  245. }
  246. return new Promise(function (resolve, reject) {
  247. res.then(function (res) {
  248. if (res[0]) {
  249. reject(res[0]);
  250. } else {
  251. resolve(res[1]);
  252. }
  253. });
  254. });
  255. } };
  256. var SYNC_API_RE =
  257. /^\$|Window$|WindowStyle$|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
  258. var CONTEXT_API_RE = /^create|Manager$/;
  259. // Context例外情况
  260. var CONTEXT_API_RE_EXC = ['createBLEConnection'];
  261. // 同步例外情况
  262. var ASYNC_API = ['createBLEConnection'];
  263. var CALLBACK_API_RE = /^on|^off/;
  264. function isContextApi(name) {
  265. return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1;
  266. }
  267. function isSyncApi(name) {
  268. return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1;
  269. }
  270. function isCallbackApi(name) {
  271. return CALLBACK_API_RE.test(name) && name !== 'onPush';
  272. }
  273. function handlePromise(promise) {
  274. return promise.then(function (data) {
  275. return [null, data];
  276. }).
  277. catch(function (err) {return [err];});
  278. }
  279. function shouldPromise(name) {
  280. if (
  281. isContextApi(name) ||
  282. isSyncApi(name) ||
  283. isCallbackApi(name))
  284. {
  285. return false;
  286. }
  287. return true;
  288. }
  289. /* eslint-disable no-extend-native */
  290. if (!Promise.prototype.finally) {
  291. Promise.prototype.finally = function (callback) {
  292. var promise = this.constructor;
  293. return this.then(
  294. function (value) {return promise.resolve(callback()).then(function () {return value;});},
  295. function (reason) {return promise.resolve(callback()).then(function () {
  296. throw reason;
  297. });});
  298. };
  299. }
  300. function promisify(name, api) {
  301. if (!shouldPromise(name)) {
  302. return api;
  303. }
  304. return function promiseApi() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {params[_key2 - 1] = arguments[_key2];}
  305. if (isFn(options.success) || isFn(options.fail) || isFn(options.complete)) {
  306. return wrapperReturnValue(name, invokeApi.apply(void 0, [name, api, options].concat(params)));
  307. }
  308. return wrapperReturnValue(name, handlePromise(new Promise(function (resolve, reject) {
  309. invokeApi.apply(void 0, [name, api, Object.assign({}, options, {
  310. success: resolve,
  311. fail: reject })].concat(
  312. params));
  313. })));
  314. };
  315. }
  316. var EPS = 1e-4;
  317. var BASE_DEVICE_WIDTH = 750;
  318. var isIOS = false;
  319. var deviceWidth = 0;
  320. var deviceDPR = 0;
  321. function checkDeviceWidth() {var _wx$getSystemInfoSync =
  322. wx.getSystemInfoSync(),platform = _wx$getSystemInfoSync.platform,pixelRatio = _wx$getSystemInfoSync.pixelRatio,windowWidth = _wx$getSystemInfoSync.windowWidth; // uni=>wx runtime 编译目标是 uni 对象,内部不允许直接使用 uni
  323. deviceWidth = windowWidth;
  324. deviceDPR = pixelRatio;
  325. isIOS = platform === 'ios';
  326. }
  327. function upx2px(number, newDeviceWidth) {
  328. if (deviceWidth === 0) {
  329. checkDeviceWidth();
  330. }
  331. number = Number(number);
  332. if (number === 0) {
  333. return 0;
  334. }
  335. var result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth);
  336. if (result < 0) {
  337. result = -result;
  338. }
  339. result = Math.floor(result + EPS);
  340. if (result === 0) {
  341. if (deviceDPR === 1 || !isIOS) {
  342. result = 1;
  343. } else {
  344. result = 0.5;
  345. }
  346. }
  347. return number < 0 ? -result : result;
  348. }
  349. var interceptors = {
  350. promiseInterceptor: promiseInterceptor };
  351. var baseApi = /*#__PURE__*/Object.freeze({
  352. __proto__: null,
  353. upx2px: upx2px,
  354. addInterceptor: addInterceptor,
  355. removeInterceptor: removeInterceptor,
  356. interceptors: interceptors });
  357. function findExistsPageIndex(url) {
  358. var pages = getCurrentPages();
  359. var len = pages.length;
  360. while (len--) {
  361. var page = pages[len];
  362. if (page.$page && page.$page.fullPath === url) {
  363. return len;
  364. }
  365. }
  366. return -1;
  367. }
  368. var redirectTo = {
  369. name: function name(fromArgs) {
  370. if (fromArgs.exists === 'back' && fromArgs.delta) {
  371. return 'navigateBack';
  372. }
  373. return 'redirectTo';
  374. },
  375. args: function args(fromArgs) {
  376. if (fromArgs.exists === 'back' && fromArgs.url) {
  377. var existsPageIndex = findExistsPageIndex(fromArgs.url);
  378. if (existsPageIndex !== -1) {
  379. var delta = getCurrentPages().length - 1 - existsPageIndex;
  380. if (delta > 0) {
  381. fromArgs.delta = delta;
  382. }
  383. }
  384. }
  385. } };
  386. var previewImage = {
  387. args: function args(fromArgs) {
  388. var currentIndex = parseInt(fromArgs.current);
  389. if (isNaN(currentIndex)) {
  390. return;
  391. }
  392. var urls = fromArgs.urls;
  393. if (!Array.isArray(urls)) {
  394. return;
  395. }
  396. var len = urls.length;
  397. if (!len) {
  398. return;
  399. }
  400. if (currentIndex < 0) {
  401. currentIndex = 0;
  402. } else if (currentIndex >= len) {
  403. currentIndex = len - 1;
  404. }
  405. if (currentIndex > 0) {
  406. fromArgs.current = urls[currentIndex];
  407. fromArgs.urls = urls.filter(
  408. function (item, index) {return index < currentIndex ? item !== urls[currentIndex] : true;});
  409. } else {
  410. fromArgs.current = urls[0];
  411. }
  412. return {
  413. indicator: false,
  414. loop: false };
  415. } };
  416. var UUID_KEY = '__DC_STAT_UUID';
  417. var deviceId;
  418. function addUuid(result) {
  419. deviceId = deviceId || wx.getStorageSync(UUID_KEY);
  420. if (!deviceId) {
  421. deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7);
  422. wx.setStorage({
  423. key: UUID_KEY,
  424. data: deviceId });
  425. }
  426. result.deviceId = deviceId;
  427. }
  428. function addSafeAreaInsets(result) {
  429. if (result.safeArea) {
  430. var safeArea = result.safeArea;
  431. result.safeAreaInsets = {
  432. top: safeArea.top,
  433. left: safeArea.left,
  434. right: result.windowWidth - safeArea.right,
  435. bottom: result.windowHeight - safeArea.bottom };
  436. }
  437. }
  438. var getSystemInfo = {
  439. returnValue: function returnValue(result) {
  440. addUuid(result);
  441. addSafeAreaInsets(result);
  442. } };
  443. // import navigateTo from 'uni-helpers/navigate-to'
  444. var protocols = {
  445. redirectTo: redirectTo,
  446. // navigateTo, // 由于在微信开发者工具的页面参数,会显示__id__参数,因此暂时关闭mp-weixin对于navigateTo的AOP
  447. previewImage: previewImage,
  448. getSystemInfo: getSystemInfo,
  449. getSystemInfoSync: getSystemInfo };
  450. var todos = [
  451. 'vibrate',
  452. 'preloadPage',
  453. 'unPreloadPage',
  454. 'loadSubPackage'];
  455. var canIUses = [];
  456. var CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
  457. function processCallback(methodName, method, returnValue) {
  458. return function (res) {
  459. return method(processReturnValue(methodName, res, returnValue));
  460. };
  461. }
  462. function processArgs(methodName, fromArgs) {var argsOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};var returnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};var keepFromArgs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  463. if (isPlainObject(fromArgs)) {// 一般 api 的参数解析
  464. var toArgs = keepFromArgs === true ? fromArgs : {}; // returnValue 为 false 时,说明是格式化返回值,直接在返回值对象上修改赋值
  465. if (isFn(argsOption)) {
  466. argsOption = argsOption(fromArgs, toArgs) || {};
  467. }
  468. for (var key in fromArgs) {
  469. if (hasOwn(argsOption, key)) {
  470. var keyOption = argsOption[key];
  471. if (isFn(keyOption)) {
  472. keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
  473. }
  474. if (!keyOption) {// 不支持的参数
  475. console.warn("The '".concat(methodName, "' method of platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support option '").concat(key, "'"));
  476. } else if (isStr(keyOption)) {// 重写参数 key
  477. toArgs[keyOption] = fromArgs[key];
  478. } else if (isPlainObject(keyOption)) {// {name:newName,value:value}可重新指定参数 key:value
  479. toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
  480. }
  481. } else if (CALLBACKS.indexOf(key) !== -1) {
  482. if (isFn(fromArgs[key])) {
  483. toArgs[key] = processCallback(methodName, fromArgs[key], returnValue);
  484. }
  485. } else {
  486. if (!keepFromArgs) {
  487. toArgs[key] = fromArgs[key];
  488. }
  489. }
  490. }
  491. return toArgs;
  492. } else if (isFn(fromArgs)) {
  493. fromArgs = processCallback(methodName, fromArgs, returnValue);
  494. }
  495. return fromArgs;
  496. }
  497. function processReturnValue(methodName, res, returnValue) {var keepReturnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  498. if (isFn(protocols.returnValue)) {// 处理通用 returnValue
  499. res = protocols.returnValue(methodName, res);
  500. }
  501. return processArgs(methodName, res, returnValue, {}, keepReturnValue);
  502. }
  503. function wrapper(methodName, method) {
  504. if (hasOwn(protocols, methodName)) {
  505. var protocol = protocols[methodName];
  506. if (!protocol) {// 暂不支持的 api
  507. return function () {
  508. console.error("Platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support '".concat(methodName, "'."));
  509. };
  510. }
  511. return function (arg1, arg2) {// 目前 api 最多两个参数
  512. var options = protocol;
  513. if (isFn(protocol)) {
  514. options = protocol(arg1);
  515. }
  516. arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
  517. var args = [arg1];
  518. if (typeof arg2 !== 'undefined') {
  519. args.push(arg2);
  520. }
  521. if (isFn(options.name)) {
  522. methodName = options.name(arg1);
  523. } else if (isStr(options.name)) {
  524. methodName = options.name;
  525. }
  526. var returnValue = wx[methodName].apply(wx, args);
  527. if (isSyncApi(methodName)) {// 同步 api
  528. return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
  529. }
  530. return returnValue;
  531. };
  532. }
  533. return method;
  534. }
  535. var todoApis = Object.create(null);
  536. var TODOS = [
  537. 'onTabBarMidButtonTap',
  538. 'subscribePush',
  539. 'unsubscribePush',
  540. 'onPush',
  541. 'offPush',
  542. 'share'];
  543. function createTodoApi(name) {
  544. return function todoApi(_ref)
  545. {var fail = _ref.fail,complete = _ref.complete;
  546. var res = {
  547. errMsg: "".concat(name, ":fail method '").concat(name, "' not supported") };
  548. isFn(fail) && fail(res);
  549. isFn(complete) && complete(res);
  550. };
  551. }
  552. TODOS.forEach(function (name) {
  553. todoApis[name] = createTodoApi(name);
  554. });
  555. var providers = {
  556. oauth: ['weixin'],
  557. share: ['weixin'],
  558. payment: ['wxpay'],
  559. push: ['weixin'] };
  560. function getProvider(_ref2)
  561. {var service = _ref2.service,success = _ref2.success,fail = _ref2.fail,complete = _ref2.complete;
  562. var res = false;
  563. if (providers[service]) {
  564. res = {
  565. errMsg: 'getProvider:ok',
  566. service: service,
  567. provider: providers[service] };
  568. isFn(success) && success(res);
  569. } else {
  570. res = {
  571. errMsg: 'getProvider:fail service not found' };
  572. isFn(fail) && fail(res);
  573. }
  574. isFn(complete) && complete(res);
  575. }
  576. var extraApi = /*#__PURE__*/Object.freeze({
  577. __proto__: null,
  578. getProvider: getProvider });
  579. var getEmitter = function () {
  580. var Emitter;
  581. return function getUniEmitter() {
  582. if (!Emitter) {
  583. Emitter = new _vue.default();
  584. }
  585. return Emitter;
  586. };
  587. }();
  588. function apply(ctx, method, args) {
  589. return ctx[method].apply(ctx, args);
  590. }
  591. function $on() {
  592. return apply(getEmitter(), '$on', Array.prototype.slice.call(arguments));
  593. }
  594. function $off() {
  595. return apply(getEmitter(), '$off', Array.prototype.slice.call(arguments));
  596. }
  597. function $once() {
  598. return apply(getEmitter(), '$once', Array.prototype.slice.call(arguments));
  599. }
  600. function $emit() {
  601. return apply(getEmitter(), '$emit', Array.prototype.slice.call(arguments));
  602. }
  603. var eventApi = /*#__PURE__*/Object.freeze({
  604. __proto__: null,
  605. $on: $on,
  606. $off: $off,
  607. $once: $once,
  608. $emit: $emit });
  609. var api = /*#__PURE__*/Object.freeze({
  610. __proto__: null });
  611. var MPPage = Page;
  612. var MPComponent = Component;
  613. var customizeRE = /:/g;
  614. var customize = cached(function (str) {
  615. return camelize(str.replace(customizeRE, '-'));
  616. });
  617. function initTriggerEvent(mpInstance) {
  618. {
  619. if (!wx.canIUse || !wx.canIUse('nextTick')) {
  620. return;
  621. }
  622. }
  623. var oldTriggerEvent = mpInstance.triggerEvent;
  624. mpInstance.triggerEvent = function (event) {for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {args[_key3 - 1] = arguments[_key3];}
  625. return oldTriggerEvent.apply(mpInstance, [customize(event)].concat(args));
  626. };
  627. }
  628. function initHook(name, options) {
  629. var oldHook = options[name];
  630. if (!oldHook) {
  631. options[name] = function () {
  632. initTriggerEvent(this);
  633. };
  634. } else {
  635. options[name] = function () {
  636. initTriggerEvent(this);for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {args[_key4] = arguments[_key4];}
  637. return oldHook.apply(this, args);
  638. };
  639. }
  640. }
  641. if (!MPPage.__$wrappered) {
  642. MPPage.__$wrappered = true;
  643. Page = function Page() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  644. initHook('onLoad', options);
  645. return MPPage(options);
  646. };
  647. Page.after = MPPage.after;
  648. Component = function Component() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  649. initHook('created', options);
  650. return MPComponent(options);
  651. };
  652. }
  653. var PAGE_EVENT_HOOKS = [
  654. 'onPullDownRefresh',
  655. 'onReachBottom',
  656. 'onAddToFavorites',
  657. 'onShareTimeline',
  658. 'onShareAppMessage',
  659. 'onPageScroll',
  660. 'onResize',
  661. 'onTabItemTap'];
  662. function initMocks(vm, mocks) {
  663. var mpInstance = vm.$mp[vm.mpType];
  664. mocks.forEach(function (mock) {
  665. if (hasOwn(mpInstance, mock)) {
  666. vm[mock] = mpInstance[mock];
  667. }
  668. });
  669. }
  670. function hasHook(hook, vueOptions) {
  671. if (!vueOptions) {
  672. return true;
  673. }
  674. if (_vue.default.options && Array.isArray(_vue.default.options[hook])) {
  675. return true;
  676. }
  677. vueOptions = vueOptions.default || vueOptions;
  678. if (isFn(vueOptions)) {
  679. if (isFn(vueOptions.extendOptions[hook])) {
  680. return true;
  681. }
  682. if (vueOptions.super &&
  683. vueOptions.super.options &&
  684. Array.isArray(vueOptions.super.options[hook])) {
  685. return true;
  686. }
  687. return false;
  688. }
  689. if (isFn(vueOptions[hook])) {
  690. return true;
  691. }
  692. var mixins = vueOptions.mixins;
  693. if (Array.isArray(mixins)) {
  694. return !!mixins.find(function (mixin) {return hasHook(hook, mixin);});
  695. }
  696. }
  697. function initHooks(mpOptions, hooks, vueOptions) {
  698. hooks.forEach(function (hook) {
  699. if (hasHook(hook, vueOptions)) {
  700. mpOptions[hook] = function (args) {
  701. return this.$vm && this.$vm.__call_hook(hook, args);
  702. };
  703. }
  704. });
  705. }
  706. function initVueComponent(Vue, vueOptions) {
  707. vueOptions = vueOptions.default || vueOptions;
  708. var VueComponent;
  709. if (isFn(vueOptions)) {
  710. VueComponent = vueOptions;
  711. } else {
  712. VueComponent = Vue.extend(vueOptions);
  713. }
  714. vueOptions = VueComponent.options;
  715. return [VueComponent, vueOptions];
  716. }
  717. function initSlots(vm, vueSlots) {
  718. if (Array.isArray(vueSlots) && vueSlots.length) {
  719. var $slots = Object.create(null);
  720. vueSlots.forEach(function (slotName) {
  721. $slots[slotName] = true;
  722. });
  723. vm.$scopedSlots = vm.$slots = $slots;
  724. }
  725. }
  726. function initVueIds(vueIds, mpInstance) {
  727. vueIds = (vueIds || '').split(',');
  728. var len = vueIds.length;
  729. if (len === 1) {
  730. mpInstance._$vueId = vueIds[0];
  731. } else if (len === 2) {
  732. mpInstance._$vueId = vueIds[0];
  733. mpInstance._$vuePid = vueIds[1];
  734. }
  735. }
  736. function initData(vueOptions, context) {
  737. var data = vueOptions.data || {};
  738. var methods = vueOptions.methods || {};
  739. if (typeof data === 'function') {
  740. try {
  741. data = data.call(context); // 支持 Vue.prototype 上挂的数据
  742. } catch (e) {
  743. if (Object({"VUE_APP_NAME":"qc-luckyDraw","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  744. console.warn('根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。', data);
  745. }
  746. }
  747. } else {
  748. try {
  749. // 对 data 格式化
  750. data = JSON.parse(JSON.stringify(data));
  751. } catch (e) {}
  752. }
  753. if (!isPlainObject(data)) {
  754. data = {};
  755. }
  756. Object.keys(methods).forEach(function (methodName) {
  757. if (context.__lifecycle_hooks__.indexOf(methodName) === -1 && !hasOwn(data, methodName)) {
  758. data[methodName] = methods[methodName];
  759. }
  760. });
  761. return data;
  762. }
  763. var PROP_TYPES = [String, Number, Boolean, Object, Array, null];
  764. function createObserver(name) {
  765. return function observer(newVal, oldVal) {
  766. if (this.$vm) {
  767. this.$vm[name] = newVal; // 为了触发其他非 render watcher
  768. }
  769. };
  770. }
  771. function initBehaviors(vueOptions, initBehavior) {
  772. var vueBehaviors = vueOptions.behaviors;
  773. var vueExtends = vueOptions.extends;
  774. var vueMixins = vueOptions.mixins;
  775. var vueProps = vueOptions.props;
  776. if (!vueProps) {
  777. vueOptions.props = vueProps = [];
  778. }
  779. var behaviors = [];
  780. if (Array.isArray(vueBehaviors)) {
  781. vueBehaviors.forEach(function (behavior) {
  782. behaviors.push(behavior.replace('uni://', "wx".concat("://")));
  783. if (behavior === 'uni://form-field') {
  784. if (Array.isArray(vueProps)) {
  785. vueProps.push('name');
  786. vueProps.push('value');
  787. } else {
  788. vueProps.name = {
  789. type: String,
  790. default: '' };
  791. vueProps.value = {
  792. type: [String, Number, Boolean, Array, Object, Date],
  793. default: '' };
  794. }
  795. }
  796. });
  797. }
  798. if (isPlainObject(vueExtends) && vueExtends.props) {
  799. behaviors.push(
  800. initBehavior({
  801. properties: initProperties(vueExtends.props, true) }));
  802. }
  803. if (Array.isArray(vueMixins)) {
  804. vueMixins.forEach(function (vueMixin) {
  805. if (isPlainObject(vueMixin) && vueMixin.props) {
  806. behaviors.push(
  807. initBehavior({
  808. properties: initProperties(vueMixin.props, true) }));
  809. }
  810. });
  811. }
  812. return behaviors;
  813. }
  814. function parsePropType(key, type, defaultValue, file) {
  815. // [String]=>String
  816. if (Array.isArray(type) && type.length === 1) {
  817. return type[0];
  818. }
  819. return type;
  820. }
  821. function initProperties(props) {var isBehavior = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;var file = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
  822. var properties = {};
  823. if (!isBehavior) {
  824. properties.vueId = {
  825. type: String,
  826. value: '' };
  827. // 用于字节跳动小程序模拟抽象节点
  828. properties.generic = {
  829. type: Object,
  830. value: null };
  831. // scopedSlotsCompiler auto
  832. properties.scopedSlotsCompiler = {
  833. type: String,
  834. value: '' };
  835. properties.vueSlots = { // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
  836. type: null,
  837. value: [],
  838. observer: function observer(newVal, oldVal) {
  839. var $slots = Object.create(null);
  840. newVal.forEach(function (slotName) {
  841. $slots[slotName] = true;
  842. });
  843. this.setData({
  844. $slots: $slots });
  845. } };
  846. }
  847. if (Array.isArray(props)) {// ['title']
  848. props.forEach(function (key) {
  849. properties[key] = {
  850. type: null,
  851. observer: createObserver(key) };
  852. });
  853. } else if (isPlainObject(props)) {// {title:{type:String,default:''},content:String}
  854. Object.keys(props).forEach(function (key) {
  855. var opts = props[key];
  856. if (isPlainObject(opts)) {// title:{type:String,default:''}
  857. var value = opts.default;
  858. if (isFn(value)) {
  859. value = value();
  860. }
  861. opts.type = parsePropType(key, opts.type);
  862. properties[key] = {
  863. type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
  864. value: value,
  865. observer: createObserver(key) };
  866. } else {// content:String
  867. var type = parsePropType(key, opts);
  868. properties[key] = {
  869. type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
  870. observer: createObserver(key) };
  871. }
  872. });
  873. }
  874. return properties;
  875. }
  876. function wrapper$1(event) {
  877. // TODO 又得兼容 mpvue 的 mp 对象
  878. try {
  879. event.mp = JSON.parse(JSON.stringify(event));
  880. } catch (e) {}
  881. event.stopPropagation = noop;
  882. event.preventDefault = noop;
  883. event.target = event.target || {};
  884. if (!hasOwn(event, 'detail')) {
  885. event.detail = {};
  886. }
  887. if (hasOwn(event, 'markerId')) {
  888. event.detail = typeof event.detail === 'object' ? event.detail : {};
  889. event.detail.markerId = event.markerId;
  890. }
  891. if (isPlainObject(event.detail)) {
  892. event.target = Object.assign({}, event.target, event.detail);
  893. }
  894. return event;
  895. }
  896. function getExtraValue(vm, dataPathsArray) {
  897. var context = vm;
  898. dataPathsArray.forEach(function (dataPathArray) {
  899. var dataPath = dataPathArray[0];
  900. var value = dataPathArray[2];
  901. if (dataPath || typeof value !== 'undefined') {// ['','',index,'disable']
  902. var propPath = dataPathArray[1];
  903. var valuePath = dataPathArray[3];
  904. var vFor;
  905. if (Number.isInteger(dataPath)) {
  906. vFor = dataPath;
  907. } else if (!dataPath) {
  908. vFor = context;
  909. } else if (typeof dataPath === 'string' && dataPath) {
  910. if (dataPath.indexOf('#s#') === 0) {
  911. vFor = dataPath.substr(3);
  912. } else {
  913. vFor = vm.__get_value(dataPath, context);
  914. }
  915. }
  916. if (Number.isInteger(vFor)) {
  917. context = value;
  918. } else if (!propPath) {
  919. context = vFor[value];
  920. } else {
  921. if (Array.isArray(vFor)) {
  922. context = vFor.find(function (vForItem) {
  923. return vm.__get_value(propPath, vForItem) === value;
  924. });
  925. } else if (isPlainObject(vFor)) {
  926. context = Object.keys(vFor).find(function (vForKey) {
  927. return vm.__get_value(propPath, vFor[vForKey]) === value;
  928. });
  929. } else {
  930. console.error('v-for 暂不支持循环数据:', vFor);
  931. }
  932. }
  933. if (valuePath) {
  934. context = vm.__get_value(valuePath, context);
  935. }
  936. }
  937. });
  938. return context;
  939. }
  940. function processEventExtra(vm, extra, event) {
  941. var extraObj = {};
  942. if (Array.isArray(extra) && extra.length) {
  943. /**
  944. *[
  945. * ['data.items', 'data.id', item.data.id],
  946. * ['metas', 'id', meta.id]
  947. *],
  948. *[
  949. * ['data.items', 'data.id', item.data.id],
  950. * ['metas', 'id', meta.id]
  951. *],
  952. *'test'
  953. */
  954. extra.forEach(function (dataPath, index) {
  955. if (typeof dataPath === 'string') {
  956. if (!dataPath) {// model,prop.sync
  957. extraObj['$' + index] = vm;
  958. } else {
  959. if (dataPath === '$event') {// $event
  960. extraObj['$' + index] = event;
  961. } else if (dataPath === 'arguments') {
  962. if (event.detail && event.detail.__args__) {
  963. extraObj['$' + index] = event.detail.__args__;
  964. } else {
  965. extraObj['$' + index] = [event];
  966. }
  967. } else if (dataPath.indexOf('$event.') === 0) {// $event.target.value
  968. extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
  969. } else {
  970. extraObj['$' + index] = vm.__get_value(dataPath);
  971. }
  972. }
  973. } else {
  974. extraObj['$' + index] = getExtraValue(vm, dataPath);
  975. }
  976. });
  977. }
  978. return extraObj;
  979. }
  980. function getObjByArray(arr) {
  981. var obj = {};
  982. for (var i = 1; i < arr.length; i++) {
  983. var element = arr[i];
  984. obj[element[0]] = element[1];
  985. }
  986. return obj;
  987. }
  988. function processEventArgs(vm, event) {var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];var extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];var isCustom = arguments.length > 4 ? arguments[4] : undefined;var methodName = arguments.length > 5 ? arguments[5] : undefined;
  989. var isCustomMPEvent = false; // wxcomponent 组件,传递原始 event 对象
  990. if (isCustom) {// 自定义事件
  991. isCustomMPEvent = event.currentTarget &&
  992. event.currentTarget.dataset &&
  993. event.currentTarget.dataset.comType === 'wx';
  994. if (!args.length) {// 无参数,直接传入 event 或 detail 数组
  995. if (isCustomMPEvent) {
  996. return [event];
  997. }
  998. return event.detail.__args__ || event.detail;
  999. }
  1000. }
  1001. var extraObj = processEventExtra(vm, extra, event);
  1002. var ret = [];
  1003. args.forEach(function (arg) {
  1004. if (arg === '$event') {
  1005. if (methodName === '__set_model' && !isCustom) {// input v-model value
  1006. ret.push(event.target.value);
  1007. } else {
  1008. if (isCustom && !isCustomMPEvent) {
  1009. ret.push(event.detail.__args__[0]);
  1010. } else {// wxcomponent 组件或内置组件
  1011. ret.push(event);
  1012. }
  1013. }
  1014. } else {
  1015. if (Array.isArray(arg) && arg[0] === 'o') {
  1016. ret.push(getObjByArray(arg));
  1017. } else if (typeof arg === 'string' && hasOwn(extraObj, arg)) {
  1018. ret.push(extraObj[arg]);
  1019. } else {
  1020. ret.push(arg);
  1021. }
  1022. }
  1023. });
  1024. return ret;
  1025. }
  1026. var ONCE = '~';
  1027. var CUSTOM = '^';
  1028. function isMatchEventType(eventType, optType) {
  1029. return eventType === optType ||
  1030. optType === 'regionchange' && (
  1031. eventType === 'begin' ||
  1032. eventType === 'end');
  1033. }
  1034. function getContextVm(vm) {
  1035. var $parent = vm.$parent;
  1036. // 父组件是 scoped slots 或者其他自定义组件时继续查找
  1037. while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) {
  1038. $parent = $parent.$parent;
  1039. }
  1040. return $parent && $parent.$parent;
  1041. }
  1042. function handleEvent(event) {var _this = this;
  1043. event = wrapper$1(event);
  1044. // [['tap',[['handle',[1,2,a]],['handle1',[1,2,a]]]]]
  1045. var dataset = (event.currentTarget || event.target).dataset;
  1046. if (!dataset) {
  1047. return console.warn('事件信息不存在');
  1048. }
  1049. var eventOpts = dataset.eventOpts || dataset['event-opts']; // 支付宝 web-view 组件 dataset 非驼峰
  1050. if (!eventOpts) {
  1051. return console.warn('事件信息不存在');
  1052. }
  1053. // [['handle',[1,2,a]],['handle1',[1,2,a]]]
  1054. var eventType = event.type;
  1055. var ret = [];
  1056. eventOpts.forEach(function (eventOpt) {
  1057. var type = eventOpt[0];
  1058. var eventsArray = eventOpt[1];
  1059. var isCustom = type.charAt(0) === CUSTOM;
  1060. type = isCustom ? type.slice(1) : type;
  1061. var isOnce = type.charAt(0) === ONCE;
  1062. type = isOnce ? type.slice(1) : type;
  1063. if (eventsArray && isMatchEventType(eventType, type)) {
  1064. eventsArray.forEach(function (eventArray) {
  1065. var methodName = eventArray[0];
  1066. if (methodName) {
  1067. var handlerCtx = _this.$vm;
  1068. if (handlerCtx.$options.generic) {// mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
  1069. handlerCtx = getContextVm(handlerCtx) || handlerCtx;
  1070. }
  1071. if (methodName === '$emit') {
  1072. handlerCtx.$emit.apply(handlerCtx,
  1073. processEventArgs(
  1074. _this.$vm,
  1075. event,
  1076. eventArray[1],
  1077. eventArray[2],
  1078. isCustom,
  1079. methodName));
  1080. return;
  1081. }
  1082. var handler = handlerCtx[methodName];
  1083. if (!isFn(handler)) {
  1084. throw new Error(" _vm.".concat(methodName, " is not a function"));
  1085. }
  1086. if (isOnce) {
  1087. if (handler.once) {
  1088. return;
  1089. }
  1090. handler.once = true;
  1091. }
  1092. var params = processEventArgs(
  1093. _this.$vm,
  1094. event,
  1095. eventArray[1],
  1096. eventArray[2],
  1097. isCustom,
  1098. methodName);
  1099. params = Array.isArray(params) ? params : [];
  1100. // 参数尾部增加原始事件对象用于复杂表达式内获取额外数据
  1101. if (/=\s*\S+\.eventParams\s*\|\|\s*\S+\[['"]event-params['"]\]/.test(handler.toString())) {
  1102. // eslint-disable-next-line no-sparse-arrays
  1103. params = params.concat([,,,,,,,,,, event]);
  1104. }
  1105. ret.push(handler.apply(handlerCtx, params));
  1106. }
  1107. });
  1108. }
  1109. });
  1110. if (
  1111. eventType === 'input' &&
  1112. ret.length === 1 &&
  1113. typeof ret[0] !== 'undefined')
  1114. {
  1115. return ret[0];
  1116. }
  1117. }
  1118. var eventChannels = {};
  1119. var eventChannelStack = [];
  1120. function getEventChannel(id) {
  1121. if (id) {
  1122. var eventChannel = eventChannels[id];
  1123. delete eventChannels[id];
  1124. return eventChannel;
  1125. }
  1126. return eventChannelStack.shift();
  1127. }
  1128. var hooks = [
  1129. 'onShow',
  1130. 'onHide',
  1131. 'onError',
  1132. 'onPageNotFound',
  1133. 'onThemeChange',
  1134. 'onUnhandledRejection'];
  1135. function initEventChannel() {
  1136. _vue.default.prototype.getOpenerEventChannel = function () {
  1137. // 微信小程序使用自身getOpenerEventChannel
  1138. {
  1139. return this.$scope.getOpenerEventChannel();
  1140. }
  1141. };
  1142. var callHook = _vue.default.prototype.__call_hook;
  1143. _vue.default.prototype.__call_hook = function (hook, args) {
  1144. if (hook === 'onLoad' && args && args.__id__) {
  1145. this.__eventChannel__ = getEventChannel(args.__id__);
  1146. delete args.__id__;
  1147. }
  1148. return callHook.call(this, hook, args);
  1149. };
  1150. }
  1151. function initScopedSlotsParams() {
  1152. var center = {};
  1153. var parents = {};
  1154. _vue.default.prototype.$hasScopedSlotsParams = function (vueId) {
  1155. var has = center[vueId];
  1156. if (!has) {
  1157. parents[vueId] = this;
  1158. this.$on('hook:destory', function () {
  1159. delete parents[vueId];
  1160. });
  1161. }
  1162. return has;
  1163. };
  1164. _vue.default.prototype.$getScopedSlotsParams = function (vueId, name, key) {
  1165. var data = center[vueId];
  1166. if (data) {
  1167. var object = data[name] || {};
  1168. return key ? object[key] : object;
  1169. } else {
  1170. parents[vueId] = this;
  1171. this.$on('hook:destory', function () {
  1172. delete parents[vueId];
  1173. });
  1174. }
  1175. };
  1176. _vue.default.prototype.$setScopedSlotsParams = function (name, value) {
  1177. var vueIds = this.$options.propsData.vueId;
  1178. if (vueIds) {
  1179. var vueId = vueIds.split(',')[0];
  1180. var object = center[vueId] = center[vueId] || {};
  1181. object[name] = value;
  1182. if (parents[vueId]) {
  1183. parents[vueId].$forceUpdate();
  1184. }
  1185. }
  1186. };
  1187. _vue.default.mixin({
  1188. destroyed: function destroyed() {
  1189. var propsData = this.$options.propsData;
  1190. var vueId = propsData && propsData.vueId;
  1191. if (vueId) {
  1192. delete center[vueId];
  1193. delete parents[vueId];
  1194. }
  1195. } });
  1196. }
  1197. function parseBaseApp(vm, _ref3)
  1198. {var mocks = _ref3.mocks,initRefs = _ref3.initRefs;
  1199. initEventChannel();
  1200. {
  1201. initScopedSlotsParams();
  1202. }
  1203. if (vm.$options.store) {
  1204. _vue.default.prototype.$store = vm.$options.store;
  1205. }
  1206. uniIdMixin(_vue.default);
  1207. _vue.default.prototype.mpHost = "mp-weixin";
  1208. _vue.default.mixin({
  1209. beforeCreate: function beforeCreate() {
  1210. if (!this.$options.mpType) {
  1211. return;
  1212. }
  1213. this.mpType = this.$options.mpType;
  1214. this.$mp = _defineProperty({
  1215. data: {} },
  1216. this.mpType, this.$options.mpInstance);
  1217. this.$scope = this.$options.mpInstance;
  1218. delete this.$options.mpType;
  1219. delete this.$options.mpInstance;
  1220. if (this.mpType === 'page' && typeof getApp === 'function') {// hack vue-i18n
  1221. var app = getApp();
  1222. if (app.$vm && app.$vm.$i18n) {
  1223. this._i18n = app.$vm.$i18n;
  1224. }
  1225. }
  1226. if (this.mpType !== 'app') {
  1227. initRefs(this);
  1228. initMocks(this, mocks);
  1229. }
  1230. } });
  1231. var appOptions = {
  1232. onLaunch: function onLaunch(args) {
  1233. if (this.$vm) {// 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
  1234. return;
  1235. }
  1236. {
  1237. if (wx.canIUse && !wx.canIUse('nextTick')) {// 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断
  1238. console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上');
  1239. }
  1240. }
  1241. this.$vm = vm;
  1242. this.$vm.$mp = {
  1243. app: this };
  1244. this.$vm.$scope = this;
  1245. // vm 上也挂载 globalData
  1246. this.$vm.globalData = this.globalData;
  1247. this.$vm._isMounted = true;
  1248. this.$vm.__call_hook('mounted', args);
  1249. this.$vm.__call_hook('onLaunch', args);
  1250. } };
  1251. // 兼容旧版本 globalData
  1252. appOptions.globalData = vm.$options.globalData || {};
  1253. // 将 methods 中的方法挂在 getApp() 中
  1254. var methods = vm.$options.methods;
  1255. if (methods) {
  1256. Object.keys(methods).forEach(function (name) {
  1257. appOptions[name] = methods[name];
  1258. });
  1259. }
  1260. initHooks(appOptions, hooks);
  1261. return appOptions;
  1262. }
  1263. var mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
  1264. function findVmByVueId(vm, vuePid) {
  1265. var $children = vm.$children;
  1266. // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
  1267. for (var i = $children.length - 1; i >= 0; i--) {
  1268. var childVm = $children[i];
  1269. if (childVm.$scope._$vueId === vuePid) {
  1270. return childVm;
  1271. }
  1272. }
  1273. // 反向递归查找
  1274. var parentVm;
  1275. for (var _i = $children.length - 1; _i >= 0; _i--) {
  1276. parentVm = findVmByVueId($children[_i], vuePid);
  1277. if (parentVm) {
  1278. return parentVm;
  1279. }
  1280. }
  1281. }
  1282. function initBehavior(options) {
  1283. return Behavior(options);
  1284. }
  1285. function isPage() {
  1286. return !!this.route;
  1287. }
  1288. function initRelation(detail) {
  1289. this.triggerEvent('__l', detail);
  1290. }
  1291. function selectAllComponents(mpInstance, selector, $refs) {
  1292. var components = mpInstance.selectAllComponents(selector);
  1293. components.forEach(function (component) {
  1294. var ref = component.dataset.ref;
  1295. $refs[ref] = component.$vm || component;
  1296. {
  1297. if (component.dataset.vueGeneric === 'scoped') {
  1298. component.selectAllComponents('.scoped-ref').forEach(function (scopedComponent) {
  1299. selectAllComponents(scopedComponent, selector, $refs);
  1300. });
  1301. }
  1302. }
  1303. });
  1304. }
  1305. function initRefs(vm) {
  1306. var mpInstance = vm.$scope;
  1307. Object.defineProperty(vm, '$refs', {
  1308. get: function get() {
  1309. var $refs = {};
  1310. selectAllComponents(mpInstance, '.vue-ref', $refs);
  1311. // TODO 暂不考虑 for 中的 scoped
  1312. var forComponents = mpInstance.selectAllComponents('.vue-ref-in-for');
  1313. forComponents.forEach(function (component) {
  1314. var ref = component.dataset.ref;
  1315. if (!$refs[ref]) {
  1316. $refs[ref] = [];
  1317. }
  1318. $refs[ref].push(component.$vm || component);
  1319. });
  1320. return $refs;
  1321. } });
  1322. }
  1323. function handleLink(event) {var _ref4 =
  1324. event.detail || event.value,vuePid = _ref4.vuePid,vueOptions = _ref4.vueOptions; // detail 是微信,value 是百度(dipatch)
  1325. var parentVm;
  1326. if (vuePid) {
  1327. parentVm = findVmByVueId(this.$vm, vuePid);
  1328. }
  1329. if (!parentVm) {
  1330. parentVm = this.$vm;
  1331. }
  1332. vueOptions.parent = parentVm;
  1333. }
  1334. function parseApp(vm) {
  1335. return parseBaseApp(vm, {
  1336. mocks: mocks,
  1337. initRefs: initRefs });
  1338. }
  1339. function createApp(vm) {
  1340. App(parseApp(vm));
  1341. return vm;
  1342. }
  1343. var encodeReserveRE = /[!'()*]/g;
  1344. var encodeReserveReplacer = function encodeReserveReplacer(c) {return '%' + c.charCodeAt(0).toString(16);};
  1345. var commaRE = /%2C/g;
  1346. // fixed encodeURIComponent which is more conformant to RFC3986:
  1347. // - escapes [!'()*]
  1348. // - preserve commas
  1349. var encode = function encode(str) {return encodeURIComponent(str).
  1350. replace(encodeReserveRE, encodeReserveReplacer).
  1351. replace(commaRE, ',');};
  1352. function stringifyQuery(obj) {var encodeStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : encode;
  1353. var res = obj ? Object.keys(obj).map(function (key) {
  1354. var val = obj[key];
  1355. if (val === undefined) {
  1356. return '';
  1357. }
  1358. if (val === null) {
  1359. return encodeStr(key);
  1360. }
  1361. if (Array.isArray(val)) {
  1362. var result = [];
  1363. val.forEach(function (val2) {
  1364. if (val2 === undefined) {
  1365. return;
  1366. }
  1367. if (val2 === null) {
  1368. result.push(encodeStr(key));
  1369. } else {
  1370. result.push(encodeStr(key) + '=' + encodeStr(val2));
  1371. }
  1372. });
  1373. return result.join('&');
  1374. }
  1375. return encodeStr(key) + '=' + encodeStr(val);
  1376. }).filter(function (x) {return x.length > 0;}).join('&') : null;
  1377. return res ? "?".concat(res) : '';
  1378. }
  1379. function parseBaseComponent(vueComponentOptions)
  1380. {var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},isPage = _ref5.isPage,initRelation = _ref5.initRelation;var _initVueComponent =
  1381. initVueComponent(_vue.default, vueComponentOptions),_initVueComponent2 = _slicedToArray(_initVueComponent, 2),VueComponent = _initVueComponent2[0],vueOptions = _initVueComponent2[1];
  1382. var options = _objectSpread({
  1383. multipleSlots: true,
  1384. addGlobalClass: true },
  1385. vueOptions.options || {});
  1386. {
  1387. // 微信 multipleSlots 部分情况有 bug,导致内容顺序错乱 如 u-list,提供覆盖选项
  1388. if (vueOptions['mp-weixin'] && vueOptions['mp-weixin'].options) {
  1389. Object.assign(options, vueOptions['mp-weixin'].options);
  1390. }
  1391. }
  1392. var componentOptions = {
  1393. options: options,
  1394. data: initData(vueOptions, _vue.default.prototype),
  1395. behaviors: initBehaviors(vueOptions, initBehavior),
  1396. properties: initProperties(vueOptions.props, false, vueOptions.__file),
  1397. lifetimes: {
  1398. attached: function attached() {
  1399. var properties = this.properties;
  1400. var options = {
  1401. mpType: isPage.call(this) ? 'page' : 'component',
  1402. mpInstance: this,
  1403. propsData: properties };
  1404. initVueIds(properties.vueId, this);
  1405. // 处理父子关系
  1406. initRelation.call(this, {
  1407. vuePid: this._$vuePid,
  1408. vueOptions: options });
  1409. // 初始化 vue 实例
  1410. this.$vm = new VueComponent(options);
  1411. // 处理$slots,$scopedSlots(暂不支持动态变化$slots)
  1412. initSlots(this.$vm, properties.vueSlots);
  1413. // 触发首次 setData
  1414. this.$vm.$mount();
  1415. },
  1416. ready: function ready() {
  1417. // 当组件 props 默认值为 true,初始化时传入 false 会导致 created,ready 触发, 但 attached 不触发
  1418. // https://developers.weixin.qq.com/community/develop/doc/00066ae2844cc0f8eb883e2a557800
  1419. if (this.$vm) {
  1420. this.$vm._isMounted = true;
  1421. this.$vm.__call_hook('mounted');
  1422. this.$vm.__call_hook('onReady');
  1423. }
  1424. },
  1425. detached: function detached() {
  1426. this.$vm && this.$vm.$destroy();
  1427. } },
  1428. pageLifetimes: {
  1429. show: function show(args) {
  1430. this.$vm && this.$vm.__call_hook('onPageShow', args);
  1431. },
  1432. hide: function hide() {
  1433. this.$vm && this.$vm.__call_hook('onPageHide');
  1434. },
  1435. resize: function resize(size) {
  1436. this.$vm && this.$vm.__call_hook('onPageResize', size);
  1437. } },
  1438. methods: {
  1439. __l: handleLink,
  1440. __e: handleEvent } };
  1441. // externalClasses
  1442. if (vueOptions.externalClasses) {
  1443. componentOptions.externalClasses = vueOptions.externalClasses;
  1444. }
  1445. if (Array.isArray(vueOptions.wxsCallMethods)) {
  1446. vueOptions.wxsCallMethods.forEach(function (callMethod) {
  1447. componentOptions.methods[callMethod] = function (args) {
  1448. return this.$vm[callMethod](args);
  1449. };
  1450. });
  1451. }
  1452. if (isPage) {
  1453. return componentOptions;
  1454. }
  1455. return [componentOptions, VueComponent];
  1456. }
  1457. function parseComponent(vueComponentOptions) {
  1458. return parseBaseComponent(vueComponentOptions, {
  1459. isPage: isPage,
  1460. initRelation: initRelation });
  1461. }
  1462. var hooks$1 = [
  1463. 'onShow',
  1464. 'onHide',
  1465. 'onUnload'];
  1466. hooks$1.push.apply(hooks$1, PAGE_EVENT_HOOKS);
  1467. function parseBasePage(vuePageOptions, _ref6)
  1468. {var isPage = _ref6.isPage,initRelation = _ref6.initRelation;
  1469. var pageOptions = parseComponent(vuePageOptions);
  1470. initHooks(pageOptions.methods, hooks$1, vuePageOptions);
  1471. pageOptions.methods.onLoad = function (query) {
  1472. this.options = query;
  1473. var copyQuery = Object.assign({}, query);
  1474. delete copyQuery.__id__;
  1475. this.$page = {
  1476. fullPath: '/' + (this.route || this.is) + stringifyQuery(copyQuery) };
  1477. this.$vm.$mp.query = query; // 兼容 mpvue
  1478. this.$vm.__call_hook('onLoad', query);
  1479. };
  1480. return pageOptions;
  1481. }
  1482. function parsePage(vuePageOptions) {
  1483. return parseBasePage(vuePageOptions, {
  1484. isPage: isPage,
  1485. initRelation: initRelation });
  1486. }
  1487. function createPage(vuePageOptions) {
  1488. {
  1489. return Component(parsePage(vuePageOptions));
  1490. }
  1491. }
  1492. function createComponent(vueOptions) {
  1493. {
  1494. return Component(parseComponent(vueOptions));
  1495. }
  1496. }
  1497. function createSubpackageApp(vm) {
  1498. var appOptions = parseApp(vm);
  1499. var app = getApp({
  1500. allowDefault: true });
  1501. vm.$scope = app;
  1502. var globalData = app.globalData;
  1503. if (globalData) {
  1504. Object.keys(appOptions.globalData).forEach(function (name) {
  1505. if (!hasOwn(globalData, name)) {
  1506. globalData[name] = appOptions.globalData[name];
  1507. }
  1508. });
  1509. }
  1510. Object.keys(appOptions).forEach(function (name) {
  1511. if (!hasOwn(app, name)) {
  1512. app[name] = appOptions[name];
  1513. }
  1514. });
  1515. if (isFn(appOptions.onShow) && wx.onAppShow) {
  1516. wx.onAppShow(function () {for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {args[_key5] = arguments[_key5];}
  1517. vm.__call_hook('onShow', args);
  1518. });
  1519. }
  1520. if (isFn(appOptions.onHide) && wx.onAppHide) {
  1521. wx.onAppHide(function () {for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {args[_key6] = arguments[_key6];}
  1522. vm.__call_hook('onHide', args);
  1523. });
  1524. }
  1525. if (isFn(appOptions.onLaunch)) {
  1526. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  1527. vm.__call_hook('onLaunch', args);
  1528. }
  1529. return vm;
  1530. }
  1531. function createPlugin(vm) {
  1532. var appOptions = parseApp(vm);
  1533. if (isFn(appOptions.onShow) && wx.onAppShow) {
  1534. wx.onAppShow(function () {for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {args[_key7] = arguments[_key7];}
  1535. appOptions.onShow.apply(vm, args);
  1536. });
  1537. }
  1538. if (isFn(appOptions.onHide) && wx.onAppHide) {
  1539. wx.onAppHide(function () {for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {args[_key8] = arguments[_key8];}
  1540. appOptions.onHide.apply(vm, args);
  1541. });
  1542. }
  1543. if (isFn(appOptions.onLaunch)) {
  1544. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  1545. appOptions.onLaunch.call(vm, args);
  1546. }
  1547. return vm;
  1548. }
  1549. todos.forEach(function (todoApi) {
  1550. protocols[todoApi] = false;
  1551. });
  1552. canIUses.forEach(function (canIUseApi) {
  1553. var apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name :
  1554. canIUseApi;
  1555. if (!wx.canIUse(apiName)) {
  1556. protocols[canIUseApi] = false;
  1557. }
  1558. });
  1559. var uni = {};
  1560. if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') {
  1561. uni = new Proxy({}, {
  1562. get: function get(target, name) {
  1563. if (hasOwn(target, name)) {
  1564. return target[name];
  1565. }
  1566. if (baseApi[name]) {
  1567. return baseApi[name];
  1568. }
  1569. if (api[name]) {
  1570. return promisify(name, api[name]);
  1571. }
  1572. {
  1573. if (extraApi[name]) {
  1574. return promisify(name, extraApi[name]);
  1575. }
  1576. if (todoApis[name]) {
  1577. return promisify(name, todoApis[name]);
  1578. }
  1579. }
  1580. if (eventApi[name]) {
  1581. return eventApi[name];
  1582. }
  1583. if (!hasOwn(wx, name) && !hasOwn(protocols, name)) {
  1584. return;
  1585. }
  1586. return promisify(name, wrapper(name, wx[name]));
  1587. },
  1588. set: function set(target, name, value) {
  1589. target[name] = value;
  1590. return true;
  1591. } });
  1592. } else {
  1593. Object.keys(baseApi).forEach(function (name) {
  1594. uni[name] = baseApi[name];
  1595. });
  1596. {
  1597. Object.keys(todoApis).forEach(function (name) {
  1598. uni[name] = promisify(name, todoApis[name]);
  1599. });
  1600. Object.keys(extraApi).forEach(function (name) {
  1601. uni[name] = promisify(name, todoApis[name]);
  1602. });
  1603. }
  1604. Object.keys(eventApi).forEach(function (name) {
  1605. uni[name] = eventApi[name];
  1606. });
  1607. Object.keys(api).forEach(function (name) {
  1608. uni[name] = promisify(name, api[name]);
  1609. });
  1610. Object.keys(wx).forEach(function (name) {
  1611. if (hasOwn(wx, name) || hasOwn(protocols, name)) {
  1612. uni[name] = promisify(name, wrapper(name, wx[name]));
  1613. }
  1614. });
  1615. }
  1616. wx.createApp = createApp;
  1617. wx.createPage = createPage;
  1618. wx.createComponent = createComponent;
  1619. wx.createSubpackageApp = createSubpackageApp;
  1620. wx.createPlugin = createPlugin;
  1621. var uni$1 = uni;var _default =
  1622. uni$1;exports.default = _default;
  1623. /***/ }),
  1624. /* 2 */
  1625. /*!******************************************************************************************!*\
  1626. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js ***!
  1627. \******************************************************************************************/
  1628. /*! exports provided: default */
  1629. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1630. "use strict";
  1631. __webpack_require__.r(__webpack_exports__);
  1632. /* WEBPACK VAR INJECTION */(function(global) {/*!
  1633. * Vue.js v2.6.11
  1634. * (c) 2014-2021 Evan You
  1635. * Released under the MIT License.
  1636. */
  1637. /* */
  1638. var emptyObject = Object.freeze({});
  1639. // These helpers produce better VM code in JS engines due to their
  1640. // explicitness and function inlining.
  1641. function isUndef (v) {
  1642. return v === undefined || v === null
  1643. }
  1644. function isDef (v) {
  1645. return v !== undefined && v !== null
  1646. }
  1647. function isTrue (v) {
  1648. return v === true
  1649. }
  1650. function isFalse (v) {
  1651. return v === false
  1652. }
  1653. /**
  1654. * Check if value is primitive.
  1655. */
  1656. function isPrimitive (value) {
  1657. return (
  1658. typeof value === 'string' ||
  1659. typeof value === 'number' ||
  1660. // $flow-disable-line
  1661. typeof value === 'symbol' ||
  1662. typeof value === 'boolean'
  1663. )
  1664. }
  1665. /**
  1666. * Quick object check - this is primarily used to tell
  1667. * Objects from primitive values when we know the value
  1668. * is a JSON-compliant type.
  1669. */
  1670. function isObject (obj) {
  1671. return obj !== null && typeof obj === 'object'
  1672. }
  1673. /**
  1674. * Get the raw type string of a value, e.g., [object Object].
  1675. */
  1676. var _toString = Object.prototype.toString;
  1677. function toRawType (value) {
  1678. return _toString.call(value).slice(8, -1)
  1679. }
  1680. /**
  1681. * Strict object type check. Only returns true
  1682. * for plain JavaScript objects.
  1683. */
  1684. function isPlainObject (obj) {
  1685. return _toString.call(obj) === '[object Object]'
  1686. }
  1687. function isRegExp (v) {
  1688. return _toString.call(v) === '[object RegExp]'
  1689. }
  1690. /**
  1691. * Check if val is a valid array index.
  1692. */
  1693. function isValidArrayIndex (val) {
  1694. var n = parseFloat(String(val));
  1695. return n >= 0 && Math.floor(n) === n && isFinite(val)
  1696. }
  1697. function isPromise (val) {
  1698. return (
  1699. isDef(val) &&
  1700. typeof val.then === 'function' &&
  1701. typeof val.catch === 'function'
  1702. )
  1703. }
  1704. /**
  1705. * Convert a value to a string that is actually rendered.
  1706. */
  1707. function toString (val) {
  1708. return val == null
  1709. ? ''
  1710. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  1711. ? JSON.stringify(val, null, 2)
  1712. : String(val)
  1713. }
  1714. /**
  1715. * Convert an input value to a number for persistence.
  1716. * If the conversion fails, return original string.
  1717. */
  1718. function toNumber (val) {
  1719. var n = parseFloat(val);
  1720. return isNaN(n) ? val : n
  1721. }
  1722. /**
  1723. * Make a map and return a function for checking if a key
  1724. * is in that map.
  1725. */
  1726. function makeMap (
  1727. str,
  1728. expectsLowerCase
  1729. ) {
  1730. var map = Object.create(null);
  1731. var list = str.split(',');
  1732. for (var i = 0; i < list.length; i++) {
  1733. map[list[i]] = true;
  1734. }
  1735. return expectsLowerCase
  1736. ? function (val) { return map[val.toLowerCase()]; }
  1737. : function (val) { return map[val]; }
  1738. }
  1739. /**
  1740. * Check if a tag is a built-in tag.
  1741. */
  1742. var isBuiltInTag = makeMap('slot,component', true);
  1743. /**
  1744. * Check if an attribute is a reserved attribute.
  1745. */
  1746. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  1747. /**
  1748. * Remove an item from an array.
  1749. */
  1750. function remove (arr, item) {
  1751. if (arr.length) {
  1752. var index = arr.indexOf(item);
  1753. if (index > -1) {
  1754. return arr.splice(index, 1)
  1755. }
  1756. }
  1757. }
  1758. /**
  1759. * Check whether an object has the property.
  1760. */
  1761. var hasOwnProperty = Object.prototype.hasOwnProperty;
  1762. function hasOwn (obj, key) {
  1763. return hasOwnProperty.call(obj, key)
  1764. }
  1765. /**
  1766. * Create a cached version of a pure function.
  1767. */
  1768. function cached (fn) {
  1769. var cache = Object.create(null);
  1770. return (function cachedFn (str) {
  1771. var hit = cache[str];
  1772. return hit || (cache[str] = fn(str))
  1773. })
  1774. }
  1775. /**
  1776. * Camelize a hyphen-delimited string.
  1777. */
  1778. var camelizeRE = /-(\w)/g;
  1779. var camelize = cached(function (str) {
  1780. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  1781. });
  1782. /**
  1783. * Capitalize a string.
  1784. */
  1785. var capitalize = cached(function (str) {
  1786. return str.charAt(0).toUpperCase() + str.slice(1)
  1787. });
  1788. /**
  1789. * Hyphenate a camelCase string.
  1790. */
  1791. var hyphenateRE = /\B([A-Z])/g;
  1792. var hyphenate = cached(function (str) {
  1793. return str.replace(hyphenateRE, '-$1').toLowerCase()
  1794. });
  1795. /**
  1796. * Simple bind polyfill for environments that do not support it,
  1797. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  1798. * since native bind is now performant enough in most browsers.
  1799. * But removing it would mean breaking code that was able to run in
  1800. * PhantomJS 1.x, so this must be kept for backward compatibility.
  1801. */
  1802. /* istanbul ignore next */
  1803. function polyfillBind (fn, ctx) {
  1804. function boundFn (a) {
  1805. var l = arguments.length;
  1806. return l
  1807. ? l > 1
  1808. ? fn.apply(ctx, arguments)
  1809. : fn.call(ctx, a)
  1810. : fn.call(ctx)
  1811. }
  1812. boundFn._length = fn.length;
  1813. return boundFn
  1814. }
  1815. function nativeBind (fn, ctx) {
  1816. return fn.bind(ctx)
  1817. }
  1818. var bind = Function.prototype.bind
  1819. ? nativeBind
  1820. : polyfillBind;
  1821. /**
  1822. * Convert an Array-like object to a real Array.
  1823. */
  1824. function toArray (list, start) {
  1825. start = start || 0;
  1826. var i = list.length - start;
  1827. var ret = new Array(i);
  1828. while (i--) {
  1829. ret[i] = list[i + start];
  1830. }
  1831. return ret
  1832. }
  1833. /**
  1834. * Mix properties into target object.
  1835. */
  1836. function extend (to, _from) {
  1837. for (var key in _from) {
  1838. to[key] = _from[key];
  1839. }
  1840. return to
  1841. }
  1842. /**
  1843. * Merge an Array of Objects into a single Object.
  1844. */
  1845. function toObject (arr) {
  1846. var res = {};
  1847. for (var i = 0; i < arr.length; i++) {
  1848. if (arr[i]) {
  1849. extend(res, arr[i]);
  1850. }
  1851. }
  1852. return res
  1853. }
  1854. /* eslint-disable no-unused-vars */
  1855. /**
  1856. * Perform no operation.
  1857. * Stubbing args to make Flow happy without leaving useless transpiled code
  1858. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  1859. */
  1860. function noop (a, b, c) {}
  1861. /**
  1862. * Always return false.
  1863. */
  1864. var no = function (a, b, c) { return false; };
  1865. /* eslint-enable no-unused-vars */
  1866. /**
  1867. * Return the same value.
  1868. */
  1869. var identity = function (_) { return _; };
  1870. /**
  1871. * Check if two values are loosely equal - that is,
  1872. * if they are plain objects, do they have the same shape?
  1873. */
  1874. function looseEqual (a, b) {
  1875. if (a === b) { return true }
  1876. var isObjectA = isObject(a);
  1877. var isObjectB = isObject(b);
  1878. if (isObjectA && isObjectB) {
  1879. try {
  1880. var isArrayA = Array.isArray(a);
  1881. var isArrayB = Array.isArray(b);
  1882. if (isArrayA && isArrayB) {
  1883. return a.length === b.length && a.every(function (e, i) {
  1884. return looseEqual(e, b[i])
  1885. })
  1886. } else if (a instanceof Date && b instanceof Date) {
  1887. return a.getTime() === b.getTime()
  1888. } else if (!isArrayA && !isArrayB) {
  1889. var keysA = Object.keys(a);
  1890. var keysB = Object.keys(b);
  1891. return keysA.length === keysB.length && keysA.every(function (key) {
  1892. return looseEqual(a[key], b[key])
  1893. })
  1894. } else {
  1895. /* istanbul ignore next */
  1896. return false
  1897. }
  1898. } catch (e) {
  1899. /* istanbul ignore next */
  1900. return false
  1901. }
  1902. } else if (!isObjectA && !isObjectB) {
  1903. return String(a) === String(b)
  1904. } else {
  1905. return false
  1906. }
  1907. }
  1908. /**
  1909. * Return the first index at which a loosely equal value can be
  1910. * found in the array (if value is a plain object, the array must
  1911. * contain an object of the same shape), or -1 if it is not present.
  1912. */
  1913. function looseIndexOf (arr, val) {
  1914. for (var i = 0; i < arr.length; i++) {
  1915. if (looseEqual(arr[i], val)) { return i }
  1916. }
  1917. return -1
  1918. }
  1919. /**
  1920. * Ensure a function is called only once.
  1921. */
  1922. function once (fn) {
  1923. var called = false;
  1924. return function () {
  1925. if (!called) {
  1926. called = true;
  1927. fn.apply(this, arguments);
  1928. }
  1929. }
  1930. }
  1931. var ASSET_TYPES = [
  1932. 'component',
  1933. 'directive',
  1934. 'filter'
  1935. ];
  1936. var LIFECYCLE_HOOKS = [
  1937. 'beforeCreate',
  1938. 'created',
  1939. 'beforeMount',
  1940. 'mounted',
  1941. 'beforeUpdate',
  1942. 'updated',
  1943. 'beforeDestroy',
  1944. 'destroyed',
  1945. 'activated',
  1946. 'deactivated',
  1947. 'errorCaptured',
  1948. 'serverPrefetch'
  1949. ];
  1950. /* */
  1951. var config = ({
  1952. /**
  1953. * Option merge strategies (used in core/util/options)
  1954. */
  1955. // $flow-disable-line
  1956. optionMergeStrategies: Object.create(null),
  1957. /**
  1958. * Whether to suppress warnings.
  1959. */
  1960. silent: false,
  1961. /**
  1962. * Show production mode tip message on boot?
  1963. */
  1964. productionTip: "development" !== 'production',
  1965. /**
  1966. * Whether to enable devtools
  1967. */
  1968. devtools: "development" !== 'production',
  1969. /**
  1970. * Whether to record perf
  1971. */
  1972. performance: false,
  1973. /**
  1974. * Error handler for watcher errors
  1975. */
  1976. errorHandler: null,
  1977. /**
  1978. * Warn handler for watcher warns
  1979. */
  1980. warnHandler: null,
  1981. /**
  1982. * Ignore certain custom elements
  1983. */
  1984. ignoredElements: [],
  1985. /**
  1986. * Custom user key aliases for v-on
  1987. */
  1988. // $flow-disable-line
  1989. keyCodes: Object.create(null),
  1990. /**
  1991. * Check if a tag is reserved so that it cannot be registered as a
  1992. * component. This is platform-dependent and may be overwritten.
  1993. */
  1994. isReservedTag: no,
  1995. /**
  1996. * Check if an attribute is reserved so that it cannot be used as a component
  1997. * prop. This is platform-dependent and may be overwritten.
  1998. */
  1999. isReservedAttr: no,
  2000. /**
  2001. * Check if a tag is an unknown element.
  2002. * Platform-dependent.
  2003. */
  2004. isUnknownElement: no,
  2005. /**
  2006. * Get the namespace of an element
  2007. */
  2008. getTagNamespace: noop,
  2009. /**
  2010. * Parse the real tag name for the specific platform.
  2011. */
  2012. parsePlatformTagName: identity,
  2013. /**
  2014. * Check if an attribute must be bound using property, e.g. value
  2015. * Platform-dependent.
  2016. */
  2017. mustUseProp: no,
  2018. /**
  2019. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  2020. * This will significantly reduce performance if set to false.
  2021. */
  2022. async: true,
  2023. /**
  2024. * Exposed for legacy reasons
  2025. */
  2026. _lifecycleHooks: LIFECYCLE_HOOKS
  2027. });
  2028. /* */
  2029. /**
  2030. * unicode letters used for parsing html tags, component names and property paths.
  2031. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  2032. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  2033. */
  2034. var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
  2035. /**
  2036. * Check if a string starts with $ or _
  2037. */
  2038. function isReserved (str) {
  2039. var c = (str + '').charCodeAt(0);
  2040. return c === 0x24 || c === 0x5F
  2041. }
  2042. /**
  2043. * Define a property.
  2044. */
  2045. function def (obj, key, val, enumerable) {
  2046. Object.defineProperty(obj, key, {
  2047. value: val,
  2048. enumerable: !!enumerable,
  2049. writable: true,
  2050. configurable: true
  2051. });
  2052. }
  2053. /**
  2054. * Parse simple path.
  2055. */
  2056. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  2057. function parsePath (path) {
  2058. if (bailRE.test(path)) {
  2059. return
  2060. }
  2061. var segments = path.split('.');
  2062. return function (obj) {
  2063. for (var i = 0; i < segments.length; i++) {
  2064. if (!obj) { return }
  2065. obj = obj[segments[i]];
  2066. }
  2067. return obj
  2068. }
  2069. }
  2070. /* */
  2071. // can we use __proto__?
  2072. var hasProto = '__proto__' in {};
  2073. // Browser environment sniffing
  2074. var inBrowser = typeof window !== 'undefined';
  2075. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  2076. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  2077. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  2078. var isIE = UA && /msie|trident/.test(UA);
  2079. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  2080. var isEdge = UA && UA.indexOf('edge/') > 0;
  2081. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  2082. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  2083. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  2084. var isPhantomJS = UA && /phantomjs/.test(UA);
  2085. var isFF = UA && UA.match(/firefox\/(\d+)/);
  2086. // Firefox has a "watch" function on Object.prototype...
  2087. var nativeWatch = ({}).watch;
  2088. if (inBrowser) {
  2089. try {
  2090. var opts = {};
  2091. Object.defineProperty(opts, 'passive', ({
  2092. get: function get () {
  2093. }
  2094. })); // https://github.com/facebook/flow/issues/285
  2095. window.addEventListener('test-passive', null, opts);
  2096. } catch (e) {}
  2097. }
  2098. // this needs to be lazy-evaled because vue may be required before
  2099. // vue-server-renderer can set VUE_ENV
  2100. var _isServer;
  2101. var isServerRendering = function () {
  2102. if (_isServer === undefined) {
  2103. /* istanbul ignore if */
  2104. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  2105. // detect presence of vue-server-renderer and avoid
  2106. // Webpack shimming the process
  2107. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  2108. } else {
  2109. _isServer = false;
  2110. }
  2111. }
  2112. return _isServer
  2113. };
  2114. // detect devtools
  2115. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  2116. /* istanbul ignore next */
  2117. function isNative (Ctor) {
  2118. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  2119. }
  2120. var hasSymbol =
  2121. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  2122. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  2123. var _Set;
  2124. /* istanbul ignore if */ // $flow-disable-line
  2125. if (typeof Set !== 'undefined' && isNative(Set)) {
  2126. // use native Set when available.
  2127. _Set = Set;
  2128. } else {
  2129. // a non-standard Set polyfill that only works with primitive keys.
  2130. _Set = /*@__PURE__*/(function () {
  2131. function Set () {
  2132. this.set = Object.create(null);
  2133. }
  2134. Set.prototype.has = function has (key) {
  2135. return this.set[key] === true
  2136. };
  2137. Set.prototype.add = function add (key) {
  2138. this.set[key] = true;
  2139. };
  2140. Set.prototype.clear = function clear () {
  2141. this.set = Object.create(null);
  2142. };
  2143. return Set;
  2144. }());
  2145. }
  2146. /* */
  2147. var warn = noop;
  2148. var tip = noop;
  2149. var generateComponentTrace = (noop); // work around flow check
  2150. var formatComponentName = (noop);
  2151. if (true) {
  2152. var hasConsole = typeof console !== 'undefined';
  2153. var classifyRE = /(?:^|[-_])(\w)/g;
  2154. var classify = function (str) { return str
  2155. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  2156. .replace(/[-_]/g, ''); };
  2157. warn = function (msg, vm) {
  2158. var trace = vm ? generateComponentTrace(vm) : '';
  2159. if (config.warnHandler) {
  2160. config.warnHandler.call(null, msg, vm, trace);
  2161. } else if (hasConsole && (!config.silent)) {
  2162. console.error(("[Vue warn]: " + msg + trace));
  2163. }
  2164. };
  2165. tip = function (msg, vm) {
  2166. if (hasConsole && (!config.silent)) {
  2167. console.warn("[Vue tip]: " + msg + (
  2168. vm ? generateComponentTrace(vm) : ''
  2169. ));
  2170. }
  2171. };
  2172. formatComponentName = function (vm, includeFile) {
  2173. if (vm.$root === vm) {
  2174. if (vm.$options && vm.$options.__file) { // fixed by xxxxxx
  2175. return ('') + vm.$options.__file
  2176. }
  2177. return '<Root>'
  2178. }
  2179. var options = typeof vm === 'function' && vm.cid != null
  2180. ? vm.options
  2181. : vm._isVue
  2182. ? vm.$options || vm.constructor.options
  2183. : vm;
  2184. var name = options.name || options._componentTag;
  2185. var file = options.__file;
  2186. if (!name && file) {
  2187. var match = file.match(/([^/\\]+)\.vue$/);
  2188. name = match && match[1];
  2189. }
  2190. return (
  2191. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  2192. (file && includeFile !== false ? (" at " + file) : '')
  2193. )
  2194. };
  2195. var repeat = function (str, n) {
  2196. var res = '';
  2197. while (n) {
  2198. if (n % 2 === 1) { res += str; }
  2199. if (n > 1) { str += str; }
  2200. n >>= 1;
  2201. }
  2202. return res
  2203. };
  2204. generateComponentTrace = function (vm) {
  2205. if (vm._isVue && vm.$parent) {
  2206. var tree = [];
  2207. var currentRecursiveSequence = 0;
  2208. while (vm && vm.$options.name !== 'PageBody') {
  2209. if (tree.length > 0) {
  2210. var last = tree[tree.length - 1];
  2211. if (last.constructor === vm.constructor) {
  2212. currentRecursiveSequence++;
  2213. vm = vm.$parent;
  2214. continue
  2215. } else if (currentRecursiveSequence > 0) {
  2216. tree[tree.length - 1] = [last, currentRecursiveSequence];
  2217. currentRecursiveSequence = 0;
  2218. }
  2219. }
  2220. !vm.$options.isReserved && tree.push(vm);
  2221. vm = vm.$parent;
  2222. }
  2223. return '\n\nfound in\n\n' + tree
  2224. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  2225. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  2226. : formatComponentName(vm))); })
  2227. .join('\n')
  2228. } else {
  2229. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  2230. }
  2231. };
  2232. }
  2233. /* */
  2234. var uid = 0;
  2235. /**
  2236. * A dep is an observable that can have multiple
  2237. * directives subscribing to it.
  2238. */
  2239. var Dep = function Dep () {
  2240. this.id = uid++;
  2241. this.subs = [];
  2242. };
  2243. Dep.prototype.addSub = function addSub (sub) {
  2244. this.subs.push(sub);
  2245. };
  2246. Dep.prototype.removeSub = function removeSub (sub) {
  2247. remove(this.subs, sub);
  2248. };
  2249. Dep.prototype.depend = function depend () {
  2250. if (Dep.SharedObject.target) {
  2251. Dep.SharedObject.target.addDep(this);
  2252. }
  2253. };
  2254. Dep.prototype.notify = function notify () {
  2255. // stabilize the subscriber list first
  2256. var subs = this.subs.slice();
  2257. if ( true && !config.async) {
  2258. // subs aren't sorted in scheduler if not running async
  2259. // we need to sort them now to make sure they fire in correct
  2260. // order
  2261. subs.sort(function (a, b) { return a.id - b.id; });
  2262. }
  2263. for (var i = 0, l = subs.length; i < l; i++) {
  2264. subs[i].update();
  2265. }
  2266. };
  2267. // The current target watcher being evaluated.
  2268. // This is globally unique because only one watcher
  2269. // can be evaluated at a time.
  2270. // fixed by xxxxxx (nvue shared vuex)
  2271. /* eslint-disable no-undef */
  2272. Dep.SharedObject = {};
  2273. Dep.SharedObject.target = null;
  2274. Dep.SharedObject.targetStack = [];
  2275. function pushTarget (target) {
  2276. Dep.SharedObject.targetStack.push(target);
  2277. Dep.SharedObject.target = target;
  2278. Dep.target = target;
  2279. }
  2280. function popTarget () {
  2281. Dep.SharedObject.targetStack.pop();
  2282. Dep.SharedObject.target = Dep.SharedObject.targetStack[Dep.SharedObject.targetStack.length - 1];
  2283. Dep.target = Dep.SharedObject.target;
  2284. }
  2285. /* */
  2286. var VNode = function VNode (
  2287. tag,
  2288. data,
  2289. children,
  2290. text,
  2291. elm,
  2292. context,
  2293. componentOptions,
  2294. asyncFactory
  2295. ) {
  2296. this.tag = tag;
  2297. this.data = data;
  2298. this.children = children;
  2299. this.text = text;
  2300. this.elm = elm;
  2301. this.ns = undefined;
  2302. this.context = context;
  2303. this.fnContext = undefined;
  2304. this.fnOptions = undefined;
  2305. this.fnScopeId = undefined;
  2306. this.key = data && data.key;
  2307. this.componentOptions = componentOptions;
  2308. this.componentInstance = undefined;
  2309. this.parent = undefined;
  2310. this.raw = false;
  2311. this.isStatic = false;
  2312. this.isRootInsert = true;
  2313. this.isComment = false;
  2314. this.isCloned = false;
  2315. this.isOnce = false;
  2316. this.asyncFactory = asyncFactory;
  2317. this.asyncMeta = undefined;
  2318. this.isAsyncPlaceholder = false;
  2319. };
  2320. var prototypeAccessors = { child: { configurable: true } };
  2321. // DEPRECATED: alias for componentInstance for backwards compat.
  2322. /* istanbul ignore next */
  2323. prototypeAccessors.child.get = function () {
  2324. return this.componentInstance
  2325. };
  2326. Object.defineProperties( VNode.prototype, prototypeAccessors );
  2327. var createEmptyVNode = function (text) {
  2328. if ( text === void 0 ) text = '';
  2329. var node = new VNode();
  2330. node.text = text;
  2331. node.isComment = true;
  2332. return node
  2333. };
  2334. function createTextVNode (val) {
  2335. return new VNode(undefined, undefined, undefined, String(val))
  2336. }
  2337. // optimized shallow clone
  2338. // used for static nodes and slot nodes because they may be reused across
  2339. // multiple renders, cloning them avoids errors when DOM manipulations rely
  2340. // on their elm reference.
  2341. function cloneVNode (vnode) {
  2342. var cloned = new VNode(
  2343. vnode.tag,
  2344. vnode.data,
  2345. // #7975
  2346. // clone children array to avoid mutating original in case of cloning
  2347. // a child.
  2348. vnode.children && vnode.children.slice(),
  2349. vnode.text,
  2350. vnode.elm,
  2351. vnode.context,
  2352. vnode.componentOptions,
  2353. vnode.asyncFactory
  2354. );
  2355. cloned.ns = vnode.ns;
  2356. cloned.isStatic = vnode.isStatic;
  2357. cloned.key = vnode.key;
  2358. cloned.isComment = vnode.isComment;
  2359. cloned.fnContext = vnode.fnContext;
  2360. cloned.fnOptions = vnode.fnOptions;
  2361. cloned.fnScopeId = vnode.fnScopeId;
  2362. cloned.asyncMeta = vnode.asyncMeta;
  2363. cloned.isCloned = true;
  2364. return cloned
  2365. }
  2366. /*
  2367. * not type checking this file because flow doesn't play well with
  2368. * dynamically accessing methods on Array prototype
  2369. */
  2370. var arrayProto = Array.prototype;
  2371. var arrayMethods = Object.create(arrayProto);
  2372. var methodsToPatch = [
  2373. 'push',
  2374. 'pop',
  2375. 'shift',
  2376. 'unshift',
  2377. 'splice',
  2378. 'sort',
  2379. 'reverse'
  2380. ];
  2381. /**
  2382. * Intercept mutating methods and emit events
  2383. */
  2384. methodsToPatch.forEach(function (method) {
  2385. // cache original method
  2386. var original = arrayProto[method];
  2387. def(arrayMethods, method, function mutator () {
  2388. var args = [], len = arguments.length;
  2389. while ( len-- ) args[ len ] = arguments[ len ];
  2390. var result = original.apply(this, args);
  2391. var ob = this.__ob__;
  2392. var inserted;
  2393. switch (method) {
  2394. case 'push':
  2395. case 'unshift':
  2396. inserted = args;
  2397. break
  2398. case 'splice':
  2399. inserted = args.slice(2);
  2400. break
  2401. }
  2402. if (inserted) { ob.observeArray(inserted); }
  2403. // notify change
  2404. ob.dep.notify();
  2405. return result
  2406. });
  2407. });
  2408. /* */
  2409. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  2410. /**
  2411. * In some cases we may want to disable observation inside a component's
  2412. * update computation.
  2413. */
  2414. var shouldObserve = true;
  2415. function toggleObserving (value) {
  2416. shouldObserve = value;
  2417. }
  2418. /**
  2419. * Observer class that is attached to each observed
  2420. * object. Once attached, the observer converts the target
  2421. * object's property keys into getter/setters that
  2422. * collect dependencies and dispatch updates.
  2423. */
  2424. var Observer = function Observer (value) {
  2425. this.value = value;
  2426. this.dep = new Dep();
  2427. this.vmCount = 0;
  2428. def(value, '__ob__', this);
  2429. if (Array.isArray(value)) {
  2430. if (hasProto) {
  2431. {// fixed by xxxxxx 微信小程序使用 plugins 之后,数组方法被直接挂载到了数组对象上,需要执行 copyAugment 逻辑
  2432. if(value.push !== value.__proto__.push){
  2433. copyAugment(value, arrayMethods, arrayKeys);
  2434. } else {
  2435. protoAugment(value, arrayMethods);
  2436. }
  2437. }
  2438. } else {
  2439. copyAugment(value, arrayMethods, arrayKeys);
  2440. }
  2441. this.observeArray(value);
  2442. } else {
  2443. this.walk(value);
  2444. }
  2445. };
  2446. /**
  2447. * Walk through all properties and convert them into
  2448. * getter/setters. This method should only be called when
  2449. * value type is Object.
  2450. */
  2451. Observer.prototype.walk = function walk (obj) {
  2452. var keys = Object.keys(obj);
  2453. for (var i = 0; i < keys.length; i++) {
  2454. defineReactive$$1(obj, keys[i]);
  2455. }
  2456. };
  2457. /**
  2458. * Observe a list of Array items.
  2459. */
  2460. Observer.prototype.observeArray = function observeArray (items) {
  2461. for (var i = 0, l = items.length; i < l; i++) {
  2462. observe(items[i]);
  2463. }
  2464. };
  2465. // helpers
  2466. /**
  2467. * Augment a target Object or Array by intercepting
  2468. * the prototype chain using __proto__
  2469. */
  2470. function protoAugment (target, src) {
  2471. /* eslint-disable no-proto */
  2472. target.__proto__ = src;
  2473. /* eslint-enable no-proto */
  2474. }
  2475. /**
  2476. * Augment a target Object or Array by defining
  2477. * hidden properties.
  2478. */
  2479. /* istanbul ignore next */
  2480. function copyAugment (target, src, keys) {
  2481. for (var i = 0, l = keys.length; i < l; i++) {
  2482. var key = keys[i];
  2483. def(target, key, src[key]);
  2484. }
  2485. }
  2486. /**
  2487. * Attempt to create an observer instance for a value,
  2488. * returns the new observer if successfully observed,
  2489. * or the existing observer if the value already has one.
  2490. */
  2491. function observe (value, asRootData) {
  2492. if (!isObject(value) || value instanceof VNode) {
  2493. return
  2494. }
  2495. var ob;
  2496. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  2497. ob = value.__ob__;
  2498. } else if (
  2499. shouldObserve &&
  2500. !isServerRendering() &&
  2501. (Array.isArray(value) || isPlainObject(value)) &&
  2502. Object.isExtensible(value) &&
  2503. !value._isVue
  2504. ) {
  2505. ob = new Observer(value);
  2506. }
  2507. if (asRootData && ob) {
  2508. ob.vmCount++;
  2509. }
  2510. return ob
  2511. }
  2512. /**
  2513. * Define a reactive property on an Object.
  2514. */
  2515. function defineReactive$$1 (
  2516. obj,
  2517. key,
  2518. val,
  2519. customSetter,
  2520. shallow
  2521. ) {
  2522. var dep = new Dep();
  2523. var property = Object.getOwnPropertyDescriptor(obj, key);
  2524. if (property && property.configurable === false) {
  2525. return
  2526. }
  2527. // cater for pre-defined getter/setters
  2528. var getter = property && property.get;
  2529. var setter = property && property.set;
  2530. if ((!getter || setter) && arguments.length === 2) {
  2531. val = obj[key];
  2532. }
  2533. var childOb = !shallow && observe(val);
  2534. Object.defineProperty(obj, key, {
  2535. enumerable: true,
  2536. configurable: true,
  2537. get: function reactiveGetter () {
  2538. var value = getter ? getter.call(obj) : val;
  2539. if (Dep.SharedObject.target) { // fixed by xxxxxx
  2540. dep.depend();
  2541. if (childOb) {
  2542. childOb.dep.depend();
  2543. if (Array.isArray(value)) {
  2544. dependArray(value);
  2545. }
  2546. }
  2547. }
  2548. return value
  2549. },
  2550. set: function reactiveSetter (newVal) {
  2551. var value = getter ? getter.call(obj) : val;
  2552. /* eslint-disable no-self-compare */
  2553. if (newVal === value || (newVal !== newVal && value !== value)) {
  2554. return
  2555. }
  2556. /* eslint-enable no-self-compare */
  2557. if ( true && customSetter) {
  2558. customSetter();
  2559. }
  2560. // #7981: for accessor properties without setter
  2561. if (getter && !setter) { return }
  2562. if (setter) {
  2563. setter.call(obj, newVal);
  2564. } else {
  2565. val = newVal;
  2566. }
  2567. childOb = !shallow && observe(newVal);
  2568. dep.notify();
  2569. }
  2570. });
  2571. }
  2572. /**
  2573. * Set a property on an object. Adds the new property and
  2574. * triggers change notification if the property doesn't
  2575. * already exist.
  2576. */
  2577. function set (target, key, val) {
  2578. if ( true &&
  2579. (isUndef(target) || isPrimitive(target))
  2580. ) {
  2581. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  2582. }
  2583. if (Array.isArray(target) && isValidArrayIndex(key)) {
  2584. target.length = Math.max(target.length, key);
  2585. target.splice(key, 1, val);
  2586. return val
  2587. }
  2588. if (key in target && !(key in Object.prototype)) {
  2589. target[key] = val;
  2590. return val
  2591. }
  2592. var ob = (target).__ob__;
  2593. if (target._isVue || (ob && ob.vmCount)) {
  2594. true && warn(
  2595. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  2596. 'at runtime - declare it upfront in the data option.'
  2597. );
  2598. return val
  2599. }
  2600. if (!ob) {
  2601. target[key] = val;
  2602. return val
  2603. }
  2604. defineReactive$$1(ob.value, key, val);
  2605. ob.dep.notify();
  2606. return val
  2607. }
  2608. /**
  2609. * Delete a property and trigger change if necessary.
  2610. */
  2611. function del (target, key) {
  2612. if ( true &&
  2613. (isUndef(target) || isPrimitive(target))
  2614. ) {
  2615. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  2616. }
  2617. if (Array.isArray(target) && isValidArrayIndex(key)) {
  2618. target.splice(key, 1);
  2619. return
  2620. }
  2621. var ob = (target).__ob__;
  2622. if (target._isVue || (ob && ob.vmCount)) {
  2623. true && warn(
  2624. 'Avoid deleting properties on a Vue instance or its root $data ' +
  2625. '- just set it to null.'
  2626. );
  2627. return
  2628. }
  2629. if (!hasOwn(target, key)) {
  2630. return
  2631. }
  2632. delete target[key];
  2633. if (!ob) {
  2634. return
  2635. }
  2636. ob.dep.notify();
  2637. }
  2638. /**
  2639. * Collect dependencies on array elements when the array is touched, since
  2640. * we cannot intercept array element access like property getters.
  2641. */
  2642. function dependArray (value) {
  2643. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  2644. e = value[i];
  2645. e && e.__ob__ && e.__ob__.dep.depend();
  2646. if (Array.isArray(e)) {
  2647. dependArray(e);
  2648. }
  2649. }
  2650. }
  2651. /* */
  2652. /**
  2653. * Option overwriting strategies are functions that handle
  2654. * how to merge a parent option value and a child option
  2655. * value into the final value.
  2656. */
  2657. var strats = config.optionMergeStrategies;
  2658. /**
  2659. * Options with restrictions
  2660. */
  2661. if (true) {
  2662. strats.el = strats.propsData = function (parent, child, vm, key) {
  2663. if (!vm) {
  2664. warn(
  2665. "option \"" + key + "\" can only be used during instance " +
  2666. 'creation with the `new` keyword.'
  2667. );
  2668. }
  2669. return defaultStrat(parent, child)
  2670. };
  2671. }
  2672. /**
  2673. * Helper that recursively merges two data objects together.
  2674. */
  2675. function mergeData (to, from) {
  2676. if (!from) { return to }
  2677. var key, toVal, fromVal;
  2678. var keys = hasSymbol
  2679. ? Reflect.ownKeys(from)
  2680. : Object.keys(from);
  2681. for (var i = 0; i < keys.length; i++) {
  2682. key = keys[i];
  2683. // in case the object is already observed...
  2684. if (key === '__ob__') { continue }
  2685. toVal = to[key];
  2686. fromVal = from[key];
  2687. if (!hasOwn(to, key)) {
  2688. set(to, key, fromVal);
  2689. } else if (
  2690. toVal !== fromVal &&
  2691. isPlainObject(toVal) &&
  2692. isPlainObject(fromVal)
  2693. ) {
  2694. mergeData(toVal, fromVal);
  2695. }
  2696. }
  2697. return to
  2698. }
  2699. /**
  2700. * Data
  2701. */
  2702. function mergeDataOrFn (
  2703. parentVal,
  2704. childVal,
  2705. vm
  2706. ) {
  2707. if (!vm) {
  2708. // in a Vue.extend merge, both should be functions
  2709. if (!childVal) {
  2710. return parentVal
  2711. }
  2712. if (!parentVal) {
  2713. return childVal
  2714. }
  2715. // when parentVal & childVal are both present,
  2716. // we need to return a function that returns the
  2717. // merged result of both functions... no need to
  2718. // check if parentVal is a function here because
  2719. // it has to be a function to pass previous merges.
  2720. return function mergedDataFn () {
  2721. return mergeData(
  2722. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  2723. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  2724. )
  2725. }
  2726. } else {
  2727. return function mergedInstanceDataFn () {
  2728. // instance merge
  2729. var instanceData = typeof childVal === 'function'
  2730. ? childVal.call(vm, vm)
  2731. : childVal;
  2732. var defaultData = typeof parentVal === 'function'
  2733. ? parentVal.call(vm, vm)
  2734. : parentVal;
  2735. if (instanceData) {
  2736. return mergeData(instanceData, defaultData)
  2737. } else {
  2738. return defaultData
  2739. }
  2740. }
  2741. }
  2742. }
  2743. strats.data = function (
  2744. parentVal,
  2745. childVal,
  2746. vm
  2747. ) {
  2748. if (!vm) {
  2749. if (childVal && typeof childVal !== 'function') {
  2750. true && warn(
  2751. 'The "data" option should be a function ' +
  2752. 'that returns a per-instance value in component ' +
  2753. 'definitions.',
  2754. vm
  2755. );
  2756. return parentVal
  2757. }
  2758. return mergeDataOrFn(parentVal, childVal)
  2759. }
  2760. return mergeDataOrFn(parentVal, childVal, vm)
  2761. };
  2762. /**
  2763. * Hooks and props are merged as arrays.
  2764. */
  2765. function mergeHook (
  2766. parentVal,
  2767. childVal
  2768. ) {
  2769. var res = childVal
  2770. ? parentVal
  2771. ? parentVal.concat(childVal)
  2772. : Array.isArray(childVal)
  2773. ? childVal
  2774. : [childVal]
  2775. : parentVal;
  2776. return res
  2777. ? dedupeHooks(res)
  2778. : res
  2779. }
  2780. function dedupeHooks (hooks) {
  2781. var res = [];
  2782. for (var i = 0; i < hooks.length; i++) {
  2783. if (res.indexOf(hooks[i]) === -1) {
  2784. res.push(hooks[i]);
  2785. }
  2786. }
  2787. return res
  2788. }
  2789. LIFECYCLE_HOOKS.forEach(function (hook) {
  2790. strats[hook] = mergeHook;
  2791. });
  2792. /**
  2793. * Assets
  2794. *
  2795. * When a vm is present (instance creation), we need to do
  2796. * a three-way merge between constructor options, instance
  2797. * options and parent options.
  2798. */
  2799. function mergeAssets (
  2800. parentVal,
  2801. childVal,
  2802. vm,
  2803. key
  2804. ) {
  2805. var res = Object.create(parentVal || null);
  2806. if (childVal) {
  2807. true && assertObjectType(key, childVal, vm);
  2808. return extend(res, childVal)
  2809. } else {
  2810. return res
  2811. }
  2812. }
  2813. ASSET_TYPES.forEach(function (type) {
  2814. strats[type + 's'] = mergeAssets;
  2815. });
  2816. /**
  2817. * Watchers.
  2818. *
  2819. * Watchers hashes should not overwrite one
  2820. * another, so we merge them as arrays.
  2821. */
  2822. strats.watch = function (
  2823. parentVal,
  2824. childVal,
  2825. vm,
  2826. key
  2827. ) {
  2828. // work around Firefox's Object.prototype.watch...
  2829. if (parentVal === nativeWatch) { parentVal = undefined; }
  2830. if (childVal === nativeWatch) { childVal = undefined; }
  2831. /* istanbul ignore if */
  2832. if (!childVal) { return Object.create(parentVal || null) }
  2833. if (true) {
  2834. assertObjectType(key, childVal, vm);
  2835. }
  2836. if (!parentVal) { return childVal }
  2837. var ret = {};
  2838. extend(ret, parentVal);
  2839. for (var key$1 in childVal) {
  2840. var parent = ret[key$1];
  2841. var child = childVal[key$1];
  2842. if (parent && !Array.isArray(parent)) {
  2843. parent = [parent];
  2844. }
  2845. ret[key$1] = parent
  2846. ? parent.concat(child)
  2847. : Array.isArray(child) ? child : [child];
  2848. }
  2849. return ret
  2850. };
  2851. /**
  2852. * Other object hashes.
  2853. */
  2854. strats.props =
  2855. strats.methods =
  2856. strats.inject =
  2857. strats.computed = function (
  2858. parentVal,
  2859. childVal,
  2860. vm,
  2861. key
  2862. ) {
  2863. if (childVal && "development" !== 'production') {
  2864. assertObjectType(key, childVal, vm);
  2865. }
  2866. if (!parentVal) { return childVal }
  2867. var ret = Object.create(null);
  2868. extend(ret, parentVal);
  2869. if (childVal) { extend(ret, childVal); }
  2870. return ret
  2871. };
  2872. strats.provide = mergeDataOrFn;
  2873. /**
  2874. * Default strategy.
  2875. */
  2876. var defaultStrat = function (parentVal, childVal) {
  2877. return childVal === undefined
  2878. ? parentVal
  2879. : childVal
  2880. };
  2881. /**
  2882. * Validate component names
  2883. */
  2884. function checkComponents (options) {
  2885. for (var key in options.components) {
  2886. validateComponentName(key);
  2887. }
  2888. }
  2889. function validateComponentName (name) {
  2890. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  2891. warn(
  2892. 'Invalid component name: "' + name + '". Component names ' +
  2893. 'should conform to valid custom element name in html5 specification.'
  2894. );
  2895. }
  2896. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  2897. warn(
  2898. 'Do not use built-in or reserved HTML elements as component ' +
  2899. 'id: ' + name
  2900. );
  2901. }
  2902. }
  2903. /**
  2904. * Ensure all props option syntax are normalized into the
  2905. * Object-based format.
  2906. */
  2907. function normalizeProps (options, vm) {
  2908. var props = options.props;
  2909. if (!props) { return }
  2910. var res = {};
  2911. var i, val, name;
  2912. if (Array.isArray(props)) {
  2913. i = props.length;
  2914. while (i--) {
  2915. val = props[i];
  2916. if (typeof val === 'string') {
  2917. name = camelize(val);
  2918. res[name] = { type: null };
  2919. } else if (true) {
  2920. warn('props must be strings when using array syntax.');
  2921. }
  2922. }
  2923. } else if (isPlainObject(props)) {
  2924. for (var key in props) {
  2925. val = props[key];
  2926. name = camelize(key);
  2927. res[name] = isPlainObject(val)
  2928. ? val
  2929. : { type: val };
  2930. }
  2931. } else if (true) {
  2932. warn(
  2933. "Invalid value for option \"props\": expected an Array or an Object, " +
  2934. "but got " + (toRawType(props)) + ".",
  2935. vm
  2936. );
  2937. }
  2938. options.props = res;
  2939. }
  2940. /**
  2941. * Normalize all injections into Object-based format
  2942. */
  2943. function normalizeInject (options, vm) {
  2944. var inject = options.inject;
  2945. if (!inject) { return }
  2946. var normalized = options.inject = {};
  2947. if (Array.isArray(inject)) {
  2948. for (var i = 0; i < inject.length; i++) {
  2949. normalized[inject[i]] = { from: inject[i] };
  2950. }
  2951. } else if (isPlainObject(inject)) {
  2952. for (var key in inject) {
  2953. var val = inject[key];
  2954. normalized[key] = isPlainObject(val)
  2955. ? extend({ from: key }, val)
  2956. : { from: val };
  2957. }
  2958. } else if (true) {
  2959. warn(
  2960. "Invalid value for option \"inject\": expected an Array or an Object, " +
  2961. "but got " + (toRawType(inject)) + ".",
  2962. vm
  2963. );
  2964. }
  2965. }
  2966. /**
  2967. * Normalize raw function directives into object format.
  2968. */
  2969. function normalizeDirectives (options) {
  2970. var dirs = options.directives;
  2971. if (dirs) {
  2972. for (var key in dirs) {
  2973. var def$$1 = dirs[key];
  2974. if (typeof def$$1 === 'function') {
  2975. dirs[key] = { bind: def$$1, update: def$$1 };
  2976. }
  2977. }
  2978. }
  2979. }
  2980. function assertObjectType (name, value, vm) {
  2981. if (!isPlainObject(value)) {
  2982. warn(
  2983. "Invalid value for option \"" + name + "\": expected an Object, " +
  2984. "but got " + (toRawType(value)) + ".",
  2985. vm
  2986. );
  2987. }
  2988. }
  2989. /**
  2990. * Merge two option objects into a new one.
  2991. * Core utility used in both instantiation and inheritance.
  2992. */
  2993. function mergeOptions (
  2994. parent,
  2995. child,
  2996. vm
  2997. ) {
  2998. if (true) {
  2999. checkComponents(child);
  3000. }
  3001. if (typeof child === 'function') {
  3002. child = child.options;
  3003. }
  3004. normalizeProps(child, vm);
  3005. normalizeInject(child, vm);
  3006. normalizeDirectives(child);
  3007. // Apply extends and mixins on the child options,
  3008. // but only if it is a raw options object that isn't
  3009. // the result of another mergeOptions call.
  3010. // Only merged options has the _base property.
  3011. if (!child._base) {
  3012. if (child.extends) {
  3013. parent = mergeOptions(parent, child.extends, vm);
  3014. }
  3015. if (child.mixins) {
  3016. for (var i = 0, l = child.mixins.length; i < l; i++) {
  3017. parent = mergeOptions(parent, child.mixins[i], vm);
  3018. }
  3019. }
  3020. }
  3021. var options = {};
  3022. var key;
  3023. for (key in parent) {
  3024. mergeField(key);
  3025. }
  3026. for (key in child) {
  3027. if (!hasOwn(parent, key)) {
  3028. mergeField(key);
  3029. }
  3030. }
  3031. function mergeField (key) {
  3032. var strat = strats[key] || defaultStrat;
  3033. options[key] = strat(parent[key], child[key], vm, key);
  3034. }
  3035. return options
  3036. }
  3037. /**
  3038. * Resolve an asset.
  3039. * This function is used because child instances need access
  3040. * to assets defined in its ancestor chain.
  3041. */
  3042. function resolveAsset (
  3043. options,
  3044. type,
  3045. id,
  3046. warnMissing
  3047. ) {
  3048. /* istanbul ignore if */
  3049. if (typeof id !== 'string') {
  3050. return
  3051. }
  3052. var assets = options[type];
  3053. // check local registration variations first
  3054. if (hasOwn(assets, id)) { return assets[id] }
  3055. var camelizedId = camelize(id);
  3056. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  3057. var PascalCaseId = capitalize(camelizedId);
  3058. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  3059. // fallback to prototype chain
  3060. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  3061. if ( true && warnMissing && !res) {
  3062. warn(
  3063. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  3064. options
  3065. );
  3066. }
  3067. return res
  3068. }
  3069. /* */
  3070. function validateProp (
  3071. key,
  3072. propOptions,
  3073. propsData,
  3074. vm
  3075. ) {
  3076. var prop = propOptions[key];
  3077. var absent = !hasOwn(propsData, key);
  3078. var value = propsData[key];
  3079. // boolean casting
  3080. var booleanIndex = getTypeIndex(Boolean, prop.type);
  3081. if (booleanIndex > -1) {
  3082. if (absent && !hasOwn(prop, 'default')) {
  3083. value = false;
  3084. } else if (value === '' || value === hyphenate(key)) {
  3085. // only cast empty string / same name to boolean if
  3086. // boolean has higher priority
  3087. var stringIndex = getTypeIndex(String, prop.type);
  3088. if (stringIndex < 0 || booleanIndex < stringIndex) {
  3089. value = true;
  3090. }
  3091. }
  3092. }
  3093. // check default value
  3094. if (value === undefined) {
  3095. value = getPropDefaultValue(vm, prop, key);
  3096. // since the default value is a fresh copy,
  3097. // make sure to observe it.
  3098. var prevShouldObserve = shouldObserve;
  3099. toggleObserving(true);
  3100. observe(value);
  3101. toggleObserving(prevShouldObserve);
  3102. }
  3103. if (
  3104. true
  3105. ) {
  3106. assertProp(prop, key, value, vm, absent);
  3107. }
  3108. return value
  3109. }
  3110. /**
  3111. * Get the default value of a prop.
  3112. */
  3113. function getPropDefaultValue (vm, prop, key) {
  3114. // no default, return undefined
  3115. if (!hasOwn(prop, 'default')) {
  3116. return undefined
  3117. }
  3118. var def = prop.default;
  3119. // warn against non-factory defaults for Object & Array
  3120. if ( true && isObject(def)) {
  3121. warn(
  3122. 'Invalid default value for prop "' + key + '": ' +
  3123. 'Props with type Object/Array must use a factory function ' +
  3124. 'to return the default value.',
  3125. vm
  3126. );
  3127. }
  3128. // the raw prop value was also undefined from previous render,
  3129. // return previous default value to avoid unnecessary watcher trigger
  3130. if (vm && vm.$options.propsData &&
  3131. vm.$options.propsData[key] === undefined &&
  3132. vm._props[key] !== undefined
  3133. ) {
  3134. return vm._props[key]
  3135. }
  3136. // call factory function for non-Function types
  3137. // a value is Function if its prototype is function even across different execution context
  3138. return typeof def === 'function' && getType(prop.type) !== 'Function'
  3139. ? def.call(vm)
  3140. : def
  3141. }
  3142. /**
  3143. * Assert whether a prop is valid.
  3144. */
  3145. function assertProp (
  3146. prop,
  3147. name,
  3148. value,
  3149. vm,
  3150. absent
  3151. ) {
  3152. if (prop.required && absent) {
  3153. warn(
  3154. 'Missing required prop: "' + name + '"',
  3155. vm
  3156. );
  3157. return
  3158. }
  3159. if (value == null && !prop.required) {
  3160. return
  3161. }
  3162. var type = prop.type;
  3163. var valid = !type || type === true;
  3164. var expectedTypes = [];
  3165. if (type) {
  3166. if (!Array.isArray(type)) {
  3167. type = [type];
  3168. }
  3169. for (var i = 0; i < type.length && !valid; i++) {
  3170. var assertedType = assertType(value, type[i]);
  3171. expectedTypes.push(assertedType.expectedType || '');
  3172. valid = assertedType.valid;
  3173. }
  3174. }
  3175. if (!valid) {
  3176. warn(
  3177. getInvalidTypeMessage(name, value, expectedTypes),
  3178. vm
  3179. );
  3180. return
  3181. }
  3182. var validator = prop.validator;
  3183. if (validator) {
  3184. if (!validator(value)) {
  3185. warn(
  3186. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  3187. vm
  3188. );
  3189. }
  3190. }
  3191. }
  3192. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  3193. function assertType (value, type) {
  3194. var valid;
  3195. var expectedType = getType(type);
  3196. if (simpleCheckRE.test(expectedType)) {
  3197. var t = typeof value;
  3198. valid = t === expectedType.toLowerCase();
  3199. // for primitive wrapper objects
  3200. if (!valid && t === 'object') {
  3201. valid = value instanceof type;
  3202. }
  3203. } else if (expectedType === 'Object') {
  3204. valid = isPlainObject(value);
  3205. } else if (expectedType === 'Array') {
  3206. valid = Array.isArray(value);
  3207. } else {
  3208. valid = value instanceof type;
  3209. }
  3210. return {
  3211. valid: valid,
  3212. expectedType: expectedType
  3213. }
  3214. }
  3215. /**
  3216. * Use function string name to check built-in types,
  3217. * because a simple equality check will fail when running
  3218. * across different vms / iframes.
  3219. */
  3220. function getType (fn) {
  3221. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  3222. return match ? match[1] : ''
  3223. }
  3224. function isSameType (a, b) {
  3225. return getType(a) === getType(b)
  3226. }
  3227. function getTypeIndex (type, expectedTypes) {
  3228. if (!Array.isArray(expectedTypes)) {
  3229. return isSameType(expectedTypes, type) ? 0 : -1
  3230. }
  3231. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  3232. if (isSameType(expectedTypes[i], type)) {
  3233. return i
  3234. }
  3235. }
  3236. return -1
  3237. }
  3238. function getInvalidTypeMessage (name, value, expectedTypes) {
  3239. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  3240. " Expected " + (expectedTypes.map(capitalize).join(', '));
  3241. var expectedType = expectedTypes[0];
  3242. var receivedType = toRawType(value);
  3243. var expectedValue = styleValue(value, expectedType);
  3244. var receivedValue = styleValue(value, receivedType);
  3245. // check if we need to specify expected value
  3246. if (expectedTypes.length === 1 &&
  3247. isExplicable(expectedType) &&
  3248. !isBoolean(expectedType, receivedType)) {
  3249. message += " with value " + expectedValue;
  3250. }
  3251. message += ", got " + receivedType + " ";
  3252. // check if we need to specify received value
  3253. if (isExplicable(receivedType)) {
  3254. message += "with value " + receivedValue + ".";
  3255. }
  3256. return message
  3257. }
  3258. function styleValue (value, type) {
  3259. if (type === 'String') {
  3260. return ("\"" + value + "\"")
  3261. } else if (type === 'Number') {
  3262. return ("" + (Number(value)))
  3263. } else {
  3264. return ("" + value)
  3265. }
  3266. }
  3267. function isExplicable (value) {
  3268. var explicitTypes = ['string', 'number', 'boolean'];
  3269. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  3270. }
  3271. function isBoolean () {
  3272. var args = [], len = arguments.length;
  3273. while ( len-- ) args[ len ] = arguments[ len ];
  3274. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  3275. }
  3276. /* */
  3277. function handleError (err, vm, info) {
  3278. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  3279. // See: https://github.com/vuejs/vuex/issues/1505
  3280. pushTarget();
  3281. try {
  3282. if (vm) {
  3283. var cur = vm;
  3284. while ((cur = cur.$parent)) {
  3285. var hooks = cur.$options.errorCaptured;
  3286. if (hooks) {
  3287. for (var i = 0; i < hooks.length; i++) {
  3288. try {
  3289. var capture = hooks[i].call(cur, err, vm, info) === false;
  3290. if (capture) { return }
  3291. } catch (e) {
  3292. globalHandleError(e, cur, 'errorCaptured hook');
  3293. }
  3294. }
  3295. }
  3296. }
  3297. }
  3298. globalHandleError(err, vm, info);
  3299. } finally {
  3300. popTarget();
  3301. }
  3302. }
  3303. function invokeWithErrorHandling (
  3304. handler,
  3305. context,
  3306. args,
  3307. vm,
  3308. info
  3309. ) {
  3310. var res;
  3311. try {
  3312. res = args ? handler.apply(context, args) : handler.call(context);
  3313. if (res && !res._isVue && isPromise(res) && !res._handled) {
  3314. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  3315. // issue #9511
  3316. // avoid catch triggering multiple times when nested calls
  3317. res._handled = true;
  3318. }
  3319. } catch (e) {
  3320. handleError(e, vm, info);
  3321. }
  3322. return res
  3323. }
  3324. function globalHandleError (err, vm, info) {
  3325. if (config.errorHandler) {
  3326. try {
  3327. return config.errorHandler.call(null, err, vm, info)
  3328. } catch (e) {
  3329. // if the user intentionally throws the original error in the handler,
  3330. // do not log it twice
  3331. if (e !== err) {
  3332. logError(e, null, 'config.errorHandler');
  3333. }
  3334. }
  3335. }
  3336. logError(err, vm, info);
  3337. }
  3338. function logError (err, vm, info) {
  3339. if (true) {
  3340. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  3341. }
  3342. /* istanbul ignore else */
  3343. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  3344. console.error(err);
  3345. } else {
  3346. throw err
  3347. }
  3348. }
  3349. /* */
  3350. var callbacks = [];
  3351. var pending = false;
  3352. function flushCallbacks () {
  3353. pending = false;
  3354. var copies = callbacks.slice(0);
  3355. callbacks.length = 0;
  3356. for (var i = 0; i < copies.length; i++) {
  3357. copies[i]();
  3358. }
  3359. }
  3360. // Here we have async deferring wrappers using microtasks.
  3361. // In 2.5 we used (macro) tasks (in combination with microtasks).
  3362. // However, it has subtle problems when state is changed right before repaint
  3363. // (e.g. #6813, out-in transitions).
  3364. // Also, using (macro) tasks in event handler would cause some weird behaviors
  3365. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  3366. // So we now use microtasks everywhere, again.
  3367. // A major drawback of this tradeoff is that there are some scenarios
  3368. // where microtasks have too high a priority and fire in between supposedly
  3369. // sequential events (e.g. #4521, #6690, which have workarounds)
  3370. // or even between bubbling of the same event (#6566).
  3371. var timerFunc;
  3372. // The nextTick behavior leverages the microtask queue, which can be accessed
  3373. // via either native Promise.then or MutationObserver.
  3374. // MutationObserver has wider support, however it is seriously bugged in
  3375. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  3376. // completely stops working after triggering a few times... so, if native
  3377. // Promise is available, we will use it:
  3378. /* istanbul ignore next, $flow-disable-line */
  3379. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  3380. var p = Promise.resolve();
  3381. timerFunc = function () {
  3382. p.then(flushCallbacks);
  3383. // In problematic UIWebViews, Promise.then doesn't completely break, but
  3384. // it can get stuck in a weird state where callbacks are pushed into the
  3385. // microtask queue but the queue isn't being flushed, until the browser
  3386. // needs to do some other work, e.g. handle a timer. Therefore we can
  3387. // "force" the microtask queue to be flushed by adding an empty timer.
  3388. if (isIOS) { setTimeout(noop); }
  3389. };
  3390. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  3391. isNative(MutationObserver) ||
  3392. // PhantomJS and iOS 7.x
  3393. MutationObserver.toString() === '[object MutationObserverConstructor]'
  3394. )) {
  3395. // Use MutationObserver where native Promise is not available,
  3396. // e.g. PhantomJS, iOS7, Android 4.4
  3397. // (#6466 MutationObserver is unreliable in IE11)
  3398. var counter = 1;
  3399. var observer = new MutationObserver(flushCallbacks);
  3400. var textNode = document.createTextNode(String(counter));
  3401. observer.observe(textNode, {
  3402. characterData: true
  3403. });
  3404. timerFunc = function () {
  3405. counter = (counter + 1) % 2;
  3406. textNode.data = String(counter);
  3407. };
  3408. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  3409. // Fallback to setImmediate.
  3410. // Technically it leverages the (macro) task queue,
  3411. // but it is still a better choice than setTimeout.
  3412. timerFunc = function () {
  3413. setImmediate(flushCallbacks);
  3414. };
  3415. } else {
  3416. // Fallback to setTimeout.
  3417. timerFunc = function () {
  3418. setTimeout(flushCallbacks, 0);
  3419. };
  3420. }
  3421. function nextTick (cb, ctx) {
  3422. var _resolve;
  3423. callbacks.push(function () {
  3424. if (cb) {
  3425. try {
  3426. cb.call(ctx);
  3427. } catch (e) {
  3428. handleError(e, ctx, 'nextTick');
  3429. }
  3430. } else if (_resolve) {
  3431. _resolve(ctx);
  3432. }
  3433. });
  3434. if (!pending) {
  3435. pending = true;
  3436. timerFunc();
  3437. }
  3438. // $flow-disable-line
  3439. if (!cb && typeof Promise !== 'undefined') {
  3440. return new Promise(function (resolve) {
  3441. _resolve = resolve;
  3442. })
  3443. }
  3444. }
  3445. /* */
  3446. /* not type checking this file because flow doesn't play well with Proxy */
  3447. var initProxy;
  3448. if (true) {
  3449. var allowedGlobals = makeMap(
  3450. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  3451. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  3452. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  3453. 'require' // for Webpack/Browserify
  3454. );
  3455. var warnNonPresent = function (target, key) {
  3456. warn(
  3457. "Property or method \"" + key + "\" is not defined on the instance but " +
  3458. 'referenced during render. Make sure that this property is reactive, ' +
  3459. 'either in the data option, or for class-based components, by ' +
  3460. 'initializing the property. ' +
  3461. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  3462. target
  3463. );
  3464. };
  3465. var warnReservedPrefix = function (target, key) {
  3466. warn(
  3467. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  3468. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  3469. 'prevent conflicts with Vue internals. ' +
  3470. 'See: https://vuejs.org/v2/api/#data',
  3471. target
  3472. );
  3473. };
  3474. var hasProxy =
  3475. typeof Proxy !== 'undefined' && isNative(Proxy);
  3476. if (hasProxy) {
  3477. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  3478. config.keyCodes = new Proxy(config.keyCodes, {
  3479. set: function set (target, key, value) {
  3480. if (isBuiltInModifier(key)) {
  3481. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  3482. return false
  3483. } else {
  3484. target[key] = value;
  3485. return true
  3486. }
  3487. }
  3488. });
  3489. }
  3490. var hasHandler = {
  3491. has: function has (target, key) {
  3492. var has = key in target;
  3493. var isAllowed = allowedGlobals(key) ||
  3494. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  3495. if (!has && !isAllowed) {
  3496. if (key in target.$data) { warnReservedPrefix(target, key); }
  3497. else { warnNonPresent(target, key); }
  3498. }
  3499. return has || !isAllowed
  3500. }
  3501. };
  3502. var getHandler = {
  3503. get: function get (target, key) {
  3504. if (typeof key === 'string' && !(key in target)) {
  3505. if (key in target.$data) { warnReservedPrefix(target, key); }
  3506. else { warnNonPresent(target, key); }
  3507. }
  3508. return target[key]
  3509. }
  3510. };
  3511. initProxy = function initProxy (vm) {
  3512. if (hasProxy) {
  3513. // determine which proxy handler to use
  3514. var options = vm.$options;
  3515. var handlers = options.render && options.render._withStripped
  3516. ? getHandler
  3517. : hasHandler;
  3518. vm._renderProxy = new Proxy(vm, handlers);
  3519. } else {
  3520. vm._renderProxy = vm;
  3521. }
  3522. };
  3523. }
  3524. /* */
  3525. var seenObjects = new _Set();
  3526. /**
  3527. * Recursively traverse an object to evoke all converted
  3528. * getters, so that every nested property inside the object
  3529. * is collected as a "deep" dependency.
  3530. */
  3531. function traverse (val) {
  3532. _traverse(val, seenObjects);
  3533. seenObjects.clear();
  3534. }
  3535. function _traverse (val, seen) {
  3536. var i, keys;
  3537. var isA = Array.isArray(val);
  3538. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  3539. return
  3540. }
  3541. if (val.__ob__) {
  3542. var depId = val.__ob__.dep.id;
  3543. if (seen.has(depId)) {
  3544. return
  3545. }
  3546. seen.add(depId);
  3547. }
  3548. if (isA) {
  3549. i = val.length;
  3550. while (i--) { _traverse(val[i], seen); }
  3551. } else {
  3552. keys = Object.keys(val);
  3553. i = keys.length;
  3554. while (i--) { _traverse(val[keys[i]], seen); }
  3555. }
  3556. }
  3557. var mark;
  3558. var measure;
  3559. if (true) {
  3560. var perf = inBrowser && window.performance;
  3561. /* istanbul ignore if */
  3562. if (
  3563. perf &&
  3564. perf.mark &&
  3565. perf.measure &&
  3566. perf.clearMarks &&
  3567. perf.clearMeasures
  3568. ) {
  3569. mark = function (tag) { return perf.mark(tag); };
  3570. measure = function (name, startTag, endTag) {
  3571. perf.measure(name, startTag, endTag);
  3572. perf.clearMarks(startTag);
  3573. perf.clearMarks(endTag);
  3574. // perf.clearMeasures(name)
  3575. };
  3576. }
  3577. }
  3578. /* */
  3579. var normalizeEvent = cached(function (name) {
  3580. var passive = name.charAt(0) === '&';
  3581. name = passive ? name.slice(1) : name;
  3582. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  3583. name = once$$1 ? name.slice(1) : name;
  3584. var capture = name.charAt(0) === '!';
  3585. name = capture ? name.slice(1) : name;
  3586. return {
  3587. name: name,
  3588. once: once$$1,
  3589. capture: capture,
  3590. passive: passive
  3591. }
  3592. });
  3593. function createFnInvoker (fns, vm) {
  3594. function invoker () {
  3595. var arguments$1 = arguments;
  3596. var fns = invoker.fns;
  3597. if (Array.isArray(fns)) {
  3598. var cloned = fns.slice();
  3599. for (var i = 0; i < cloned.length; i++) {
  3600. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  3601. }
  3602. } else {
  3603. // return handler return value for single handlers
  3604. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  3605. }
  3606. }
  3607. invoker.fns = fns;
  3608. return invoker
  3609. }
  3610. function updateListeners (
  3611. on,
  3612. oldOn,
  3613. add,
  3614. remove$$1,
  3615. createOnceHandler,
  3616. vm
  3617. ) {
  3618. var name, def$$1, cur, old, event;
  3619. for (name in on) {
  3620. def$$1 = cur = on[name];
  3621. old = oldOn[name];
  3622. event = normalizeEvent(name);
  3623. if (isUndef(cur)) {
  3624. true && warn(
  3625. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  3626. vm
  3627. );
  3628. } else if (isUndef(old)) {
  3629. if (isUndef(cur.fns)) {
  3630. cur = on[name] = createFnInvoker(cur, vm);
  3631. }
  3632. if (isTrue(event.once)) {
  3633. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  3634. }
  3635. add(event.name, cur, event.capture, event.passive, event.params);
  3636. } else if (cur !== old) {
  3637. old.fns = cur;
  3638. on[name] = old;
  3639. }
  3640. }
  3641. for (name in oldOn) {
  3642. if (isUndef(on[name])) {
  3643. event = normalizeEvent(name);
  3644. remove$$1(event.name, oldOn[name], event.capture);
  3645. }
  3646. }
  3647. }
  3648. /* */
  3649. /* */
  3650. // fixed by xxxxxx (mp properties)
  3651. function extractPropertiesFromVNodeData(data, Ctor, res, context) {
  3652. var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties;
  3653. if (isUndef(propOptions)) {
  3654. return res
  3655. }
  3656. var externalClasses = Ctor.options.mpOptions.externalClasses || [];
  3657. var attrs = data.attrs;
  3658. var props = data.props;
  3659. if (isDef(attrs) || isDef(props)) {
  3660. for (var key in propOptions) {
  3661. var altKey = hyphenate(key);
  3662. var result = checkProp(res, props, key, altKey, true) ||
  3663. checkProp(res, attrs, key, altKey, false);
  3664. // externalClass
  3665. if (
  3666. result &&
  3667. res[key] &&
  3668. externalClasses.indexOf(altKey) !== -1 &&
  3669. context[camelize(res[key])]
  3670. ) {
  3671. // 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串)
  3672. res[key] = context[camelize(res[key])];
  3673. }
  3674. }
  3675. }
  3676. return res
  3677. }
  3678. function extractPropsFromVNodeData (
  3679. data,
  3680. Ctor,
  3681. tag,
  3682. context// fixed by xxxxxx
  3683. ) {
  3684. // we are only extracting raw values here.
  3685. // validation and default values are handled in the child
  3686. // component itself.
  3687. var propOptions = Ctor.options.props;
  3688. if (isUndef(propOptions)) {
  3689. // fixed by xxxxxx
  3690. return extractPropertiesFromVNodeData(data, Ctor, {}, context)
  3691. }
  3692. var res = {};
  3693. var attrs = data.attrs;
  3694. var props = data.props;
  3695. if (isDef(attrs) || isDef(props)) {
  3696. for (var key in propOptions) {
  3697. var altKey = hyphenate(key);
  3698. if (true) {
  3699. var keyInLowerCase = key.toLowerCase();
  3700. if (
  3701. key !== keyInLowerCase &&
  3702. attrs && hasOwn(attrs, keyInLowerCase)
  3703. ) {
  3704. tip(
  3705. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  3706. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  3707. " \"" + key + "\". " +
  3708. "Note that HTML attributes are case-insensitive and camelCased " +
  3709. "props need to use their kebab-case equivalents when using in-DOM " +
  3710. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  3711. );
  3712. }
  3713. }
  3714. checkProp(res, props, key, altKey, true) ||
  3715. checkProp(res, attrs, key, altKey, false);
  3716. }
  3717. }
  3718. // fixed by xxxxxx
  3719. return extractPropertiesFromVNodeData(data, Ctor, res, context)
  3720. }
  3721. function checkProp (
  3722. res,
  3723. hash,
  3724. key,
  3725. altKey,
  3726. preserve
  3727. ) {
  3728. if (isDef(hash)) {
  3729. if (hasOwn(hash, key)) {
  3730. res[key] = hash[key];
  3731. if (!preserve) {
  3732. delete hash[key];
  3733. }
  3734. return true
  3735. } else if (hasOwn(hash, altKey)) {
  3736. res[key] = hash[altKey];
  3737. if (!preserve) {
  3738. delete hash[altKey];
  3739. }
  3740. return true
  3741. }
  3742. }
  3743. return false
  3744. }
  3745. /* */
  3746. // The template compiler attempts to minimize the need for normalization by
  3747. // statically analyzing the template at compile time.
  3748. //
  3749. // For plain HTML markup, normalization can be completely skipped because the
  3750. // generated render function is guaranteed to return Array<VNode>. There are
  3751. // two cases where extra normalization is needed:
  3752. // 1. When the children contains components - because a functional component
  3753. // may return an Array instead of a single root. In this case, just a simple
  3754. // normalization is needed - if any child is an Array, we flatten the whole
  3755. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  3756. // because functional components already normalize their own children.
  3757. function simpleNormalizeChildren (children) {
  3758. for (var i = 0; i < children.length; i++) {
  3759. if (Array.isArray(children[i])) {
  3760. return Array.prototype.concat.apply([], children)
  3761. }
  3762. }
  3763. return children
  3764. }
  3765. // 2. When the children contains constructs that always generated nested Arrays,
  3766. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  3767. // with hand-written render functions / JSX. In such cases a full normalization
  3768. // is needed to cater to all possible types of children values.
  3769. function normalizeChildren (children) {
  3770. return isPrimitive(children)
  3771. ? [createTextVNode(children)]
  3772. : Array.isArray(children)
  3773. ? normalizeArrayChildren(children)
  3774. : undefined
  3775. }
  3776. function isTextNode (node) {
  3777. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  3778. }
  3779. function normalizeArrayChildren (children, nestedIndex) {
  3780. var res = [];
  3781. var i, c, lastIndex, last;
  3782. for (i = 0; i < children.length; i++) {
  3783. c = children[i];
  3784. if (isUndef(c) || typeof c === 'boolean') { continue }
  3785. lastIndex = res.length - 1;
  3786. last = res[lastIndex];
  3787. // nested
  3788. if (Array.isArray(c)) {
  3789. if (c.length > 0) {
  3790. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  3791. // merge adjacent text nodes
  3792. if (isTextNode(c[0]) && isTextNode(last)) {
  3793. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  3794. c.shift();
  3795. }
  3796. res.push.apply(res, c);
  3797. }
  3798. } else if (isPrimitive(c)) {
  3799. if (isTextNode(last)) {
  3800. // merge adjacent text nodes
  3801. // this is necessary for SSR hydration because text nodes are
  3802. // essentially merged when rendered to HTML strings
  3803. res[lastIndex] = createTextVNode(last.text + c);
  3804. } else if (c !== '') {
  3805. // convert primitive to vnode
  3806. res.push(createTextVNode(c));
  3807. }
  3808. } else {
  3809. if (isTextNode(c) && isTextNode(last)) {
  3810. // merge adjacent text nodes
  3811. res[lastIndex] = createTextVNode(last.text + c.text);
  3812. } else {
  3813. // default key for nested array children (likely generated by v-for)
  3814. if (isTrue(children._isVList) &&
  3815. isDef(c.tag) &&
  3816. isUndef(c.key) &&
  3817. isDef(nestedIndex)) {
  3818. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  3819. }
  3820. res.push(c);
  3821. }
  3822. }
  3823. }
  3824. return res
  3825. }
  3826. /* */
  3827. function initProvide (vm) {
  3828. var provide = vm.$options.provide;
  3829. if (provide) {
  3830. vm._provided = typeof provide === 'function'
  3831. ? provide.call(vm)
  3832. : provide;
  3833. }
  3834. }
  3835. function initInjections (vm) {
  3836. var result = resolveInject(vm.$options.inject, vm);
  3837. if (result) {
  3838. toggleObserving(false);
  3839. Object.keys(result).forEach(function (key) {
  3840. /* istanbul ignore else */
  3841. if (true) {
  3842. defineReactive$$1(vm, key, result[key], function () {
  3843. warn(
  3844. "Avoid mutating an injected value directly since the changes will be " +
  3845. "overwritten whenever the provided component re-renders. " +
  3846. "injection being mutated: \"" + key + "\"",
  3847. vm
  3848. );
  3849. });
  3850. } else {}
  3851. });
  3852. toggleObserving(true);
  3853. }
  3854. }
  3855. function resolveInject (inject, vm) {
  3856. if (inject) {
  3857. // inject is :any because flow is not smart enough to figure out cached
  3858. var result = Object.create(null);
  3859. var keys = hasSymbol
  3860. ? Reflect.ownKeys(inject)
  3861. : Object.keys(inject);
  3862. for (var i = 0; i < keys.length; i++) {
  3863. var key = keys[i];
  3864. // #6574 in case the inject object is observed...
  3865. if (key === '__ob__') { continue }
  3866. var provideKey = inject[key].from;
  3867. var source = vm;
  3868. while (source) {
  3869. if (source._provided && hasOwn(source._provided, provideKey)) {
  3870. result[key] = source._provided[provideKey];
  3871. break
  3872. }
  3873. source = source.$parent;
  3874. }
  3875. if (!source) {
  3876. if ('default' in inject[key]) {
  3877. var provideDefault = inject[key].default;
  3878. result[key] = typeof provideDefault === 'function'
  3879. ? provideDefault.call(vm)
  3880. : provideDefault;
  3881. } else if (true) {
  3882. warn(("Injection \"" + key + "\" not found"), vm);
  3883. }
  3884. }
  3885. }
  3886. return result
  3887. }
  3888. }
  3889. /* */
  3890. /**
  3891. * Runtime helper for resolving raw children VNodes into a slot object.
  3892. */
  3893. function resolveSlots (
  3894. children,
  3895. context
  3896. ) {
  3897. if (!children || !children.length) {
  3898. return {}
  3899. }
  3900. var slots = {};
  3901. for (var i = 0, l = children.length; i < l; i++) {
  3902. var child = children[i];
  3903. var data = child.data;
  3904. // remove slot attribute if the node is resolved as a Vue slot node
  3905. if (data && data.attrs && data.attrs.slot) {
  3906. delete data.attrs.slot;
  3907. }
  3908. // named slots should only be respected if the vnode was rendered in the
  3909. // same context.
  3910. if ((child.context === context || child.fnContext === context) &&
  3911. data && data.slot != null
  3912. ) {
  3913. var name = data.slot;
  3914. var slot = (slots[name] || (slots[name] = []));
  3915. if (child.tag === 'template') {
  3916. slot.push.apply(slot, child.children || []);
  3917. } else {
  3918. slot.push(child);
  3919. }
  3920. } else {
  3921. // fixed by xxxxxx 临时 hack 掉 uni-app 中的异步 name slot page
  3922. if(child.asyncMeta && child.asyncMeta.data && child.asyncMeta.data.slot === 'page'){
  3923. (slots['page'] || (slots['page'] = [])).push(child);
  3924. }else{
  3925. (slots.default || (slots.default = [])).push(child);
  3926. }
  3927. }
  3928. }
  3929. // ignore slots that contains only whitespace
  3930. for (var name$1 in slots) {
  3931. if (slots[name$1].every(isWhitespace)) {
  3932. delete slots[name$1];
  3933. }
  3934. }
  3935. return slots
  3936. }
  3937. function isWhitespace (node) {
  3938. return (node.isComment && !node.asyncFactory) || node.text === ' '
  3939. }
  3940. /* */
  3941. function normalizeScopedSlots (
  3942. slots,
  3943. normalSlots,
  3944. prevSlots
  3945. ) {
  3946. var res;
  3947. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  3948. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  3949. var key = slots && slots.$key;
  3950. if (!slots) {
  3951. res = {};
  3952. } else if (slots._normalized) {
  3953. // fast path 1: child component re-render only, parent did not change
  3954. return slots._normalized
  3955. } else if (
  3956. isStable &&
  3957. prevSlots &&
  3958. prevSlots !== emptyObject &&
  3959. key === prevSlots.$key &&
  3960. !hasNormalSlots &&
  3961. !prevSlots.$hasNormal
  3962. ) {
  3963. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  3964. // only need to normalize once
  3965. return prevSlots
  3966. } else {
  3967. res = {};
  3968. for (var key$1 in slots) {
  3969. if (slots[key$1] && key$1[0] !== '$') {
  3970. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  3971. }
  3972. }
  3973. }
  3974. // expose normal slots on scopedSlots
  3975. for (var key$2 in normalSlots) {
  3976. if (!(key$2 in res)) {
  3977. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  3978. }
  3979. }
  3980. // avoriaz seems to mock a non-extensible $scopedSlots object
  3981. // and when that is passed down this would cause an error
  3982. if (slots && Object.isExtensible(slots)) {
  3983. (slots)._normalized = res;
  3984. }
  3985. def(res, '$stable', isStable);
  3986. def(res, '$key', key);
  3987. def(res, '$hasNormal', hasNormalSlots);
  3988. return res
  3989. }
  3990. function normalizeScopedSlot(normalSlots, key, fn) {
  3991. var normalized = function () {
  3992. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  3993. res = res && typeof res === 'object' && !Array.isArray(res)
  3994. ? [res] // single vnode
  3995. : normalizeChildren(res);
  3996. return res && (
  3997. res.length === 0 ||
  3998. (res.length === 1 && res[0].isComment) // #9658
  3999. ) ? undefined
  4000. : res
  4001. };
  4002. // this is a slot using the new v-slot syntax without scope. although it is
  4003. // compiled as a scoped slot, render fn users would expect it to be present
  4004. // on this.$slots because the usage is semantically a normal slot.
  4005. if (fn.proxy) {
  4006. Object.defineProperty(normalSlots, key, {
  4007. get: normalized,
  4008. enumerable: true,
  4009. configurable: true
  4010. });
  4011. }
  4012. return normalized
  4013. }
  4014. function proxyNormalSlot(slots, key) {
  4015. return function () { return slots[key]; }
  4016. }
  4017. /* */
  4018. /**
  4019. * Runtime helper for rendering v-for lists.
  4020. */
  4021. function renderList (
  4022. val,
  4023. render
  4024. ) {
  4025. var ret, i, l, keys, key;
  4026. if (Array.isArray(val) || typeof val === 'string') {
  4027. ret = new Array(val.length);
  4028. for (i = 0, l = val.length; i < l; i++) {
  4029. ret[i] = render(val[i], i, i, i); // fixed by xxxxxx
  4030. }
  4031. } else if (typeof val === 'number') {
  4032. ret = new Array(val);
  4033. for (i = 0; i < val; i++) {
  4034. ret[i] = render(i + 1, i, i, i); // fixed by xxxxxx
  4035. }
  4036. } else if (isObject(val)) {
  4037. if (hasSymbol && val[Symbol.iterator]) {
  4038. ret = [];
  4039. var iterator = val[Symbol.iterator]();
  4040. var result = iterator.next();
  4041. while (!result.done) {
  4042. ret.push(render(result.value, ret.length, i, i++)); // fixed by xxxxxx
  4043. result = iterator.next();
  4044. }
  4045. } else {
  4046. keys = Object.keys(val);
  4047. ret = new Array(keys.length);
  4048. for (i = 0, l = keys.length; i < l; i++) {
  4049. key = keys[i];
  4050. ret[i] = render(val[key], key, i, i); // fixed by xxxxxx
  4051. }
  4052. }
  4053. }
  4054. if (!isDef(ret)) {
  4055. ret = [];
  4056. }
  4057. (ret)._isVList = true;
  4058. return ret
  4059. }
  4060. /* */
  4061. /**
  4062. * Runtime helper for rendering <slot>
  4063. */
  4064. function renderSlot (
  4065. name,
  4066. fallback,
  4067. props,
  4068. bindObject
  4069. ) {
  4070. var scopedSlotFn = this.$scopedSlots[name];
  4071. var nodes;
  4072. if (scopedSlotFn) { // scoped slot
  4073. props = props || {};
  4074. if (bindObject) {
  4075. if ( true && !isObject(bindObject)) {
  4076. warn(
  4077. 'slot v-bind without argument expects an Object',
  4078. this
  4079. );
  4080. }
  4081. props = extend(extend({}, bindObject), props);
  4082. }
  4083. // fixed by xxxxxx app-plus scopedSlot
  4084. nodes = scopedSlotFn(props, this, props._i) || fallback;
  4085. } else {
  4086. nodes = this.$slots[name] || fallback;
  4087. }
  4088. var target = props && props.slot;
  4089. if (target) {
  4090. return this.$createElement('template', { slot: target }, nodes)
  4091. } else {
  4092. return nodes
  4093. }
  4094. }
  4095. /* */
  4096. /**
  4097. * Runtime helper for resolving filters
  4098. */
  4099. function resolveFilter (id) {
  4100. return resolveAsset(this.$options, 'filters', id, true) || identity
  4101. }
  4102. /* */
  4103. function isKeyNotMatch (expect, actual) {
  4104. if (Array.isArray(expect)) {
  4105. return expect.indexOf(actual) === -1
  4106. } else {
  4107. return expect !== actual
  4108. }
  4109. }
  4110. /**
  4111. * Runtime helper for checking keyCodes from config.
  4112. * exposed as Vue.prototype._k
  4113. * passing in eventKeyName as last argument separately for backwards compat
  4114. */
  4115. function checkKeyCodes (
  4116. eventKeyCode,
  4117. key,
  4118. builtInKeyCode,
  4119. eventKeyName,
  4120. builtInKeyName
  4121. ) {
  4122. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  4123. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  4124. return isKeyNotMatch(builtInKeyName, eventKeyName)
  4125. } else if (mappedKeyCode) {
  4126. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  4127. } else if (eventKeyName) {
  4128. return hyphenate(eventKeyName) !== key
  4129. }
  4130. }
  4131. /* */
  4132. /**
  4133. * Runtime helper for merging v-bind="object" into a VNode's data.
  4134. */
  4135. function bindObjectProps (
  4136. data,
  4137. tag,
  4138. value,
  4139. asProp,
  4140. isSync
  4141. ) {
  4142. if (value) {
  4143. if (!isObject(value)) {
  4144. true && warn(
  4145. 'v-bind without argument expects an Object or Array value',
  4146. this
  4147. );
  4148. } else {
  4149. if (Array.isArray(value)) {
  4150. value = toObject(value);
  4151. }
  4152. var hash;
  4153. var loop = function ( key ) {
  4154. if (
  4155. key === 'class' ||
  4156. key === 'style' ||
  4157. isReservedAttribute(key)
  4158. ) {
  4159. hash = data;
  4160. } else {
  4161. var type = data.attrs && data.attrs.type;
  4162. hash = asProp || config.mustUseProp(tag, type, key)
  4163. ? data.domProps || (data.domProps = {})
  4164. : data.attrs || (data.attrs = {});
  4165. }
  4166. var camelizedKey = camelize(key);
  4167. var hyphenatedKey = hyphenate(key);
  4168. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  4169. hash[key] = value[key];
  4170. if (isSync) {
  4171. var on = data.on || (data.on = {});
  4172. on[("update:" + key)] = function ($event) {
  4173. value[key] = $event;
  4174. };
  4175. }
  4176. }
  4177. };
  4178. for (var key in value) loop( key );
  4179. }
  4180. }
  4181. return data
  4182. }
  4183. /* */
  4184. /**
  4185. * Runtime helper for rendering static trees.
  4186. */
  4187. function renderStatic (
  4188. index,
  4189. isInFor
  4190. ) {
  4191. var cached = this._staticTrees || (this._staticTrees = []);
  4192. var tree = cached[index];
  4193. // if has already-rendered static tree and not inside v-for,
  4194. // we can reuse the same tree.
  4195. if (tree && !isInFor) {
  4196. return tree
  4197. }
  4198. // otherwise, render a fresh tree.
  4199. tree = cached[index] = this.$options.staticRenderFns[index].call(
  4200. this._renderProxy,
  4201. null,
  4202. this // for render fns generated for functional component templates
  4203. );
  4204. markStatic(tree, ("__static__" + index), false);
  4205. return tree
  4206. }
  4207. /**
  4208. * Runtime helper for v-once.
  4209. * Effectively it means marking the node as static with a unique key.
  4210. */
  4211. function markOnce (
  4212. tree,
  4213. index,
  4214. key
  4215. ) {
  4216. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  4217. return tree
  4218. }
  4219. function markStatic (
  4220. tree,
  4221. key,
  4222. isOnce
  4223. ) {
  4224. if (Array.isArray(tree)) {
  4225. for (var i = 0; i < tree.length; i++) {
  4226. if (tree[i] && typeof tree[i] !== 'string') {
  4227. markStaticNode(tree[i], (key + "_" + i), isOnce);
  4228. }
  4229. }
  4230. } else {
  4231. markStaticNode(tree, key, isOnce);
  4232. }
  4233. }
  4234. function markStaticNode (node, key, isOnce) {
  4235. node.isStatic = true;
  4236. node.key = key;
  4237. node.isOnce = isOnce;
  4238. }
  4239. /* */
  4240. function bindObjectListeners (data, value) {
  4241. if (value) {
  4242. if (!isPlainObject(value)) {
  4243. true && warn(
  4244. 'v-on without argument expects an Object value',
  4245. this
  4246. );
  4247. } else {
  4248. var on = data.on = data.on ? extend({}, data.on) : {};
  4249. for (var key in value) {
  4250. var existing = on[key];
  4251. var ours = value[key];
  4252. on[key] = existing ? [].concat(existing, ours) : ours;
  4253. }
  4254. }
  4255. }
  4256. return data
  4257. }
  4258. /* */
  4259. function resolveScopedSlots (
  4260. fns, // see flow/vnode
  4261. res,
  4262. // the following are added in 2.6
  4263. hasDynamicKeys,
  4264. contentHashKey
  4265. ) {
  4266. res = res || { $stable: !hasDynamicKeys };
  4267. for (var i = 0; i < fns.length; i++) {
  4268. var slot = fns[i];
  4269. if (Array.isArray(slot)) {
  4270. resolveScopedSlots(slot, res, hasDynamicKeys);
  4271. } else if (slot) {
  4272. // marker for reverse proxying v-slot without scope on this.$slots
  4273. if (slot.proxy) {
  4274. slot.fn.proxy = true;
  4275. }
  4276. res[slot.key] = slot.fn;
  4277. }
  4278. }
  4279. if (contentHashKey) {
  4280. (res).$key = contentHashKey;
  4281. }
  4282. return res
  4283. }
  4284. /* */
  4285. function bindDynamicKeys (baseObj, values) {
  4286. for (var i = 0; i < values.length; i += 2) {
  4287. var key = values[i];
  4288. if (typeof key === 'string' && key) {
  4289. baseObj[values[i]] = values[i + 1];
  4290. } else if ( true && key !== '' && key !== null) {
  4291. // null is a special value for explicitly removing a binding
  4292. warn(
  4293. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  4294. this
  4295. );
  4296. }
  4297. }
  4298. return baseObj
  4299. }
  4300. // helper to dynamically append modifier runtime markers to event names.
  4301. // ensure only append when value is already string, otherwise it will be cast
  4302. // to string and cause the type check to miss.
  4303. function prependModifier (value, symbol) {
  4304. return typeof value === 'string' ? symbol + value : value
  4305. }
  4306. /* */
  4307. function installRenderHelpers (target) {
  4308. target._o = markOnce;
  4309. target._n = toNumber;
  4310. target._s = toString;
  4311. target._l = renderList;
  4312. target._t = renderSlot;
  4313. target._q = looseEqual;
  4314. target._i = looseIndexOf;
  4315. target._m = renderStatic;
  4316. target._f = resolveFilter;
  4317. target._k = checkKeyCodes;
  4318. target._b = bindObjectProps;
  4319. target._v = createTextVNode;
  4320. target._e = createEmptyVNode;
  4321. target._u = resolveScopedSlots;
  4322. target._g = bindObjectListeners;
  4323. target._d = bindDynamicKeys;
  4324. target._p = prependModifier;
  4325. }
  4326. /* */
  4327. function FunctionalRenderContext (
  4328. data,
  4329. props,
  4330. children,
  4331. parent,
  4332. Ctor
  4333. ) {
  4334. var this$1 = this;
  4335. var options = Ctor.options;
  4336. // ensure the createElement function in functional components
  4337. // gets a unique context - this is necessary for correct named slot check
  4338. var contextVm;
  4339. if (hasOwn(parent, '_uid')) {
  4340. contextVm = Object.create(parent);
  4341. // $flow-disable-line
  4342. contextVm._original = parent;
  4343. } else {
  4344. // the context vm passed in is a functional context as well.
  4345. // in this case we want to make sure we are able to get a hold to the
  4346. // real context instance.
  4347. contextVm = parent;
  4348. // $flow-disable-line
  4349. parent = parent._original;
  4350. }
  4351. var isCompiled = isTrue(options._compiled);
  4352. var needNormalization = !isCompiled;
  4353. this.data = data;
  4354. this.props = props;
  4355. this.children = children;
  4356. this.parent = parent;
  4357. this.listeners = data.on || emptyObject;
  4358. this.injections = resolveInject(options.inject, parent);
  4359. this.slots = function () {
  4360. if (!this$1.$slots) {
  4361. normalizeScopedSlots(
  4362. data.scopedSlots,
  4363. this$1.$slots = resolveSlots(children, parent)
  4364. );
  4365. }
  4366. return this$1.$slots
  4367. };
  4368. Object.defineProperty(this, 'scopedSlots', ({
  4369. enumerable: true,
  4370. get: function get () {
  4371. return normalizeScopedSlots(data.scopedSlots, this.slots())
  4372. }
  4373. }));
  4374. // support for compiled functional template
  4375. if (isCompiled) {
  4376. // exposing $options for renderStatic()
  4377. this.$options = options;
  4378. // pre-resolve slots for renderSlot()
  4379. this.$slots = this.slots();
  4380. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  4381. }
  4382. if (options._scopeId) {
  4383. this._c = function (a, b, c, d) {
  4384. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  4385. if (vnode && !Array.isArray(vnode)) {
  4386. vnode.fnScopeId = options._scopeId;
  4387. vnode.fnContext = parent;
  4388. }
  4389. return vnode
  4390. };
  4391. } else {
  4392. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  4393. }
  4394. }
  4395. installRenderHelpers(FunctionalRenderContext.prototype);
  4396. function createFunctionalComponent (
  4397. Ctor,
  4398. propsData,
  4399. data,
  4400. contextVm,
  4401. children
  4402. ) {
  4403. var options = Ctor.options;
  4404. var props = {};
  4405. var propOptions = options.props;
  4406. if (isDef(propOptions)) {
  4407. for (var key in propOptions) {
  4408. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  4409. }
  4410. } else {
  4411. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  4412. if (isDef(data.props)) { mergeProps(props, data.props); }
  4413. }
  4414. var renderContext = new FunctionalRenderContext(
  4415. data,
  4416. props,
  4417. children,
  4418. contextVm,
  4419. Ctor
  4420. );
  4421. var vnode = options.render.call(null, renderContext._c, renderContext);
  4422. if (vnode instanceof VNode) {
  4423. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  4424. } else if (Array.isArray(vnode)) {
  4425. var vnodes = normalizeChildren(vnode) || [];
  4426. var res = new Array(vnodes.length);
  4427. for (var i = 0; i < vnodes.length; i++) {
  4428. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  4429. }
  4430. return res
  4431. }
  4432. }
  4433. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  4434. // #7817 clone node before setting fnContext, otherwise if the node is reused
  4435. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  4436. // that should not be matched to match.
  4437. var clone = cloneVNode(vnode);
  4438. clone.fnContext = contextVm;
  4439. clone.fnOptions = options;
  4440. if (true) {
  4441. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  4442. }
  4443. if (data.slot) {
  4444. (clone.data || (clone.data = {})).slot = data.slot;
  4445. }
  4446. return clone
  4447. }
  4448. function mergeProps (to, from) {
  4449. for (var key in from) {
  4450. to[camelize(key)] = from[key];
  4451. }
  4452. }
  4453. /* */
  4454. /* */
  4455. /* */
  4456. /* */
  4457. // inline hooks to be invoked on component VNodes during patch
  4458. var componentVNodeHooks = {
  4459. init: function init (vnode, hydrating) {
  4460. if (
  4461. vnode.componentInstance &&
  4462. !vnode.componentInstance._isDestroyed &&
  4463. vnode.data.keepAlive
  4464. ) {
  4465. // kept-alive components, treat as a patch
  4466. var mountedNode = vnode; // work around flow
  4467. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  4468. } else {
  4469. var child = vnode.componentInstance = createComponentInstanceForVnode(
  4470. vnode,
  4471. activeInstance
  4472. );
  4473. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  4474. }
  4475. },
  4476. prepatch: function prepatch (oldVnode, vnode) {
  4477. var options = vnode.componentOptions;
  4478. var child = vnode.componentInstance = oldVnode.componentInstance;
  4479. updateChildComponent(
  4480. child,
  4481. options.propsData, // updated props
  4482. options.listeners, // updated listeners
  4483. vnode, // new parent vnode
  4484. options.children // new children
  4485. );
  4486. },
  4487. insert: function insert (vnode) {
  4488. var context = vnode.context;
  4489. var componentInstance = vnode.componentInstance;
  4490. if (!componentInstance._isMounted) {
  4491. callHook(componentInstance, 'onServiceCreated');
  4492. callHook(componentInstance, 'onServiceAttached');
  4493. componentInstance._isMounted = true;
  4494. callHook(componentInstance, 'mounted');
  4495. }
  4496. if (vnode.data.keepAlive) {
  4497. if (context._isMounted) {
  4498. // vue-router#1212
  4499. // During updates, a kept-alive component's child components may
  4500. // change, so directly walking the tree here may call activated hooks
  4501. // on incorrect children. Instead we push them into a queue which will
  4502. // be processed after the whole patch process ended.
  4503. queueActivatedComponent(componentInstance);
  4504. } else {
  4505. activateChildComponent(componentInstance, true /* direct */);
  4506. }
  4507. }
  4508. },
  4509. destroy: function destroy (vnode) {
  4510. var componentInstance = vnode.componentInstance;
  4511. if (!componentInstance._isDestroyed) {
  4512. if (!vnode.data.keepAlive) {
  4513. componentInstance.$destroy();
  4514. } else {
  4515. deactivateChildComponent(componentInstance, true /* direct */);
  4516. }
  4517. }
  4518. }
  4519. };
  4520. var hooksToMerge = Object.keys(componentVNodeHooks);
  4521. function createComponent (
  4522. Ctor,
  4523. data,
  4524. context,
  4525. children,
  4526. tag
  4527. ) {
  4528. if (isUndef(Ctor)) {
  4529. return
  4530. }
  4531. var baseCtor = context.$options._base;
  4532. // plain options object: turn it into a constructor
  4533. if (isObject(Ctor)) {
  4534. Ctor = baseCtor.extend(Ctor);
  4535. }
  4536. // if at this stage it's not a constructor or an async component factory,
  4537. // reject.
  4538. if (typeof Ctor !== 'function') {
  4539. if (true) {
  4540. warn(("Invalid Component definition: " + (String(Ctor))), context);
  4541. }
  4542. return
  4543. }
  4544. // async component
  4545. var asyncFactory;
  4546. if (isUndef(Ctor.cid)) {
  4547. asyncFactory = Ctor;
  4548. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  4549. if (Ctor === undefined) {
  4550. // return a placeholder node for async component, which is rendered
  4551. // as a comment node but preserves all the raw information for the node.
  4552. // the information will be used for async server-rendering and hydration.
  4553. return createAsyncPlaceholder(
  4554. asyncFactory,
  4555. data,
  4556. context,
  4557. children,
  4558. tag
  4559. )
  4560. }
  4561. }
  4562. data = data || {};
  4563. // resolve constructor options in case global mixins are applied after
  4564. // component constructor creation
  4565. resolveConstructorOptions(Ctor);
  4566. // transform component v-model data into props & events
  4567. if (isDef(data.model)) {
  4568. transformModel(Ctor.options, data);
  4569. }
  4570. // extract props
  4571. var propsData = extractPropsFromVNodeData(data, Ctor, tag, context); // fixed by xxxxxx
  4572. // functional component
  4573. if (isTrue(Ctor.options.functional)) {
  4574. return createFunctionalComponent(Ctor, propsData, data, context, children)
  4575. }
  4576. // extract listeners, since these needs to be treated as
  4577. // child component listeners instead of DOM listeners
  4578. var listeners = data.on;
  4579. // replace with listeners with .native modifier
  4580. // so it gets processed during parent component patch.
  4581. data.on = data.nativeOn;
  4582. if (isTrue(Ctor.options.abstract)) {
  4583. // abstract components do not keep anything
  4584. // other than props & listeners & slot
  4585. // work around flow
  4586. var slot = data.slot;
  4587. data = {};
  4588. if (slot) {
  4589. data.slot = slot;
  4590. }
  4591. }
  4592. // install component management hooks onto the placeholder node
  4593. installComponentHooks(data);
  4594. // return a placeholder vnode
  4595. var name = Ctor.options.name || tag;
  4596. var vnode = new VNode(
  4597. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  4598. data, undefined, undefined, undefined, context,
  4599. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  4600. asyncFactory
  4601. );
  4602. return vnode
  4603. }
  4604. function createComponentInstanceForVnode (
  4605. vnode, // we know it's MountedComponentVNode but flow doesn't
  4606. parent // activeInstance in lifecycle state
  4607. ) {
  4608. var options = {
  4609. _isComponent: true,
  4610. _parentVnode: vnode,
  4611. parent: parent
  4612. };
  4613. // check inline-template render functions
  4614. var inlineTemplate = vnode.data.inlineTemplate;
  4615. if (isDef(inlineTemplate)) {
  4616. options.render = inlineTemplate.render;
  4617. options.staticRenderFns = inlineTemplate.staticRenderFns;
  4618. }
  4619. return new vnode.componentOptions.Ctor(options)
  4620. }
  4621. function installComponentHooks (data) {
  4622. var hooks = data.hook || (data.hook = {});
  4623. for (var i = 0; i < hooksToMerge.length; i++) {
  4624. var key = hooksToMerge[i];
  4625. var existing = hooks[key];
  4626. var toMerge = componentVNodeHooks[key];
  4627. if (existing !== toMerge && !(existing && existing._merged)) {
  4628. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  4629. }
  4630. }
  4631. }
  4632. function mergeHook$1 (f1, f2) {
  4633. var merged = function (a, b) {
  4634. // flow complains about extra args which is why we use any
  4635. f1(a, b);
  4636. f2(a, b);
  4637. };
  4638. merged._merged = true;
  4639. return merged
  4640. }
  4641. // transform component v-model info (value and callback) into
  4642. // prop and event handler respectively.
  4643. function transformModel (options, data) {
  4644. var prop = (options.model && options.model.prop) || 'value';
  4645. var event = (options.model && options.model.event) || 'input'
  4646. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  4647. var on = data.on || (data.on = {});
  4648. var existing = on[event];
  4649. var callback = data.model.callback;
  4650. if (isDef(existing)) {
  4651. if (
  4652. Array.isArray(existing)
  4653. ? existing.indexOf(callback) === -1
  4654. : existing !== callback
  4655. ) {
  4656. on[event] = [callback].concat(existing);
  4657. }
  4658. } else {
  4659. on[event] = callback;
  4660. }
  4661. }
  4662. /* */
  4663. var SIMPLE_NORMALIZE = 1;
  4664. var ALWAYS_NORMALIZE = 2;
  4665. // wrapper function for providing a more flexible interface
  4666. // without getting yelled at by flow
  4667. function createElement (
  4668. context,
  4669. tag,
  4670. data,
  4671. children,
  4672. normalizationType,
  4673. alwaysNormalize
  4674. ) {
  4675. if (Array.isArray(data) || isPrimitive(data)) {
  4676. normalizationType = children;
  4677. children = data;
  4678. data = undefined;
  4679. }
  4680. if (isTrue(alwaysNormalize)) {
  4681. normalizationType = ALWAYS_NORMALIZE;
  4682. }
  4683. return _createElement(context, tag, data, children, normalizationType)
  4684. }
  4685. function _createElement (
  4686. context,
  4687. tag,
  4688. data,
  4689. children,
  4690. normalizationType
  4691. ) {
  4692. if (isDef(data) && isDef((data).__ob__)) {
  4693. true && warn(
  4694. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  4695. 'Always create fresh vnode data objects in each render!',
  4696. context
  4697. );
  4698. return createEmptyVNode()
  4699. }
  4700. // object syntax in v-bind
  4701. if (isDef(data) && isDef(data.is)) {
  4702. tag = data.is;
  4703. }
  4704. if (!tag) {
  4705. // in case of component :is set to falsy value
  4706. return createEmptyVNode()
  4707. }
  4708. // warn against non-primitive key
  4709. if ( true &&
  4710. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  4711. ) {
  4712. {
  4713. warn(
  4714. 'Avoid using non-primitive value as key, ' +
  4715. 'use string/number value instead.',
  4716. context
  4717. );
  4718. }
  4719. }
  4720. // support single function children as default scoped slot
  4721. if (Array.isArray(children) &&
  4722. typeof children[0] === 'function'
  4723. ) {
  4724. data = data || {};
  4725. data.scopedSlots = { default: children[0] };
  4726. children.length = 0;
  4727. }
  4728. if (normalizationType === ALWAYS_NORMALIZE) {
  4729. children = normalizeChildren(children);
  4730. } else if (normalizationType === SIMPLE_NORMALIZE) {
  4731. children = simpleNormalizeChildren(children);
  4732. }
  4733. var vnode, ns;
  4734. if (typeof tag === 'string') {
  4735. var Ctor;
  4736. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  4737. if (config.isReservedTag(tag)) {
  4738. // platform built-in elements
  4739. if ( true && isDef(data) && isDef(data.nativeOn)) {
  4740. warn(
  4741. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  4742. context
  4743. );
  4744. }
  4745. vnode = new VNode(
  4746. config.parsePlatformTagName(tag), data, children,
  4747. undefined, undefined, context
  4748. );
  4749. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  4750. // component
  4751. vnode = createComponent(Ctor, data, context, children, tag);
  4752. } else {
  4753. // unknown or unlisted namespaced elements
  4754. // check at runtime because it may get assigned a namespace when its
  4755. // parent normalizes children
  4756. vnode = new VNode(
  4757. tag, data, children,
  4758. undefined, undefined, context
  4759. );
  4760. }
  4761. } else {
  4762. // direct component options / constructor
  4763. vnode = createComponent(tag, data, context, children);
  4764. }
  4765. if (Array.isArray(vnode)) {
  4766. return vnode
  4767. } else if (isDef(vnode)) {
  4768. if (isDef(ns)) { applyNS(vnode, ns); }
  4769. if (isDef(data)) { registerDeepBindings(data); }
  4770. return vnode
  4771. } else {
  4772. return createEmptyVNode()
  4773. }
  4774. }
  4775. function applyNS (vnode, ns, force) {
  4776. vnode.ns = ns;
  4777. if (vnode.tag === 'foreignObject') {
  4778. // use default namespace inside foreignObject
  4779. ns = undefined;
  4780. force = true;
  4781. }
  4782. if (isDef(vnode.children)) {
  4783. for (var i = 0, l = vnode.children.length; i < l; i++) {
  4784. var child = vnode.children[i];
  4785. if (isDef(child.tag) && (
  4786. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  4787. applyNS(child, ns, force);
  4788. }
  4789. }
  4790. }
  4791. }
  4792. // ref #5318
  4793. // necessary to ensure parent re-render when deep bindings like :style and
  4794. // :class are used on slot nodes
  4795. function registerDeepBindings (data) {
  4796. if (isObject(data.style)) {
  4797. traverse(data.style);
  4798. }
  4799. if (isObject(data.class)) {
  4800. traverse(data.class);
  4801. }
  4802. }
  4803. /* */
  4804. function initRender (vm) {
  4805. vm._vnode = null; // the root of the child tree
  4806. vm._staticTrees = null; // v-once cached trees
  4807. var options = vm.$options;
  4808. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  4809. var renderContext = parentVnode && parentVnode.context;
  4810. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  4811. vm.$scopedSlots = emptyObject;
  4812. // bind the createElement fn to this instance
  4813. // so that we get proper render context inside it.
  4814. // args order: tag, data, children, normalizationType, alwaysNormalize
  4815. // internal version is used by render functions compiled from templates
  4816. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  4817. // normalization is always applied for the public version, used in
  4818. // user-written render functions.
  4819. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  4820. // $attrs & $listeners are exposed for easier HOC creation.
  4821. // they need to be reactive so that HOCs using them are always updated
  4822. var parentData = parentVnode && parentVnode.data;
  4823. /* istanbul ignore else */
  4824. if (true) {
  4825. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  4826. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  4827. }, true);
  4828. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  4829. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  4830. }, true);
  4831. } else {}
  4832. }
  4833. var currentRenderingInstance = null;
  4834. function renderMixin (Vue) {
  4835. // install runtime convenience helpers
  4836. installRenderHelpers(Vue.prototype);
  4837. Vue.prototype.$nextTick = function (fn) {
  4838. return nextTick(fn, this)
  4839. };
  4840. Vue.prototype._render = function () {
  4841. var vm = this;
  4842. var ref = vm.$options;
  4843. var render = ref.render;
  4844. var _parentVnode = ref._parentVnode;
  4845. if (_parentVnode) {
  4846. vm.$scopedSlots = normalizeScopedSlots(
  4847. _parentVnode.data.scopedSlots,
  4848. vm.$slots,
  4849. vm.$scopedSlots
  4850. );
  4851. }
  4852. // set parent vnode. this allows render functions to have access
  4853. // to the data on the placeholder node.
  4854. vm.$vnode = _parentVnode;
  4855. // render self
  4856. var vnode;
  4857. try {
  4858. // There's no need to maintain a stack because all render fns are called
  4859. // separately from one another. Nested component's render fns are called
  4860. // when parent component is patched.
  4861. currentRenderingInstance = vm;
  4862. vnode = render.call(vm._renderProxy, vm.$createElement);
  4863. } catch (e) {
  4864. handleError(e, vm, "render");
  4865. // return error render result,
  4866. // or previous vnode to prevent render error causing blank component
  4867. /* istanbul ignore else */
  4868. if ( true && vm.$options.renderError) {
  4869. try {
  4870. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  4871. } catch (e) {
  4872. handleError(e, vm, "renderError");
  4873. vnode = vm._vnode;
  4874. }
  4875. } else {
  4876. vnode = vm._vnode;
  4877. }
  4878. } finally {
  4879. currentRenderingInstance = null;
  4880. }
  4881. // if the returned array contains only a single node, allow it
  4882. if (Array.isArray(vnode) && vnode.length === 1) {
  4883. vnode = vnode[0];
  4884. }
  4885. // return empty vnode in case the render function errored out
  4886. if (!(vnode instanceof VNode)) {
  4887. if ( true && Array.isArray(vnode)) {
  4888. warn(
  4889. 'Multiple root nodes returned from render function. Render function ' +
  4890. 'should return a single root node.',
  4891. vm
  4892. );
  4893. }
  4894. vnode = createEmptyVNode();
  4895. }
  4896. // set parent
  4897. vnode.parent = _parentVnode;
  4898. return vnode
  4899. };
  4900. }
  4901. /* */
  4902. function ensureCtor (comp, base) {
  4903. if (
  4904. comp.__esModule ||
  4905. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  4906. ) {
  4907. comp = comp.default;
  4908. }
  4909. return isObject(comp)
  4910. ? base.extend(comp)
  4911. : comp
  4912. }
  4913. function createAsyncPlaceholder (
  4914. factory,
  4915. data,
  4916. context,
  4917. children,
  4918. tag
  4919. ) {
  4920. var node = createEmptyVNode();
  4921. node.asyncFactory = factory;
  4922. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  4923. return node
  4924. }
  4925. function resolveAsyncComponent (
  4926. factory,
  4927. baseCtor
  4928. ) {
  4929. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  4930. return factory.errorComp
  4931. }
  4932. if (isDef(factory.resolved)) {
  4933. return factory.resolved
  4934. }
  4935. var owner = currentRenderingInstance;
  4936. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  4937. // already pending
  4938. factory.owners.push(owner);
  4939. }
  4940. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  4941. return factory.loadingComp
  4942. }
  4943. if (owner && !isDef(factory.owners)) {
  4944. var owners = factory.owners = [owner];
  4945. var sync = true;
  4946. var timerLoading = null;
  4947. var timerTimeout = null
  4948. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  4949. var forceRender = function (renderCompleted) {
  4950. for (var i = 0, l = owners.length; i < l; i++) {
  4951. (owners[i]).$forceUpdate();
  4952. }
  4953. if (renderCompleted) {
  4954. owners.length = 0;
  4955. if (timerLoading !== null) {
  4956. clearTimeout(timerLoading);
  4957. timerLoading = null;
  4958. }
  4959. if (timerTimeout !== null) {
  4960. clearTimeout(timerTimeout);
  4961. timerTimeout = null;
  4962. }
  4963. }
  4964. };
  4965. var resolve = once(function (res) {
  4966. // cache resolved
  4967. factory.resolved = ensureCtor(res, baseCtor);
  4968. // invoke callbacks only if this is not a synchronous resolve
  4969. // (async resolves are shimmed as synchronous during SSR)
  4970. if (!sync) {
  4971. forceRender(true);
  4972. } else {
  4973. owners.length = 0;
  4974. }
  4975. });
  4976. var reject = once(function (reason) {
  4977. true && warn(
  4978. "Failed to resolve async component: " + (String(factory)) +
  4979. (reason ? ("\nReason: " + reason) : '')
  4980. );
  4981. if (isDef(factory.errorComp)) {
  4982. factory.error = true;
  4983. forceRender(true);
  4984. }
  4985. });
  4986. var res = factory(resolve, reject);
  4987. if (isObject(res)) {
  4988. if (isPromise(res)) {
  4989. // () => Promise
  4990. if (isUndef(factory.resolved)) {
  4991. res.then(resolve, reject);
  4992. }
  4993. } else if (isPromise(res.component)) {
  4994. res.component.then(resolve, reject);
  4995. if (isDef(res.error)) {
  4996. factory.errorComp = ensureCtor(res.error, baseCtor);
  4997. }
  4998. if (isDef(res.loading)) {
  4999. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  5000. if (res.delay === 0) {
  5001. factory.loading = true;
  5002. } else {
  5003. timerLoading = setTimeout(function () {
  5004. timerLoading = null;
  5005. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  5006. factory.loading = true;
  5007. forceRender(false);
  5008. }
  5009. }, res.delay || 200);
  5010. }
  5011. }
  5012. if (isDef(res.timeout)) {
  5013. timerTimeout = setTimeout(function () {
  5014. timerTimeout = null;
  5015. if (isUndef(factory.resolved)) {
  5016. reject(
  5017. true
  5018. ? ("timeout (" + (res.timeout) + "ms)")
  5019. : undefined
  5020. );
  5021. }
  5022. }, res.timeout);
  5023. }
  5024. }
  5025. }
  5026. sync = false;
  5027. // return in case resolved synchronously
  5028. return factory.loading
  5029. ? factory.loadingComp
  5030. : factory.resolved
  5031. }
  5032. }
  5033. /* */
  5034. function isAsyncPlaceholder (node) {
  5035. return node.isComment && node.asyncFactory
  5036. }
  5037. /* */
  5038. function getFirstComponentChild (children) {
  5039. if (Array.isArray(children)) {
  5040. for (var i = 0; i < children.length; i++) {
  5041. var c = children[i];
  5042. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  5043. return c
  5044. }
  5045. }
  5046. }
  5047. }
  5048. /* */
  5049. /* */
  5050. function initEvents (vm) {
  5051. vm._events = Object.create(null);
  5052. vm._hasHookEvent = false;
  5053. // init parent attached events
  5054. var listeners = vm.$options._parentListeners;
  5055. if (listeners) {
  5056. updateComponentListeners(vm, listeners);
  5057. }
  5058. }
  5059. var target;
  5060. function add (event, fn) {
  5061. target.$on(event, fn);
  5062. }
  5063. function remove$1 (event, fn) {
  5064. target.$off(event, fn);
  5065. }
  5066. function createOnceHandler (event, fn) {
  5067. var _target = target;
  5068. return function onceHandler () {
  5069. var res = fn.apply(null, arguments);
  5070. if (res !== null) {
  5071. _target.$off(event, onceHandler);
  5072. }
  5073. }
  5074. }
  5075. function updateComponentListeners (
  5076. vm,
  5077. listeners,
  5078. oldListeners
  5079. ) {
  5080. target = vm;
  5081. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  5082. target = undefined;
  5083. }
  5084. function eventsMixin (Vue) {
  5085. var hookRE = /^hook:/;
  5086. Vue.prototype.$on = function (event, fn) {
  5087. var vm = this;
  5088. if (Array.isArray(event)) {
  5089. for (var i = 0, l = event.length; i < l; i++) {
  5090. vm.$on(event[i], fn);
  5091. }
  5092. } else {
  5093. (vm._events[event] || (vm._events[event] = [])).push(fn);
  5094. // optimize hook:event cost by using a boolean flag marked at registration
  5095. // instead of a hash lookup
  5096. if (hookRE.test(event)) {
  5097. vm._hasHookEvent = true;
  5098. }
  5099. }
  5100. return vm
  5101. };
  5102. Vue.prototype.$once = function (event, fn) {
  5103. var vm = this;
  5104. function on () {
  5105. vm.$off(event, on);
  5106. fn.apply(vm, arguments);
  5107. }
  5108. on.fn = fn;
  5109. vm.$on(event, on);
  5110. return vm
  5111. };
  5112. Vue.prototype.$off = function (event, fn) {
  5113. var vm = this;
  5114. // all
  5115. if (!arguments.length) {
  5116. vm._events = Object.create(null);
  5117. return vm
  5118. }
  5119. // array of events
  5120. if (Array.isArray(event)) {
  5121. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  5122. vm.$off(event[i$1], fn);
  5123. }
  5124. return vm
  5125. }
  5126. // specific event
  5127. var cbs = vm._events[event];
  5128. if (!cbs) {
  5129. return vm
  5130. }
  5131. if (!fn) {
  5132. vm._events[event] = null;
  5133. return vm
  5134. }
  5135. // specific handler
  5136. var cb;
  5137. var i = cbs.length;
  5138. while (i--) {
  5139. cb = cbs[i];
  5140. if (cb === fn || cb.fn === fn) {
  5141. cbs.splice(i, 1);
  5142. break
  5143. }
  5144. }
  5145. return vm
  5146. };
  5147. Vue.prototype.$emit = function (event) {
  5148. var vm = this;
  5149. if (true) {
  5150. var lowerCaseEvent = event.toLowerCase();
  5151. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  5152. tip(
  5153. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  5154. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  5155. "Note that HTML attributes are case-insensitive and you cannot use " +
  5156. "v-on to listen to camelCase events when using in-DOM templates. " +
  5157. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  5158. );
  5159. }
  5160. }
  5161. var cbs = vm._events[event];
  5162. if (cbs) {
  5163. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  5164. var args = toArray(arguments, 1);
  5165. var info = "event handler for \"" + event + "\"";
  5166. for (var i = 0, l = cbs.length; i < l; i++) {
  5167. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  5168. }
  5169. }
  5170. return vm
  5171. };
  5172. }
  5173. /* */
  5174. var activeInstance = null;
  5175. var isUpdatingChildComponent = false;
  5176. function setActiveInstance(vm) {
  5177. var prevActiveInstance = activeInstance;
  5178. activeInstance = vm;
  5179. return function () {
  5180. activeInstance = prevActiveInstance;
  5181. }
  5182. }
  5183. function initLifecycle (vm) {
  5184. var options = vm.$options;
  5185. // locate first non-abstract parent
  5186. var parent = options.parent;
  5187. if (parent && !options.abstract) {
  5188. while (parent.$options.abstract && parent.$parent) {
  5189. parent = parent.$parent;
  5190. }
  5191. parent.$children.push(vm);
  5192. }
  5193. vm.$parent = parent;
  5194. vm.$root = parent ? parent.$root : vm;
  5195. vm.$children = [];
  5196. vm.$refs = {};
  5197. vm._watcher = null;
  5198. vm._inactive = null;
  5199. vm._directInactive = false;
  5200. vm._isMounted = false;
  5201. vm._isDestroyed = false;
  5202. vm._isBeingDestroyed = false;
  5203. }
  5204. function lifecycleMixin (Vue) {
  5205. Vue.prototype._update = function (vnode, hydrating) {
  5206. var vm = this;
  5207. var prevEl = vm.$el;
  5208. var prevVnode = vm._vnode;
  5209. var restoreActiveInstance = setActiveInstance(vm);
  5210. vm._vnode = vnode;
  5211. // Vue.prototype.__patch__ is injected in entry points
  5212. // based on the rendering backend used.
  5213. if (!prevVnode) {
  5214. // initial render
  5215. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  5216. } else {
  5217. // updates
  5218. vm.$el = vm.__patch__(prevVnode, vnode);
  5219. }
  5220. restoreActiveInstance();
  5221. // update __vue__ reference
  5222. if (prevEl) {
  5223. prevEl.__vue__ = null;
  5224. }
  5225. if (vm.$el) {
  5226. vm.$el.__vue__ = vm;
  5227. }
  5228. // if parent is an HOC, update its $el as well
  5229. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  5230. vm.$parent.$el = vm.$el;
  5231. }
  5232. // updated hook is called by the scheduler to ensure that children are
  5233. // updated in a parent's updated hook.
  5234. };
  5235. Vue.prototype.$forceUpdate = function () {
  5236. var vm = this;
  5237. if (vm._watcher) {
  5238. vm._watcher.update();
  5239. }
  5240. };
  5241. Vue.prototype.$destroy = function () {
  5242. var vm = this;
  5243. if (vm._isBeingDestroyed) {
  5244. return
  5245. }
  5246. callHook(vm, 'beforeDestroy');
  5247. vm._isBeingDestroyed = true;
  5248. // remove self from parent
  5249. var parent = vm.$parent;
  5250. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  5251. remove(parent.$children, vm);
  5252. }
  5253. // teardown watchers
  5254. if (vm._watcher) {
  5255. vm._watcher.teardown();
  5256. }
  5257. var i = vm._watchers.length;
  5258. while (i--) {
  5259. vm._watchers[i].teardown();
  5260. }
  5261. // remove reference from data ob
  5262. // frozen object may not have observer.
  5263. if (vm._data.__ob__) {
  5264. vm._data.__ob__.vmCount--;
  5265. }
  5266. // call the last hook...
  5267. vm._isDestroyed = true;
  5268. // invoke destroy hooks on current rendered tree
  5269. vm.__patch__(vm._vnode, null);
  5270. // fire destroyed hook
  5271. callHook(vm, 'destroyed');
  5272. // turn off all instance listeners.
  5273. vm.$off();
  5274. // remove __vue__ reference
  5275. if (vm.$el) {
  5276. vm.$el.__vue__ = null;
  5277. }
  5278. // release circular reference (#6759)
  5279. if (vm.$vnode) {
  5280. vm.$vnode.parent = null;
  5281. }
  5282. };
  5283. }
  5284. function updateChildComponent (
  5285. vm,
  5286. propsData,
  5287. listeners,
  5288. parentVnode,
  5289. renderChildren
  5290. ) {
  5291. if (true) {
  5292. isUpdatingChildComponent = true;
  5293. }
  5294. // determine whether component has slot children
  5295. // we need to do this before overwriting $options._renderChildren.
  5296. // check if there are dynamic scopedSlots (hand-written or compiled but with
  5297. // dynamic slot names). Static scoped slots compiled from template has the
  5298. // "$stable" marker.
  5299. var newScopedSlots = parentVnode.data.scopedSlots;
  5300. var oldScopedSlots = vm.$scopedSlots;
  5301. var hasDynamicScopedSlot = !!(
  5302. (newScopedSlots && !newScopedSlots.$stable) ||
  5303. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  5304. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  5305. );
  5306. // Any static slot children from the parent may have changed during parent's
  5307. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  5308. // update is necessary to ensure correctness.
  5309. var needsForceUpdate = !!(
  5310. renderChildren || // has new static slots
  5311. vm.$options._renderChildren || // has old static slots
  5312. hasDynamicScopedSlot
  5313. );
  5314. vm.$options._parentVnode = parentVnode;
  5315. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  5316. if (vm._vnode) { // update child tree's parent
  5317. vm._vnode.parent = parentVnode;
  5318. }
  5319. vm.$options._renderChildren = renderChildren;
  5320. // update $attrs and $listeners hash
  5321. // these are also reactive so they may trigger child update if the child
  5322. // used them during render
  5323. vm.$attrs = parentVnode.data.attrs || emptyObject;
  5324. vm.$listeners = listeners || emptyObject;
  5325. // update props
  5326. if (propsData && vm.$options.props) {
  5327. toggleObserving(false);
  5328. var props = vm._props;
  5329. var propKeys = vm.$options._propKeys || [];
  5330. for (var i = 0; i < propKeys.length; i++) {
  5331. var key = propKeys[i];
  5332. var propOptions = vm.$options.props; // wtf flow?
  5333. props[key] = validateProp(key, propOptions, propsData, vm);
  5334. }
  5335. toggleObserving(true);
  5336. // keep a copy of raw propsData
  5337. vm.$options.propsData = propsData;
  5338. }
  5339. // fixed by xxxxxx update properties(mp runtime)
  5340. vm._$updateProperties && vm._$updateProperties(vm);
  5341. // update listeners
  5342. listeners = listeners || emptyObject;
  5343. var oldListeners = vm.$options._parentListeners;
  5344. vm.$options._parentListeners = listeners;
  5345. updateComponentListeners(vm, listeners, oldListeners);
  5346. // resolve slots + force update if has children
  5347. if (needsForceUpdate) {
  5348. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  5349. vm.$forceUpdate();
  5350. }
  5351. if (true) {
  5352. isUpdatingChildComponent = false;
  5353. }
  5354. }
  5355. function isInInactiveTree (vm) {
  5356. while (vm && (vm = vm.$parent)) {
  5357. if (vm._inactive) { return true }
  5358. }
  5359. return false
  5360. }
  5361. function activateChildComponent (vm, direct) {
  5362. if (direct) {
  5363. vm._directInactive = false;
  5364. if (isInInactiveTree(vm)) {
  5365. return
  5366. }
  5367. } else if (vm._directInactive) {
  5368. return
  5369. }
  5370. if (vm._inactive || vm._inactive === null) {
  5371. vm._inactive = false;
  5372. for (var i = 0; i < vm.$children.length; i++) {
  5373. activateChildComponent(vm.$children[i]);
  5374. }
  5375. callHook(vm, 'activated');
  5376. }
  5377. }
  5378. function deactivateChildComponent (vm, direct) {
  5379. if (direct) {
  5380. vm._directInactive = true;
  5381. if (isInInactiveTree(vm)) {
  5382. return
  5383. }
  5384. }
  5385. if (!vm._inactive) {
  5386. vm._inactive = true;
  5387. for (var i = 0; i < vm.$children.length; i++) {
  5388. deactivateChildComponent(vm.$children[i]);
  5389. }
  5390. callHook(vm, 'deactivated');
  5391. }
  5392. }
  5393. function callHook (vm, hook) {
  5394. // #7573 disable dep collection when invoking lifecycle hooks
  5395. pushTarget();
  5396. var handlers = vm.$options[hook];
  5397. var info = hook + " hook";
  5398. if (handlers) {
  5399. for (var i = 0, j = handlers.length; i < j; i++) {
  5400. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  5401. }
  5402. }
  5403. if (vm._hasHookEvent) {
  5404. vm.$emit('hook:' + hook);
  5405. }
  5406. popTarget();
  5407. }
  5408. /* */
  5409. var MAX_UPDATE_COUNT = 100;
  5410. var queue = [];
  5411. var activatedChildren = [];
  5412. var has = {};
  5413. var circular = {};
  5414. var waiting = false;
  5415. var flushing = false;
  5416. var index = 0;
  5417. /**
  5418. * Reset the scheduler's state.
  5419. */
  5420. function resetSchedulerState () {
  5421. index = queue.length = activatedChildren.length = 0;
  5422. has = {};
  5423. if (true) {
  5424. circular = {};
  5425. }
  5426. waiting = flushing = false;
  5427. }
  5428. // Async edge case #6566 requires saving the timestamp when event listeners are
  5429. // attached. However, calling performance.now() has a perf overhead especially
  5430. // if the page has thousands of event listeners. Instead, we take a timestamp
  5431. // every time the scheduler flushes and use that for all event listeners
  5432. // attached during that flush.
  5433. var currentFlushTimestamp = 0;
  5434. // Async edge case fix requires storing an event listener's attach timestamp.
  5435. var getNow = Date.now;
  5436. // Determine what event timestamp the browser is using. Annoyingly, the
  5437. // timestamp can either be hi-res (relative to page load) or low-res
  5438. // (relative to UNIX epoch), so in order to compare time we have to use the
  5439. // same timestamp type when saving the flush timestamp.
  5440. // All IE versions use low-res event timestamps, and have problematic clock
  5441. // implementations (#9632)
  5442. if (inBrowser && !isIE) {
  5443. var performance = window.performance;
  5444. if (
  5445. performance &&
  5446. typeof performance.now === 'function' &&
  5447. getNow() > document.createEvent('Event').timeStamp
  5448. ) {
  5449. // if the event timestamp, although evaluated AFTER the Date.now(), is
  5450. // smaller than it, it means the event is using a hi-res timestamp,
  5451. // and we need to use the hi-res version for event listener timestamps as
  5452. // well.
  5453. getNow = function () { return performance.now(); };
  5454. }
  5455. }
  5456. /**
  5457. * Flush both queues and run the watchers.
  5458. */
  5459. function flushSchedulerQueue () {
  5460. currentFlushTimestamp = getNow();
  5461. flushing = true;
  5462. var watcher, id;
  5463. // Sort queue before flush.
  5464. // This ensures that:
  5465. // 1. Components are updated from parent to child. (because parent is always
  5466. // created before the child)
  5467. // 2. A component's user watchers are run before its render watcher (because
  5468. // user watchers are created before the render watcher)
  5469. // 3. If a component is destroyed during a parent component's watcher run,
  5470. // its watchers can be skipped.
  5471. queue.sort(function (a, b) { return a.id - b.id; });
  5472. // do not cache length because more watchers might be pushed
  5473. // as we run existing watchers
  5474. for (index = 0; index < queue.length; index++) {
  5475. watcher = queue[index];
  5476. if (watcher.before) {
  5477. watcher.before();
  5478. }
  5479. id = watcher.id;
  5480. has[id] = null;
  5481. watcher.run();
  5482. // in dev build, check and stop circular updates.
  5483. if ( true && has[id] != null) {
  5484. circular[id] = (circular[id] || 0) + 1;
  5485. if (circular[id] > MAX_UPDATE_COUNT) {
  5486. warn(
  5487. 'You may have an infinite update loop ' + (
  5488. watcher.user
  5489. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  5490. : "in a component render function."
  5491. ),
  5492. watcher.vm
  5493. );
  5494. break
  5495. }
  5496. }
  5497. }
  5498. // keep copies of post queues before resetting state
  5499. var activatedQueue = activatedChildren.slice();
  5500. var updatedQueue = queue.slice();
  5501. resetSchedulerState();
  5502. // call component updated and activated hooks
  5503. callActivatedHooks(activatedQueue);
  5504. callUpdatedHooks(updatedQueue);
  5505. // devtool hook
  5506. /* istanbul ignore if */
  5507. if (devtools && config.devtools) {
  5508. devtools.emit('flush');
  5509. }
  5510. }
  5511. function callUpdatedHooks (queue) {
  5512. var i = queue.length;
  5513. while (i--) {
  5514. var watcher = queue[i];
  5515. var vm = watcher.vm;
  5516. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  5517. callHook(vm, 'updated');
  5518. }
  5519. }
  5520. }
  5521. /**
  5522. * Queue a kept-alive component that was activated during patch.
  5523. * The queue will be processed after the entire tree has been patched.
  5524. */
  5525. function queueActivatedComponent (vm) {
  5526. // setting _inactive to false here so that a render function can
  5527. // rely on checking whether it's in an inactive tree (e.g. router-view)
  5528. vm._inactive = false;
  5529. activatedChildren.push(vm);
  5530. }
  5531. function callActivatedHooks (queue) {
  5532. for (var i = 0; i < queue.length; i++) {
  5533. queue[i]._inactive = true;
  5534. activateChildComponent(queue[i], true /* true */);
  5535. }
  5536. }
  5537. /**
  5538. * Push a watcher into the watcher queue.
  5539. * Jobs with duplicate IDs will be skipped unless it's
  5540. * pushed when the queue is being flushed.
  5541. */
  5542. function queueWatcher (watcher) {
  5543. var id = watcher.id;
  5544. if (has[id] == null) {
  5545. has[id] = true;
  5546. if (!flushing) {
  5547. queue.push(watcher);
  5548. } else {
  5549. // if already flushing, splice the watcher based on its id
  5550. // if already past its id, it will be run next immediately.
  5551. var i = queue.length - 1;
  5552. while (i > index && queue[i].id > watcher.id) {
  5553. i--;
  5554. }
  5555. queue.splice(i + 1, 0, watcher);
  5556. }
  5557. // queue the flush
  5558. if (!waiting) {
  5559. waiting = true;
  5560. if ( true && !config.async) {
  5561. flushSchedulerQueue();
  5562. return
  5563. }
  5564. nextTick(flushSchedulerQueue);
  5565. }
  5566. }
  5567. }
  5568. /* */
  5569. var uid$2 = 0;
  5570. /**
  5571. * A watcher parses an expression, collects dependencies,
  5572. * and fires callback when the expression value changes.
  5573. * This is used for both the $watch() api and directives.
  5574. */
  5575. var Watcher = function Watcher (
  5576. vm,
  5577. expOrFn,
  5578. cb,
  5579. options,
  5580. isRenderWatcher
  5581. ) {
  5582. this.vm = vm;
  5583. if (isRenderWatcher) {
  5584. vm._watcher = this;
  5585. }
  5586. vm._watchers.push(this);
  5587. // options
  5588. if (options) {
  5589. this.deep = !!options.deep;
  5590. this.user = !!options.user;
  5591. this.lazy = !!options.lazy;
  5592. this.sync = !!options.sync;
  5593. this.before = options.before;
  5594. } else {
  5595. this.deep = this.user = this.lazy = this.sync = false;
  5596. }
  5597. this.cb = cb;
  5598. this.id = ++uid$2; // uid for batching
  5599. this.active = true;
  5600. this.dirty = this.lazy; // for lazy watchers
  5601. this.deps = [];
  5602. this.newDeps = [];
  5603. this.depIds = new _Set();
  5604. this.newDepIds = new _Set();
  5605. this.expression = true
  5606. ? expOrFn.toString()
  5607. : undefined;
  5608. // parse expression for getter
  5609. if (typeof expOrFn === 'function') {
  5610. this.getter = expOrFn;
  5611. } else {
  5612. this.getter = parsePath(expOrFn);
  5613. if (!this.getter) {
  5614. this.getter = noop;
  5615. true && warn(
  5616. "Failed watching path: \"" + expOrFn + "\" " +
  5617. 'Watcher only accepts simple dot-delimited paths. ' +
  5618. 'For full control, use a function instead.',
  5619. vm
  5620. );
  5621. }
  5622. }
  5623. this.value = this.lazy
  5624. ? undefined
  5625. : this.get();
  5626. };
  5627. /**
  5628. * Evaluate the getter, and re-collect dependencies.
  5629. */
  5630. Watcher.prototype.get = function get () {
  5631. pushTarget(this);
  5632. var value;
  5633. var vm = this.vm;
  5634. try {
  5635. value = this.getter.call(vm, vm);
  5636. } catch (e) {
  5637. if (this.user) {
  5638. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  5639. } else {
  5640. throw e
  5641. }
  5642. } finally {
  5643. // "touch" every property so they are all tracked as
  5644. // dependencies for deep watching
  5645. if (this.deep) {
  5646. traverse(value);
  5647. }
  5648. popTarget();
  5649. this.cleanupDeps();
  5650. }
  5651. return value
  5652. };
  5653. /**
  5654. * Add a dependency to this directive.
  5655. */
  5656. Watcher.prototype.addDep = function addDep (dep) {
  5657. var id = dep.id;
  5658. if (!this.newDepIds.has(id)) {
  5659. this.newDepIds.add(id);
  5660. this.newDeps.push(dep);
  5661. if (!this.depIds.has(id)) {
  5662. dep.addSub(this);
  5663. }
  5664. }
  5665. };
  5666. /**
  5667. * Clean up for dependency collection.
  5668. */
  5669. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  5670. var i = this.deps.length;
  5671. while (i--) {
  5672. var dep = this.deps[i];
  5673. if (!this.newDepIds.has(dep.id)) {
  5674. dep.removeSub(this);
  5675. }
  5676. }
  5677. var tmp = this.depIds;
  5678. this.depIds = this.newDepIds;
  5679. this.newDepIds = tmp;
  5680. this.newDepIds.clear();
  5681. tmp = this.deps;
  5682. this.deps = this.newDeps;
  5683. this.newDeps = tmp;
  5684. this.newDeps.length = 0;
  5685. };
  5686. /**
  5687. * Subscriber interface.
  5688. * Will be called when a dependency changes.
  5689. */
  5690. Watcher.prototype.update = function update () {
  5691. /* istanbul ignore else */
  5692. if (this.lazy) {
  5693. this.dirty = true;
  5694. } else if (this.sync) {
  5695. this.run();
  5696. } else {
  5697. queueWatcher(this);
  5698. }
  5699. };
  5700. /**
  5701. * Scheduler job interface.
  5702. * Will be called by the scheduler.
  5703. */
  5704. Watcher.prototype.run = function run () {
  5705. if (this.active) {
  5706. var value = this.get();
  5707. if (
  5708. value !== this.value ||
  5709. // Deep watchers and watchers on Object/Arrays should fire even
  5710. // when the value is the same, because the value may
  5711. // have mutated.
  5712. isObject(value) ||
  5713. this.deep
  5714. ) {
  5715. // set new value
  5716. var oldValue = this.value;
  5717. this.value = value;
  5718. if (this.user) {
  5719. try {
  5720. this.cb.call(this.vm, value, oldValue);
  5721. } catch (e) {
  5722. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  5723. }
  5724. } else {
  5725. this.cb.call(this.vm, value, oldValue);
  5726. }
  5727. }
  5728. }
  5729. };
  5730. /**
  5731. * Evaluate the value of the watcher.
  5732. * This only gets called for lazy watchers.
  5733. */
  5734. Watcher.prototype.evaluate = function evaluate () {
  5735. this.value = this.get();
  5736. this.dirty = false;
  5737. };
  5738. /**
  5739. * Depend on all deps collected by this watcher.
  5740. */
  5741. Watcher.prototype.depend = function depend () {
  5742. var i = this.deps.length;
  5743. while (i--) {
  5744. this.deps[i].depend();
  5745. }
  5746. };
  5747. /**
  5748. * Remove self from all dependencies' subscriber list.
  5749. */
  5750. Watcher.prototype.teardown = function teardown () {
  5751. if (this.active) {
  5752. // remove self from vm's watcher list
  5753. // this is a somewhat expensive operation so we skip it
  5754. // if the vm is being destroyed.
  5755. if (!this.vm._isBeingDestroyed) {
  5756. remove(this.vm._watchers, this);
  5757. }
  5758. var i = this.deps.length;
  5759. while (i--) {
  5760. this.deps[i].removeSub(this);
  5761. }
  5762. this.active = false;
  5763. }
  5764. };
  5765. /* */
  5766. var sharedPropertyDefinition = {
  5767. enumerable: true,
  5768. configurable: true,
  5769. get: noop,
  5770. set: noop
  5771. };
  5772. function proxy (target, sourceKey, key) {
  5773. sharedPropertyDefinition.get = function proxyGetter () {
  5774. return this[sourceKey][key]
  5775. };
  5776. sharedPropertyDefinition.set = function proxySetter (val) {
  5777. this[sourceKey][key] = val;
  5778. };
  5779. Object.defineProperty(target, key, sharedPropertyDefinition);
  5780. }
  5781. function initState (vm) {
  5782. vm._watchers = [];
  5783. var opts = vm.$options;
  5784. if (opts.props) { initProps(vm, opts.props); }
  5785. if (opts.methods) { initMethods(vm, opts.methods); }
  5786. if (opts.data) {
  5787. initData(vm);
  5788. } else {
  5789. observe(vm._data = {}, true /* asRootData */);
  5790. }
  5791. if (opts.computed) { initComputed(vm, opts.computed); }
  5792. if (opts.watch && opts.watch !== nativeWatch) {
  5793. initWatch(vm, opts.watch);
  5794. }
  5795. }
  5796. function initProps (vm, propsOptions) {
  5797. var propsData = vm.$options.propsData || {};
  5798. var props = vm._props = {};
  5799. // cache prop keys so that future props updates can iterate using Array
  5800. // instead of dynamic object key enumeration.
  5801. var keys = vm.$options._propKeys = [];
  5802. var isRoot = !vm.$parent;
  5803. // root instance props should be converted
  5804. if (!isRoot) {
  5805. toggleObserving(false);
  5806. }
  5807. var loop = function ( key ) {
  5808. keys.push(key);
  5809. var value = validateProp(key, propsOptions, propsData, vm);
  5810. /* istanbul ignore else */
  5811. if (true) {
  5812. var hyphenatedKey = hyphenate(key);
  5813. if (isReservedAttribute(hyphenatedKey) ||
  5814. config.isReservedAttr(hyphenatedKey)) {
  5815. warn(
  5816. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  5817. vm
  5818. );
  5819. }
  5820. defineReactive$$1(props, key, value, function () {
  5821. if (!isRoot && !isUpdatingChildComponent) {
  5822. {
  5823. if(vm.mpHost === 'mp-baidu' || vm.mpHost === 'mp-kuaishou'){//百度、快手 observer 在 setData callback 之后触发,直接忽略该 warn
  5824. return
  5825. }
  5826. //fixed by xxxxxx __next_tick_pending,uni://form-field 时不告警
  5827. if(
  5828. key === 'value' &&
  5829. Array.isArray(vm.$options.behaviors) &&
  5830. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  5831. ){
  5832. return
  5833. }
  5834. if(vm._getFormData){
  5835. return
  5836. }
  5837. var $parent = vm.$parent;
  5838. while($parent){
  5839. if($parent.__next_tick_pending){
  5840. return
  5841. }
  5842. $parent = $parent.$parent;
  5843. }
  5844. }
  5845. warn(
  5846. "Avoid mutating a prop directly since the value will be " +
  5847. "overwritten whenever the parent component re-renders. " +
  5848. "Instead, use a data or computed property based on the prop's " +
  5849. "value. Prop being mutated: \"" + key + "\"",
  5850. vm
  5851. );
  5852. }
  5853. });
  5854. } else {}
  5855. // static props are already proxied on the component's prototype
  5856. // during Vue.extend(). We only need to proxy props defined at
  5857. // instantiation here.
  5858. if (!(key in vm)) {
  5859. proxy(vm, "_props", key);
  5860. }
  5861. };
  5862. for (var key in propsOptions) loop( key );
  5863. toggleObserving(true);
  5864. }
  5865. function initData (vm) {
  5866. var data = vm.$options.data;
  5867. data = vm._data = typeof data === 'function'
  5868. ? getData(data, vm)
  5869. : data || {};
  5870. if (!isPlainObject(data)) {
  5871. data = {};
  5872. true && warn(
  5873. 'data functions should return an object:\n' +
  5874. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  5875. vm
  5876. );
  5877. }
  5878. // proxy data on instance
  5879. var keys = Object.keys(data);
  5880. var props = vm.$options.props;
  5881. var methods = vm.$options.methods;
  5882. var i = keys.length;
  5883. while (i--) {
  5884. var key = keys[i];
  5885. if (true) {
  5886. if (methods && hasOwn(methods, key)) {
  5887. warn(
  5888. ("Method \"" + key + "\" has already been defined as a data property."),
  5889. vm
  5890. );
  5891. }
  5892. }
  5893. if (props && hasOwn(props, key)) {
  5894. true && warn(
  5895. "The data property \"" + key + "\" is already declared as a prop. " +
  5896. "Use prop default value instead.",
  5897. vm
  5898. );
  5899. } else if (!isReserved(key)) {
  5900. proxy(vm, "_data", key);
  5901. }
  5902. }
  5903. // observe data
  5904. observe(data, true /* asRootData */);
  5905. }
  5906. function getData (data, vm) {
  5907. // #7573 disable dep collection when invoking data getters
  5908. pushTarget();
  5909. try {
  5910. return data.call(vm, vm)
  5911. } catch (e) {
  5912. handleError(e, vm, "data()");
  5913. return {}
  5914. } finally {
  5915. popTarget();
  5916. }
  5917. }
  5918. var computedWatcherOptions = { lazy: true };
  5919. function initComputed (vm, computed) {
  5920. // $flow-disable-line
  5921. var watchers = vm._computedWatchers = Object.create(null);
  5922. // computed properties are just getters during SSR
  5923. var isSSR = isServerRendering();
  5924. for (var key in computed) {
  5925. var userDef = computed[key];
  5926. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  5927. if ( true && getter == null) {
  5928. warn(
  5929. ("Getter is missing for computed property \"" + key + "\"."),
  5930. vm
  5931. );
  5932. }
  5933. if (!isSSR) {
  5934. // create internal watcher for the computed property.
  5935. watchers[key] = new Watcher(
  5936. vm,
  5937. getter || noop,
  5938. noop,
  5939. computedWatcherOptions
  5940. );
  5941. }
  5942. // component-defined computed properties are already defined on the
  5943. // component prototype. We only need to define computed properties defined
  5944. // at instantiation here.
  5945. if (!(key in vm)) {
  5946. defineComputed(vm, key, userDef);
  5947. } else if (true) {
  5948. if (key in vm.$data) {
  5949. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  5950. } else if (vm.$options.props && key in vm.$options.props) {
  5951. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  5952. }
  5953. }
  5954. }
  5955. }
  5956. function defineComputed (
  5957. target,
  5958. key,
  5959. userDef
  5960. ) {
  5961. var shouldCache = !isServerRendering();
  5962. if (typeof userDef === 'function') {
  5963. sharedPropertyDefinition.get = shouldCache
  5964. ? createComputedGetter(key)
  5965. : createGetterInvoker(userDef);
  5966. sharedPropertyDefinition.set = noop;
  5967. } else {
  5968. sharedPropertyDefinition.get = userDef.get
  5969. ? shouldCache && userDef.cache !== false
  5970. ? createComputedGetter(key)
  5971. : createGetterInvoker(userDef.get)
  5972. : noop;
  5973. sharedPropertyDefinition.set = userDef.set || noop;
  5974. }
  5975. if ( true &&
  5976. sharedPropertyDefinition.set === noop) {
  5977. sharedPropertyDefinition.set = function () {
  5978. warn(
  5979. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  5980. this
  5981. );
  5982. };
  5983. }
  5984. Object.defineProperty(target, key, sharedPropertyDefinition);
  5985. }
  5986. function createComputedGetter (key) {
  5987. return function computedGetter () {
  5988. var watcher = this._computedWatchers && this._computedWatchers[key];
  5989. if (watcher) {
  5990. if (watcher.dirty) {
  5991. watcher.evaluate();
  5992. }
  5993. if (Dep.SharedObject.target) {// fixed by xxxxxx
  5994. watcher.depend();
  5995. }
  5996. return watcher.value
  5997. }
  5998. }
  5999. }
  6000. function createGetterInvoker(fn) {
  6001. return function computedGetter () {
  6002. return fn.call(this, this)
  6003. }
  6004. }
  6005. function initMethods (vm, methods) {
  6006. var props = vm.$options.props;
  6007. for (var key in methods) {
  6008. if (true) {
  6009. if (typeof methods[key] !== 'function') {
  6010. warn(
  6011. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  6012. "Did you reference the function correctly?",
  6013. vm
  6014. );
  6015. }
  6016. if (props && hasOwn(props, key)) {
  6017. warn(
  6018. ("Method \"" + key + "\" has already been defined as a prop."),
  6019. vm
  6020. );
  6021. }
  6022. if ((key in vm) && isReserved(key)) {
  6023. warn(
  6024. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  6025. "Avoid defining component methods that start with _ or $."
  6026. );
  6027. }
  6028. }
  6029. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  6030. }
  6031. }
  6032. function initWatch (vm, watch) {
  6033. for (var key in watch) {
  6034. var handler = watch[key];
  6035. if (Array.isArray(handler)) {
  6036. for (var i = 0; i < handler.length; i++) {
  6037. createWatcher(vm, key, handler[i]);
  6038. }
  6039. } else {
  6040. createWatcher(vm, key, handler);
  6041. }
  6042. }
  6043. }
  6044. function createWatcher (
  6045. vm,
  6046. expOrFn,
  6047. handler,
  6048. options
  6049. ) {
  6050. if (isPlainObject(handler)) {
  6051. options = handler;
  6052. handler = handler.handler;
  6053. }
  6054. if (typeof handler === 'string') {
  6055. handler = vm[handler];
  6056. }
  6057. return vm.$watch(expOrFn, handler, options)
  6058. }
  6059. function stateMixin (Vue) {
  6060. // flow somehow has problems with directly declared definition object
  6061. // when using Object.defineProperty, so we have to procedurally build up
  6062. // the object here.
  6063. var dataDef = {};
  6064. dataDef.get = function () { return this._data };
  6065. var propsDef = {};
  6066. propsDef.get = function () { return this._props };
  6067. if (true) {
  6068. dataDef.set = function () {
  6069. warn(
  6070. 'Avoid replacing instance root $data. ' +
  6071. 'Use nested data properties instead.',
  6072. this
  6073. );
  6074. };
  6075. propsDef.set = function () {
  6076. warn("$props is readonly.", this);
  6077. };
  6078. }
  6079. Object.defineProperty(Vue.prototype, '$data', dataDef);
  6080. Object.defineProperty(Vue.prototype, '$props', propsDef);
  6081. Vue.prototype.$set = set;
  6082. Vue.prototype.$delete = del;
  6083. Vue.prototype.$watch = function (
  6084. expOrFn,
  6085. cb,
  6086. options
  6087. ) {
  6088. var vm = this;
  6089. if (isPlainObject(cb)) {
  6090. return createWatcher(vm, expOrFn, cb, options)
  6091. }
  6092. options = options || {};
  6093. options.user = true;
  6094. var watcher = new Watcher(vm, expOrFn, cb, options);
  6095. if (options.immediate) {
  6096. try {
  6097. cb.call(vm, watcher.value);
  6098. } catch (error) {
  6099. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  6100. }
  6101. }
  6102. return function unwatchFn () {
  6103. watcher.teardown();
  6104. }
  6105. };
  6106. }
  6107. /* */
  6108. var uid$3 = 0;
  6109. function initMixin (Vue) {
  6110. Vue.prototype._init = function (options) {
  6111. var vm = this;
  6112. // a uid
  6113. vm._uid = uid$3++;
  6114. var startTag, endTag;
  6115. /* istanbul ignore if */
  6116. if ( true && config.performance && mark) {
  6117. startTag = "vue-perf-start:" + (vm._uid);
  6118. endTag = "vue-perf-end:" + (vm._uid);
  6119. mark(startTag);
  6120. }
  6121. // a flag to avoid this being observed
  6122. vm._isVue = true;
  6123. // merge options
  6124. if (options && options._isComponent) {
  6125. // optimize internal component instantiation
  6126. // since dynamic options merging is pretty slow, and none of the
  6127. // internal component options needs special treatment.
  6128. initInternalComponent(vm, options);
  6129. } else {
  6130. vm.$options = mergeOptions(
  6131. resolveConstructorOptions(vm.constructor),
  6132. options || {},
  6133. vm
  6134. );
  6135. }
  6136. /* istanbul ignore else */
  6137. if (true) {
  6138. initProxy(vm);
  6139. } else {}
  6140. // expose real self
  6141. vm._self = vm;
  6142. initLifecycle(vm);
  6143. initEvents(vm);
  6144. initRender(vm);
  6145. callHook(vm, 'beforeCreate');
  6146. !vm._$fallback && initInjections(vm); // resolve injections before data/props
  6147. initState(vm);
  6148. !vm._$fallback && initProvide(vm); // resolve provide after data/props
  6149. !vm._$fallback && callHook(vm, 'created');
  6150. /* istanbul ignore if */
  6151. if ( true && config.performance && mark) {
  6152. vm._name = formatComponentName(vm, false);
  6153. mark(endTag);
  6154. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  6155. }
  6156. if (vm.$options.el) {
  6157. vm.$mount(vm.$options.el);
  6158. }
  6159. };
  6160. }
  6161. function initInternalComponent (vm, options) {
  6162. var opts = vm.$options = Object.create(vm.constructor.options);
  6163. // doing this because it's faster than dynamic enumeration.
  6164. var parentVnode = options._parentVnode;
  6165. opts.parent = options.parent;
  6166. opts._parentVnode = parentVnode;
  6167. var vnodeComponentOptions = parentVnode.componentOptions;
  6168. opts.propsData = vnodeComponentOptions.propsData;
  6169. opts._parentListeners = vnodeComponentOptions.listeners;
  6170. opts._renderChildren = vnodeComponentOptions.children;
  6171. opts._componentTag = vnodeComponentOptions.tag;
  6172. if (options.render) {
  6173. opts.render = options.render;
  6174. opts.staticRenderFns = options.staticRenderFns;
  6175. }
  6176. }
  6177. function resolveConstructorOptions (Ctor) {
  6178. var options = Ctor.options;
  6179. if (Ctor.super) {
  6180. var superOptions = resolveConstructorOptions(Ctor.super);
  6181. var cachedSuperOptions = Ctor.superOptions;
  6182. if (superOptions !== cachedSuperOptions) {
  6183. // super option changed,
  6184. // need to resolve new options.
  6185. Ctor.superOptions = superOptions;
  6186. // check if there are any late-modified/attached options (#4976)
  6187. var modifiedOptions = resolveModifiedOptions(Ctor);
  6188. // update base extend options
  6189. if (modifiedOptions) {
  6190. extend(Ctor.extendOptions, modifiedOptions);
  6191. }
  6192. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  6193. if (options.name) {
  6194. options.components[options.name] = Ctor;
  6195. }
  6196. }
  6197. }
  6198. return options
  6199. }
  6200. function resolveModifiedOptions (Ctor) {
  6201. var modified;
  6202. var latest = Ctor.options;
  6203. var sealed = Ctor.sealedOptions;
  6204. for (var key in latest) {
  6205. if (latest[key] !== sealed[key]) {
  6206. if (!modified) { modified = {}; }
  6207. modified[key] = latest[key];
  6208. }
  6209. }
  6210. return modified
  6211. }
  6212. function Vue (options) {
  6213. if ( true &&
  6214. !(this instanceof Vue)
  6215. ) {
  6216. warn('Vue is a constructor and should be called with the `new` keyword');
  6217. }
  6218. this._init(options);
  6219. }
  6220. initMixin(Vue);
  6221. stateMixin(Vue);
  6222. eventsMixin(Vue);
  6223. lifecycleMixin(Vue);
  6224. renderMixin(Vue);
  6225. /* */
  6226. function initUse (Vue) {
  6227. Vue.use = function (plugin) {
  6228. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  6229. if (installedPlugins.indexOf(plugin) > -1) {
  6230. return this
  6231. }
  6232. // additional parameters
  6233. var args = toArray(arguments, 1);
  6234. args.unshift(this);
  6235. if (typeof plugin.install === 'function') {
  6236. plugin.install.apply(plugin, args);
  6237. } else if (typeof plugin === 'function') {
  6238. plugin.apply(null, args);
  6239. }
  6240. installedPlugins.push(plugin);
  6241. return this
  6242. };
  6243. }
  6244. /* */
  6245. function initMixin$1 (Vue) {
  6246. Vue.mixin = function (mixin) {
  6247. this.options = mergeOptions(this.options, mixin);
  6248. return this
  6249. };
  6250. }
  6251. /* */
  6252. function initExtend (Vue) {
  6253. /**
  6254. * Each instance constructor, including Vue, has a unique
  6255. * cid. This enables us to create wrapped "child
  6256. * constructors" for prototypal inheritance and cache them.
  6257. */
  6258. Vue.cid = 0;
  6259. var cid = 1;
  6260. /**
  6261. * Class inheritance
  6262. */
  6263. Vue.extend = function (extendOptions) {
  6264. extendOptions = extendOptions || {};
  6265. var Super = this;
  6266. var SuperId = Super.cid;
  6267. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  6268. if (cachedCtors[SuperId]) {
  6269. return cachedCtors[SuperId]
  6270. }
  6271. var name = extendOptions.name || Super.options.name;
  6272. if ( true && name) {
  6273. validateComponentName(name);
  6274. }
  6275. var Sub = function VueComponent (options) {
  6276. this._init(options);
  6277. };
  6278. Sub.prototype = Object.create(Super.prototype);
  6279. Sub.prototype.constructor = Sub;
  6280. Sub.cid = cid++;
  6281. Sub.options = mergeOptions(
  6282. Super.options,
  6283. extendOptions
  6284. );
  6285. Sub['super'] = Super;
  6286. // For props and computed properties, we define the proxy getters on
  6287. // the Vue instances at extension time, on the extended prototype. This
  6288. // avoids Object.defineProperty calls for each instance created.
  6289. if (Sub.options.props) {
  6290. initProps$1(Sub);
  6291. }
  6292. if (Sub.options.computed) {
  6293. initComputed$1(Sub);
  6294. }
  6295. // allow further extension/mixin/plugin usage
  6296. Sub.extend = Super.extend;
  6297. Sub.mixin = Super.mixin;
  6298. Sub.use = Super.use;
  6299. // create asset registers, so extended classes
  6300. // can have their private assets too.
  6301. ASSET_TYPES.forEach(function (type) {
  6302. Sub[type] = Super[type];
  6303. });
  6304. // enable recursive self-lookup
  6305. if (name) {
  6306. Sub.options.components[name] = Sub;
  6307. }
  6308. // keep a reference to the super options at extension time.
  6309. // later at instantiation we can check if Super's options have
  6310. // been updated.
  6311. Sub.superOptions = Super.options;
  6312. Sub.extendOptions = extendOptions;
  6313. Sub.sealedOptions = extend({}, Sub.options);
  6314. // cache constructor
  6315. cachedCtors[SuperId] = Sub;
  6316. return Sub
  6317. };
  6318. }
  6319. function initProps$1 (Comp) {
  6320. var props = Comp.options.props;
  6321. for (var key in props) {
  6322. proxy(Comp.prototype, "_props", key);
  6323. }
  6324. }
  6325. function initComputed$1 (Comp) {
  6326. var computed = Comp.options.computed;
  6327. for (var key in computed) {
  6328. defineComputed(Comp.prototype, key, computed[key]);
  6329. }
  6330. }
  6331. /* */
  6332. function initAssetRegisters (Vue) {
  6333. /**
  6334. * Create asset registration methods.
  6335. */
  6336. ASSET_TYPES.forEach(function (type) {
  6337. Vue[type] = function (
  6338. id,
  6339. definition
  6340. ) {
  6341. if (!definition) {
  6342. return this.options[type + 's'][id]
  6343. } else {
  6344. /* istanbul ignore if */
  6345. if ( true && type === 'component') {
  6346. validateComponentName(id);
  6347. }
  6348. if (type === 'component' && isPlainObject(definition)) {
  6349. definition.name = definition.name || id;
  6350. definition = this.options._base.extend(definition);
  6351. }
  6352. if (type === 'directive' && typeof definition === 'function') {
  6353. definition = { bind: definition, update: definition };
  6354. }
  6355. this.options[type + 's'][id] = definition;
  6356. return definition
  6357. }
  6358. };
  6359. });
  6360. }
  6361. /* */
  6362. function getComponentName (opts) {
  6363. return opts && (opts.Ctor.options.name || opts.tag)
  6364. }
  6365. function matches (pattern, name) {
  6366. if (Array.isArray(pattern)) {
  6367. return pattern.indexOf(name) > -1
  6368. } else if (typeof pattern === 'string') {
  6369. return pattern.split(',').indexOf(name) > -1
  6370. } else if (isRegExp(pattern)) {
  6371. return pattern.test(name)
  6372. }
  6373. /* istanbul ignore next */
  6374. return false
  6375. }
  6376. function pruneCache (keepAliveInstance, filter) {
  6377. var cache = keepAliveInstance.cache;
  6378. var keys = keepAliveInstance.keys;
  6379. var _vnode = keepAliveInstance._vnode;
  6380. for (var key in cache) {
  6381. var cachedNode = cache[key];
  6382. if (cachedNode) {
  6383. var name = getComponentName(cachedNode.componentOptions);
  6384. if (name && !filter(name)) {
  6385. pruneCacheEntry(cache, key, keys, _vnode);
  6386. }
  6387. }
  6388. }
  6389. }
  6390. function pruneCacheEntry (
  6391. cache,
  6392. key,
  6393. keys,
  6394. current
  6395. ) {
  6396. var cached$$1 = cache[key];
  6397. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  6398. cached$$1.componentInstance.$destroy();
  6399. }
  6400. cache[key] = null;
  6401. remove(keys, key);
  6402. }
  6403. var patternTypes = [String, RegExp, Array];
  6404. var KeepAlive = {
  6405. name: 'keep-alive',
  6406. abstract: true,
  6407. props: {
  6408. include: patternTypes,
  6409. exclude: patternTypes,
  6410. max: [String, Number]
  6411. },
  6412. created: function created () {
  6413. this.cache = Object.create(null);
  6414. this.keys = [];
  6415. },
  6416. destroyed: function destroyed () {
  6417. for (var key in this.cache) {
  6418. pruneCacheEntry(this.cache, key, this.keys);
  6419. }
  6420. },
  6421. mounted: function mounted () {
  6422. var this$1 = this;
  6423. this.$watch('include', function (val) {
  6424. pruneCache(this$1, function (name) { return matches(val, name); });
  6425. });
  6426. this.$watch('exclude', function (val) {
  6427. pruneCache(this$1, function (name) { return !matches(val, name); });
  6428. });
  6429. },
  6430. render: function render () {
  6431. var slot = this.$slots.default;
  6432. var vnode = getFirstComponentChild(slot);
  6433. var componentOptions = vnode && vnode.componentOptions;
  6434. if (componentOptions) {
  6435. // check pattern
  6436. var name = getComponentName(componentOptions);
  6437. var ref = this;
  6438. var include = ref.include;
  6439. var exclude = ref.exclude;
  6440. if (
  6441. // not included
  6442. (include && (!name || !matches(include, name))) ||
  6443. // excluded
  6444. (exclude && name && matches(exclude, name))
  6445. ) {
  6446. return vnode
  6447. }
  6448. var ref$1 = this;
  6449. var cache = ref$1.cache;
  6450. var keys = ref$1.keys;
  6451. var key = vnode.key == null
  6452. // same constructor may get registered as different local components
  6453. // so cid alone is not enough (#3269)
  6454. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  6455. : vnode.key;
  6456. if (cache[key]) {
  6457. vnode.componentInstance = cache[key].componentInstance;
  6458. // make current key freshest
  6459. remove(keys, key);
  6460. keys.push(key);
  6461. } else {
  6462. cache[key] = vnode;
  6463. keys.push(key);
  6464. // prune oldest entry
  6465. if (this.max && keys.length > parseInt(this.max)) {
  6466. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  6467. }
  6468. }
  6469. vnode.data.keepAlive = true;
  6470. }
  6471. return vnode || (slot && slot[0])
  6472. }
  6473. };
  6474. var builtInComponents = {
  6475. KeepAlive: KeepAlive
  6476. };
  6477. /* */
  6478. function initGlobalAPI (Vue) {
  6479. // config
  6480. var configDef = {};
  6481. configDef.get = function () { return config; };
  6482. if (true) {
  6483. configDef.set = function () {
  6484. warn(
  6485. 'Do not replace the Vue.config object, set individual fields instead.'
  6486. );
  6487. };
  6488. }
  6489. Object.defineProperty(Vue, 'config', configDef);
  6490. // exposed util methods.
  6491. // NOTE: these are not considered part of the public API - avoid relying on
  6492. // them unless you are aware of the risk.
  6493. Vue.util = {
  6494. warn: warn,
  6495. extend: extend,
  6496. mergeOptions: mergeOptions,
  6497. defineReactive: defineReactive$$1
  6498. };
  6499. Vue.set = set;
  6500. Vue.delete = del;
  6501. Vue.nextTick = nextTick;
  6502. // 2.6 explicit observable API
  6503. Vue.observable = function (obj) {
  6504. observe(obj);
  6505. return obj
  6506. };
  6507. Vue.options = Object.create(null);
  6508. ASSET_TYPES.forEach(function (type) {
  6509. Vue.options[type + 's'] = Object.create(null);
  6510. });
  6511. // this is used to identify the "base" constructor to extend all plain-object
  6512. // components with in Weex's multi-instance scenarios.
  6513. Vue.options._base = Vue;
  6514. extend(Vue.options.components, builtInComponents);
  6515. initUse(Vue);
  6516. initMixin$1(Vue);
  6517. initExtend(Vue);
  6518. initAssetRegisters(Vue);
  6519. }
  6520. initGlobalAPI(Vue);
  6521. Object.defineProperty(Vue.prototype, '$isServer', {
  6522. get: isServerRendering
  6523. });
  6524. Object.defineProperty(Vue.prototype, '$ssrContext', {
  6525. get: function get () {
  6526. /* istanbul ignore next */
  6527. return this.$vnode && this.$vnode.ssrContext
  6528. }
  6529. });
  6530. // expose FunctionalRenderContext for ssr runtime helper installation
  6531. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  6532. value: FunctionalRenderContext
  6533. });
  6534. Vue.version = '2.6.11';
  6535. /**
  6536. * https://raw.githubusercontent.com/Tencent/westore/master/packages/westore/utils/diff.js
  6537. */
  6538. var ARRAYTYPE = '[object Array]';
  6539. var OBJECTTYPE = '[object Object]';
  6540. // const FUNCTIONTYPE = '[object Function]'
  6541. function diff(current, pre) {
  6542. var result = {};
  6543. syncKeys(current, pre);
  6544. _diff(current, pre, '', result);
  6545. return result
  6546. }
  6547. function syncKeys(current, pre) {
  6548. if (current === pre) { return }
  6549. var rootCurrentType = type(current);
  6550. var rootPreType = type(pre);
  6551. if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
  6552. if(Object.keys(current).length >= Object.keys(pre).length){
  6553. for (var key in pre) {
  6554. var currentValue = current[key];
  6555. if (currentValue === undefined) {
  6556. current[key] = null;
  6557. } else {
  6558. syncKeys(currentValue, pre[key]);
  6559. }
  6560. }
  6561. }
  6562. } else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
  6563. if (current.length >= pre.length) {
  6564. pre.forEach(function (item, index) {
  6565. syncKeys(current[index], item);
  6566. });
  6567. }
  6568. }
  6569. }
  6570. function _diff(current, pre, path, result) {
  6571. if (current === pre) { return }
  6572. var rootCurrentType = type(current);
  6573. var rootPreType = type(pre);
  6574. if (rootCurrentType == OBJECTTYPE) {
  6575. if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
  6576. setResult(result, path, current);
  6577. } else {
  6578. var loop = function ( key ) {
  6579. var currentValue = current[key];
  6580. var preValue = pre[key];
  6581. var currentType = type(currentValue);
  6582. var preType = type(preValue);
  6583. if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
  6584. // NOTE 此处将 != 修改为 !==。涉及地方太多恐怕测试不到,如果出现数据对比问题,将其修改回来。
  6585. if (currentValue !== pre[key]) {
  6586. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  6587. }
  6588. } else if (currentType == ARRAYTYPE) {
  6589. if (preType != ARRAYTYPE) {
  6590. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  6591. } else {
  6592. if (currentValue.length < preValue.length) {
  6593. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  6594. } else {
  6595. currentValue.forEach(function (item, index) {
  6596. _diff(item, preValue[index], (path == '' ? '' : path + ".") + key + '[' + index + ']', result);
  6597. });
  6598. }
  6599. }
  6600. } else if (currentType == OBJECTTYPE) {
  6601. if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
  6602. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  6603. } else {
  6604. for (var subKey in currentValue) {
  6605. _diff(currentValue[subKey], preValue[subKey], (path == '' ? '' : path + ".") + key + '.' + subKey, result);
  6606. }
  6607. }
  6608. }
  6609. };
  6610. for (var key in current) loop( key );
  6611. }
  6612. } else if (rootCurrentType == ARRAYTYPE) {
  6613. if (rootPreType != ARRAYTYPE) {
  6614. setResult(result, path, current);
  6615. } else {
  6616. if (current.length < pre.length) {
  6617. setResult(result, path, current);
  6618. } else {
  6619. current.forEach(function (item, index) {
  6620. _diff(item, pre[index], path + '[' + index + ']', result);
  6621. });
  6622. }
  6623. }
  6624. } else {
  6625. setResult(result, path, current);
  6626. }
  6627. }
  6628. function setResult(result, k, v) {
  6629. // if (type(v) != FUNCTIONTYPE) {
  6630. result[k] = v;
  6631. // }
  6632. }
  6633. function type(obj) {
  6634. return Object.prototype.toString.call(obj)
  6635. }
  6636. /* */
  6637. function flushCallbacks$1(vm) {
  6638. if (vm.__next_tick_callbacks && vm.__next_tick_callbacks.length) {
  6639. if (Object({"VUE_APP_NAME":"qc-luckyDraw","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  6640. var mpInstance = vm.$scope;
  6641. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  6642. ']:flushCallbacks[' + vm.__next_tick_callbacks.length + ']');
  6643. }
  6644. var copies = vm.__next_tick_callbacks.slice(0);
  6645. vm.__next_tick_callbacks.length = 0;
  6646. for (var i = 0; i < copies.length; i++) {
  6647. copies[i]();
  6648. }
  6649. }
  6650. }
  6651. function hasRenderWatcher(vm) {
  6652. return queue.find(function (watcher) { return vm._watcher === watcher; })
  6653. }
  6654. function nextTick$1(vm, cb) {
  6655. //1.nextTick 之前 已 setData 且 setData 还未回调完成
  6656. //2.nextTick 之前存在 render watcher
  6657. if (!vm.__next_tick_pending && !hasRenderWatcher(vm)) {
  6658. if(Object({"VUE_APP_NAME":"qc-luckyDraw","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG){
  6659. var mpInstance = vm.$scope;
  6660. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  6661. ']:nextVueTick');
  6662. }
  6663. return nextTick(cb, vm)
  6664. }else{
  6665. if(Object({"VUE_APP_NAME":"qc-luckyDraw","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG){
  6666. var mpInstance$1 = vm.$scope;
  6667. console.log('[' + (+new Date) + '][' + (mpInstance$1.is || mpInstance$1.route) + '][' + vm._uid +
  6668. ']:nextMPTick');
  6669. }
  6670. }
  6671. var _resolve;
  6672. if (!vm.__next_tick_callbacks) {
  6673. vm.__next_tick_callbacks = [];
  6674. }
  6675. vm.__next_tick_callbacks.push(function () {
  6676. if (cb) {
  6677. try {
  6678. cb.call(vm);
  6679. } catch (e) {
  6680. handleError(e, vm, 'nextTick');
  6681. }
  6682. } else if (_resolve) {
  6683. _resolve(vm);
  6684. }
  6685. });
  6686. // $flow-disable-line
  6687. if (!cb && typeof Promise !== 'undefined') {
  6688. return new Promise(function (resolve) {
  6689. _resolve = resolve;
  6690. })
  6691. }
  6692. }
  6693. /* */
  6694. function cloneWithData(vm) {
  6695. // 确保当前 vm 所有数据被同步
  6696. var ret = Object.create(null);
  6697. var dataKeys = [].concat(
  6698. Object.keys(vm._data || {}),
  6699. Object.keys(vm._computedWatchers || {}));
  6700. dataKeys.reduce(function(ret, key) {
  6701. ret[key] = vm[key];
  6702. return ret
  6703. }, ret);
  6704. // vue-composition-api
  6705. var compositionApiState = vm.__composition_api_state__ || vm.__secret_vfa_state__;
  6706. var rawBindings = compositionApiState && compositionApiState.rawBindings;
  6707. if (rawBindings) {
  6708. Object.keys(rawBindings).forEach(function (key) {
  6709. ret[key] = vm[key];
  6710. });
  6711. }
  6712. //TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
  6713. Object.assign(ret, vm.$mp.data || {});
  6714. if (
  6715. Array.isArray(vm.$options.behaviors) &&
  6716. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  6717. ) { //form-field
  6718. ret['name'] = vm.name;
  6719. ret['value'] = vm.value;
  6720. }
  6721. return JSON.parse(JSON.stringify(ret))
  6722. }
  6723. var patch = function(oldVnode, vnode) {
  6724. var this$1 = this;
  6725. if (vnode === null) { //destroy
  6726. return
  6727. }
  6728. if (this.mpType === 'page' || this.mpType === 'component') {
  6729. var mpInstance = this.$scope;
  6730. var data = Object.create(null);
  6731. try {
  6732. data = cloneWithData(this);
  6733. } catch (err) {
  6734. console.error(err);
  6735. }
  6736. data.__webviewId__ = mpInstance.data.__webviewId__;
  6737. var mpData = Object.create(null);
  6738. Object.keys(data).forEach(function (key) { //仅同步 data 中有的数据
  6739. mpData[key] = mpInstance.data[key];
  6740. });
  6741. var diffData = this.$shouldDiffData === false ? data : diff(data, mpData);
  6742. if (Object.keys(diffData).length) {
  6743. if (Object({"VUE_APP_NAME":"qc-luckyDraw","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  6744. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + this._uid +
  6745. ']差量更新',
  6746. JSON.stringify(diffData));
  6747. }
  6748. this.__next_tick_pending = true;
  6749. mpInstance.setData(diffData, function () {
  6750. this$1.__next_tick_pending = false;
  6751. flushCallbacks$1(this$1);
  6752. });
  6753. } else {
  6754. flushCallbacks$1(this);
  6755. }
  6756. }
  6757. };
  6758. /* */
  6759. function createEmptyRender() {
  6760. }
  6761. function mountComponent$1(
  6762. vm,
  6763. el,
  6764. hydrating
  6765. ) {
  6766. if (!vm.mpType) {//main.js 中的 new Vue
  6767. return vm
  6768. }
  6769. if (vm.mpType === 'app') {
  6770. vm.$options.render = createEmptyRender;
  6771. }
  6772. if (!vm.$options.render) {
  6773. vm.$options.render = createEmptyRender;
  6774. if (true) {
  6775. /* istanbul ignore if */
  6776. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  6777. vm.$options.el || el) {
  6778. warn(
  6779. 'You are using the runtime-only build of Vue where the template ' +
  6780. 'compiler is not available. Either pre-compile the templates into ' +
  6781. 'render functions, or use the compiler-included build.',
  6782. vm
  6783. );
  6784. } else {
  6785. warn(
  6786. 'Failed to mount component: template or render function not defined.',
  6787. vm
  6788. );
  6789. }
  6790. }
  6791. }
  6792. !vm._$fallback && callHook(vm, 'beforeMount');
  6793. var updateComponent = function () {
  6794. vm._update(vm._render(), hydrating);
  6795. };
  6796. // we set this to vm._watcher inside the watcher's constructor
  6797. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  6798. // component's mounted hook), which relies on vm._watcher being already defined
  6799. new Watcher(vm, updateComponent, noop, {
  6800. before: function before() {
  6801. if (vm._isMounted && !vm._isDestroyed) {
  6802. callHook(vm, 'beforeUpdate');
  6803. }
  6804. }
  6805. }, true /* isRenderWatcher */);
  6806. hydrating = false;
  6807. return vm
  6808. }
  6809. /* */
  6810. function renderClass (
  6811. staticClass,
  6812. dynamicClass
  6813. ) {
  6814. if (isDef(staticClass) || isDef(dynamicClass)) {
  6815. return concat(staticClass, stringifyClass(dynamicClass))
  6816. }
  6817. /* istanbul ignore next */
  6818. return ''
  6819. }
  6820. function concat (a, b) {
  6821. return a ? b ? (a + ' ' + b) : a : (b || '')
  6822. }
  6823. function stringifyClass (value) {
  6824. if (Array.isArray(value)) {
  6825. return stringifyArray(value)
  6826. }
  6827. if (isObject(value)) {
  6828. return stringifyObject(value)
  6829. }
  6830. if (typeof value === 'string') {
  6831. return value
  6832. }
  6833. /* istanbul ignore next */
  6834. return ''
  6835. }
  6836. function stringifyArray (value) {
  6837. var res = '';
  6838. var stringified;
  6839. for (var i = 0, l = value.length; i < l; i++) {
  6840. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  6841. if (res) { res += ' '; }
  6842. res += stringified;
  6843. }
  6844. }
  6845. return res
  6846. }
  6847. function stringifyObject (value) {
  6848. var res = '';
  6849. for (var key in value) {
  6850. if (value[key]) {
  6851. if (res) { res += ' '; }
  6852. res += key;
  6853. }
  6854. }
  6855. return res
  6856. }
  6857. /* */
  6858. var parseStyleText = cached(function (cssText) {
  6859. var res = {};
  6860. var listDelimiter = /;(?![^(]*\))/g;
  6861. var propertyDelimiter = /:(.+)/;
  6862. cssText.split(listDelimiter).forEach(function (item) {
  6863. if (item) {
  6864. var tmp = item.split(propertyDelimiter);
  6865. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  6866. }
  6867. });
  6868. return res
  6869. });
  6870. // normalize possible array / string values into Object
  6871. function normalizeStyleBinding (bindingStyle) {
  6872. if (Array.isArray(bindingStyle)) {
  6873. return toObject(bindingStyle)
  6874. }
  6875. if (typeof bindingStyle === 'string') {
  6876. return parseStyleText(bindingStyle)
  6877. }
  6878. return bindingStyle
  6879. }
  6880. /* */
  6881. var MP_METHODS = ['createSelectorQuery', 'createIntersectionObserver', 'selectAllComponents', 'selectComponent'];
  6882. function getTarget(obj, path) {
  6883. var parts = path.split('.');
  6884. var key = parts[0];
  6885. if (key.indexOf('__$n') === 0) { //number index
  6886. key = parseInt(key.replace('__$n', ''));
  6887. }
  6888. if (parts.length === 1) {
  6889. return obj[key]
  6890. }
  6891. return getTarget(obj[key], parts.slice(1).join('.'))
  6892. }
  6893. function internalMixin(Vue) {
  6894. Vue.config.errorHandler = function(err, vm, info) {
  6895. Vue.util.warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  6896. console.error(err);
  6897. /* eslint-disable no-undef */
  6898. var app = typeof getApp === 'function' && getApp();
  6899. if (app && app.onError) {
  6900. app.onError(err);
  6901. }
  6902. };
  6903. var oldEmit = Vue.prototype.$emit;
  6904. Vue.prototype.$emit = function(event) {
  6905. if (this.$scope && event) {
  6906. this.$scope['triggerEvent'](event, {
  6907. __args__: toArray(arguments, 1)
  6908. });
  6909. }
  6910. return oldEmit.apply(this, arguments)
  6911. };
  6912. Vue.prototype.$nextTick = function(fn) {
  6913. return nextTick$1(this, fn)
  6914. };
  6915. MP_METHODS.forEach(function (method) {
  6916. Vue.prototype[method] = function(args) {
  6917. if (this.$scope && this.$scope[method]) {
  6918. return this.$scope[method](args)
  6919. }
  6920. // mp-alipay
  6921. if (typeof my === 'undefined') {
  6922. return
  6923. }
  6924. if (method === 'createSelectorQuery') {
  6925. /* eslint-disable no-undef */
  6926. return my.createSelectorQuery(args)
  6927. } else if (method === 'createIntersectionObserver') {
  6928. /* eslint-disable no-undef */
  6929. return my.createIntersectionObserver(args)
  6930. }
  6931. // TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
  6932. };
  6933. });
  6934. Vue.prototype.__init_provide = initProvide;
  6935. Vue.prototype.__init_injections = initInjections;
  6936. Vue.prototype.__call_hook = function(hook, args) {
  6937. var vm = this;
  6938. // #7573 disable dep collection when invoking lifecycle hooks
  6939. pushTarget();
  6940. var handlers = vm.$options[hook];
  6941. var info = hook + " hook";
  6942. var ret;
  6943. if (handlers) {
  6944. for (var i = 0, j = handlers.length; i < j; i++) {
  6945. ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
  6946. }
  6947. }
  6948. if (vm._hasHookEvent) {
  6949. vm.$emit('hook:' + hook, args);
  6950. }
  6951. popTarget();
  6952. return ret
  6953. };
  6954. Vue.prototype.__set_model = function(target, key, value, modifiers) {
  6955. if (Array.isArray(modifiers)) {
  6956. if (modifiers.indexOf('trim') !== -1) {
  6957. value = value.trim();
  6958. }
  6959. if (modifiers.indexOf('number') !== -1) {
  6960. value = this._n(value);
  6961. }
  6962. }
  6963. if (!target) {
  6964. target = this;
  6965. }
  6966. target[key] = value;
  6967. };
  6968. Vue.prototype.__set_sync = function(target, key, value) {
  6969. if (!target) {
  6970. target = this;
  6971. }
  6972. target[key] = value;
  6973. };
  6974. Vue.prototype.__get_orig = function(item) {
  6975. if (isPlainObject(item)) {
  6976. return item['$orig'] || item
  6977. }
  6978. return item
  6979. };
  6980. Vue.prototype.__get_value = function(dataPath, target) {
  6981. return getTarget(target || this, dataPath)
  6982. };
  6983. Vue.prototype.__get_class = function(dynamicClass, staticClass) {
  6984. return renderClass(staticClass, dynamicClass)
  6985. };
  6986. Vue.prototype.__get_style = function(dynamicStyle, staticStyle) {
  6987. if (!dynamicStyle && !staticStyle) {
  6988. return ''
  6989. }
  6990. var dynamicStyleObj = normalizeStyleBinding(dynamicStyle);
  6991. var styleObj = staticStyle ? extend(staticStyle, dynamicStyleObj) : dynamicStyleObj;
  6992. return Object.keys(styleObj).map(function (name) { return ((hyphenate(name)) + ":" + (styleObj[name])); }).join(';')
  6993. };
  6994. Vue.prototype.__map = function(val, iteratee) {
  6995. //TODO 暂不考虑 string
  6996. var ret, i, l, keys, key;
  6997. if (Array.isArray(val)) {
  6998. ret = new Array(val.length);
  6999. for (i = 0, l = val.length; i < l; i++) {
  7000. ret[i] = iteratee(val[i], i);
  7001. }
  7002. return ret
  7003. } else if (isObject(val)) {
  7004. keys = Object.keys(val);
  7005. ret = Object.create(null);
  7006. for (i = 0, l = keys.length; i < l; i++) {
  7007. key = keys[i];
  7008. ret[key] = iteratee(val[key], key, i);
  7009. }
  7010. return ret
  7011. } else if (typeof val === 'number') {
  7012. ret = new Array(val);
  7013. for (i = 0, l = val; i < l; i++) {
  7014. // 第一个参数暂时仍和小程序一致
  7015. ret[i] = iteratee(i, i);
  7016. }
  7017. return ret
  7018. }
  7019. return []
  7020. };
  7021. }
  7022. /* */
  7023. var LIFECYCLE_HOOKS$1 = [
  7024. //App
  7025. 'onLaunch',
  7026. 'onShow',
  7027. 'onHide',
  7028. 'onUniNViewMessage',
  7029. 'onPageNotFound',
  7030. 'onThemeChange',
  7031. 'onError',
  7032. 'onUnhandledRejection',
  7033. //Page
  7034. 'onInit',
  7035. 'onLoad',
  7036. // 'onShow',
  7037. 'onReady',
  7038. // 'onHide',
  7039. 'onUnload',
  7040. 'onPullDownRefresh',
  7041. 'onReachBottom',
  7042. 'onTabItemTap',
  7043. 'onAddToFavorites',
  7044. 'onShareTimeline',
  7045. 'onShareAppMessage',
  7046. 'onResize',
  7047. 'onPageScroll',
  7048. 'onNavigationBarButtonTap',
  7049. 'onBackPress',
  7050. 'onNavigationBarSearchInputChanged',
  7051. 'onNavigationBarSearchInputConfirmed',
  7052. 'onNavigationBarSearchInputClicked',
  7053. //Component
  7054. // 'onReady', // 兼容旧版本,应该移除该事件
  7055. 'onPageShow',
  7056. 'onPageHide',
  7057. 'onPageResize'
  7058. ];
  7059. function lifecycleMixin$1(Vue) {
  7060. //fixed vue-class-component
  7061. var oldExtend = Vue.extend;
  7062. Vue.extend = function(extendOptions) {
  7063. extendOptions = extendOptions || {};
  7064. var methods = extendOptions.methods;
  7065. if (methods) {
  7066. Object.keys(methods).forEach(function (methodName) {
  7067. if (LIFECYCLE_HOOKS$1.indexOf(methodName)!==-1) {
  7068. extendOptions[methodName] = methods[methodName];
  7069. delete methods[methodName];
  7070. }
  7071. });
  7072. }
  7073. return oldExtend.call(this, extendOptions)
  7074. };
  7075. var strategies = Vue.config.optionMergeStrategies;
  7076. var mergeHook = strategies.created;
  7077. LIFECYCLE_HOOKS$1.forEach(function (hook) {
  7078. strategies[hook] = mergeHook;
  7079. });
  7080. Vue.prototype.__lifecycle_hooks__ = LIFECYCLE_HOOKS$1;
  7081. }
  7082. /* */
  7083. // install platform patch function
  7084. Vue.prototype.__patch__ = patch;
  7085. // public mount method
  7086. Vue.prototype.$mount = function(
  7087. el ,
  7088. hydrating
  7089. ) {
  7090. return mountComponent$1(this, el, hydrating)
  7091. };
  7092. lifecycleMixin$1(Vue);
  7093. internalMixin(Vue);
  7094. /* */
  7095. /* harmony default export */ __webpack_exports__["default"] = (Vue);
  7096. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ 3)))
  7097. /***/ }),
  7098. /* 3 */
  7099. /*!***********************************!*\
  7100. !*** (webpack)/buildin/global.js ***!
  7101. \***********************************/
  7102. /*! no static exports found */
  7103. /***/ (function(module, exports) {
  7104. var g;
  7105. // This works in non-strict mode
  7106. g = (function() {
  7107. return this;
  7108. })();
  7109. try {
  7110. // This works if eval is allowed (see CSP)
  7111. g = g || new Function("return this")();
  7112. } catch (e) {
  7113. // This works if the window reference is available
  7114. if (typeof window === "object") g = window;
  7115. }
  7116. // g can still be undefined, but nothing to do about it...
  7117. // We return undefined, instead of nothing here, so it's
  7118. // easier to handle this case. if(!global) { ...}
  7119. module.exports = g;
  7120. /***/ }),
  7121. /* 4 */
  7122. /*!*************************************************************************!*\
  7123. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/pages.json ***!
  7124. \*************************************************************************/
  7125. /*! no static exports found */
  7126. /***/ (function(module, exports) {
  7127. /***/ }),
  7128. /* 5 */,
  7129. /* 6 */,
  7130. /* 7 */,
  7131. /* 8 */,
  7132. /* 9 */,
  7133. /* 10 */
  7134. /*!**********************************************************************************************************!*\
  7135. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js ***!
  7136. \**********************************************************************************************************/
  7137. /*! exports provided: default */
  7138. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  7139. "use strict";
  7140. __webpack_require__.r(__webpack_exports__);
  7141. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  7142. /* globals __VUE_SSR_CONTEXT__ */
  7143. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  7144. // This module is a runtime utility for cleaner component module output and will
  7145. // be included in the final webpack user bundle.
  7146. function normalizeComponent (
  7147. scriptExports,
  7148. render,
  7149. staticRenderFns,
  7150. functionalTemplate,
  7151. injectStyles,
  7152. scopeId,
  7153. moduleIdentifier, /* server only */
  7154. shadowMode, /* vue-cli only */
  7155. components, // fixed by xxxxxx auto components
  7156. renderjs // fixed by xxxxxx renderjs
  7157. ) {
  7158. // Vue.extend constructor export interop
  7159. var options = typeof scriptExports === 'function'
  7160. ? scriptExports.options
  7161. : scriptExports
  7162. // fixed by xxxxxx auto components
  7163. if (components) {
  7164. if (!options.components) {
  7165. options.components = {}
  7166. }
  7167. var hasOwn = Object.prototype.hasOwnProperty
  7168. for (var name in components) {
  7169. if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {
  7170. options.components[name] = components[name]
  7171. }
  7172. }
  7173. }
  7174. // fixed by xxxxxx renderjs
  7175. if (renderjs) {
  7176. (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {
  7177. this[renderjs.__module] = this
  7178. });
  7179. (options.mixins || (options.mixins = [])).push(renderjs)
  7180. }
  7181. // render functions
  7182. if (render) {
  7183. options.render = render
  7184. options.staticRenderFns = staticRenderFns
  7185. options._compiled = true
  7186. }
  7187. // functional template
  7188. if (functionalTemplate) {
  7189. options.functional = true
  7190. }
  7191. // scopedId
  7192. if (scopeId) {
  7193. options._scopeId = 'data-v-' + scopeId
  7194. }
  7195. var hook
  7196. if (moduleIdentifier) { // server build
  7197. hook = function (context) {
  7198. // 2.3 injection
  7199. context =
  7200. context || // cached call
  7201. (this.$vnode && this.$vnode.ssrContext) || // stateful
  7202. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  7203. // 2.2 with runInNewContext: true
  7204. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  7205. context = __VUE_SSR_CONTEXT__
  7206. }
  7207. // inject component styles
  7208. if (injectStyles) {
  7209. injectStyles.call(this, context)
  7210. }
  7211. // register component module identifier for async chunk inferrence
  7212. if (context && context._registeredComponents) {
  7213. context._registeredComponents.add(moduleIdentifier)
  7214. }
  7215. }
  7216. // used by ssr in case component is cached and beforeCreate
  7217. // never gets called
  7218. options._ssrRegister = hook
  7219. } else if (injectStyles) {
  7220. hook = shadowMode
  7221. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  7222. : injectStyles
  7223. }
  7224. if (hook) {
  7225. if (options.functional) {
  7226. // for template-only hot-reload because in that case the render fn doesn't
  7227. // go through the normalizer
  7228. options._injectStyles = hook
  7229. // register for functioal component in vue file
  7230. var originalRender = options.render
  7231. options.render = function renderWithStyleInjection (h, context) {
  7232. hook.call(context)
  7233. return originalRender(h, context)
  7234. }
  7235. } else {
  7236. // inject component registration as beforeCreate hook
  7237. var existing = options.beforeCreate
  7238. options.beforeCreate = existing
  7239. ? [].concat(existing, hook)
  7240. : [hook]
  7241. }
  7242. }
  7243. return {
  7244. exports: scriptExports,
  7245. options: options
  7246. }
  7247. }
  7248. /***/ }),
  7249. /* 11 */
  7250. /*!********************************************************************************!*\
  7251. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/index.js ***!
  7252. \********************************************************************************/
  7253. /*! no static exports found */
  7254. /***/ (function(module, exports, __webpack_require__) {
  7255. "use strict";
  7256. /* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;
  7257. var _mixin = _interopRequireDefault(__webpack_require__(/*! ./libs/mixin/mixin.js */ 12));
  7258. var _request = _interopRequireDefault(__webpack_require__(/*! ./libs/request */ 13));
  7259. var _queryParams = _interopRequireDefault(__webpack_require__(/*! ./libs/function/queryParams.js */ 17));
  7260. var _route = _interopRequireDefault(__webpack_require__(/*! ./libs/function/route.js */ 18));
  7261. var _timeFormat = _interopRequireDefault(__webpack_require__(/*! ./libs/function/timeFormat.js */ 22));
  7262. var _timeFrom = _interopRequireDefault(__webpack_require__(/*! ./libs/function/timeFrom.js */ 23));
  7263. var _colorGradient = _interopRequireDefault(__webpack_require__(/*! ./libs/function/colorGradient.js */ 24));
  7264. var _guid = _interopRequireDefault(__webpack_require__(/*! ./libs/function/guid.js */ 25));
  7265. var _color = _interopRequireDefault(__webpack_require__(/*! ./libs/function/color.js */ 26));
  7266. var _type2icon = _interopRequireDefault(__webpack_require__(/*! ./libs/function/type2icon.js */ 27));
  7267. var _randomArray = _interopRequireDefault(__webpack_require__(/*! ./libs/function/randomArray.js */ 28));
  7268. var _deepClone = _interopRequireDefault(__webpack_require__(/*! ./libs/function/deepClone.js */ 15));
  7269. var _deepMerge = _interopRequireDefault(__webpack_require__(/*! ./libs/function/deepMerge.js */ 14));
  7270. var _addUnit = _interopRequireDefault(__webpack_require__(/*! ./libs/function/addUnit.js */ 29));
  7271. var _test = _interopRequireDefault(__webpack_require__(/*! ./libs/function/test.js */ 16));
  7272. var _random = _interopRequireDefault(__webpack_require__(/*! ./libs/function/random.js */ 30));
  7273. var _trim = _interopRequireDefault(__webpack_require__(/*! ./libs/function/trim.js */ 31));
  7274. var _toast = _interopRequireDefault(__webpack_require__(/*! ./libs/function/toast.js */ 32));
  7275. var _getParent = _interopRequireDefault(__webpack_require__(/*! ./libs/function/getParent.js */ 33));
  7276. var _$parent = _interopRequireDefault(__webpack_require__(/*! ./libs/function/$parent.js */ 34));
  7277. var _sys = __webpack_require__(/*! ./libs/function/sys.js */ 35);
  7278. var _debounce = _interopRequireDefault(__webpack_require__(/*! ./libs/function/debounce.js */ 36));
  7279. var _throttle = _interopRequireDefault(__webpack_require__(/*! ./libs/function/throttle.js */ 37));
  7280. var _config = _interopRequireDefault(__webpack_require__(/*! ./libs/config/config.js */ 38));
  7281. var _zIndex = _interopRequireDefault(__webpack_require__(/*! ./libs/config/zIndex.js */ 39));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} // 引入全局mixin
  7282. // 引入关于是否mixin集成小程序分享的配置
  7283. // import wxshare from './libs/mixin/mpShare.js'
  7284. // 全局挂载引入http相关请求拦截插件
  7285. function wranning(str) {// 开发环境进行信息输出,主要是一些报错信息
  7286. // 这个环境的来由是在程序编写时候,点击hx编辑器运行调试代码的时候,详见:
  7287. // https://uniapp.dcloud.io/frame?id=%e5%bc%80%e5%8f%91%e7%8e%af%e5%a2%83%e5%92%8c%e7%94%9f%e4%ba%a7%e7%8e%af%e5%a2%83
  7288. if (true) {console.warn(str);}} // 尝试判断在根目录的/store中是否有$u.mixin.js,此文件uView默认为需要挂在到全局的vuex的state变量
  7289. // HX2.6.11版本,放到try中,控制台依然会警告,暂时不用此方式,
  7290. // let vuexStore = {};
  7291. // try {
  7292. // vuexStore = require("@/store/$u.mixin.js");
  7293. // } catch (e) {
  7294. // //TODO handle the exception
  7295. // }
  7296. // post类型对象参数转为get类型url参数
  7297. var $u = { queryParams: _queryParams.default, route: _route.default, timeFormat: _timeFormat.default, date: _timeFormat.default, // 另名date
  7298. timeFrom: _timeFrom.default, colorGradient: _colorGradient.default.colorGradient, colorToRgba: _colorGradient.default.colorToRgba, guid: _guid.default, color: _color.default, sys: _sys.sys, os: _sys.os, type2icon: _type2icon.default, randomArray: _randomArray.default, wranning: wranning, get: _request.default.get,
  7299. post: _request.default.post,
  7300. put: _request.default.put,
  7301. 'delete': _request.default.delete,
  7302. hexToRgb: _colorGradient.default.hexToRgb,
  7303. rgbToHex: _colorGradient.default.rgbToHex,
  7304. test: _test.default,
  7305. random: _random.default,
  7306. deepClone: _deepClone.default,
  7307. deepMerge: _deepMerge.default,
  7308. getParent: _getParent.default,
  7309. $parent: _$parent.default,
  7310. addUnit: _addUnit.default,
  7311. trim: _trim.default,
  7312. type: ['primary', 'success', 'error', 'warning', 'info'],
  7313. http: _request.default,
  7314. toast: _toast.default,
  7315. config: _config.default, // uView配置信息相关,比如版本号
  7316. zIndex: _zIndex.default,
  7317. debounce: _debounce.default,
  7318. throttle: _throttle.default };
  7319. // $u挂载到uni对象上
  7320. uni.$u = $u;
  7321. var install = function install(Vue) {
  7322. Vue.mixin(_mixin.default);
  7323. if (Vue.prototype.openShare) {
  7324. Vue.mixin(mpShare);
  7325. }
  7326. // Vue.mixin(vuexStore);
  7327. // 时间格式化,同时两个名称,date和timeFormat
  7328. Vue.filter('timeFormat', function (timestamp, format) {
  7329. return (0, _timeFormat.default)(timestamp, format);
  7330. });
  7331. Vue.filter('date', function (timestamp, format) {
  7332. return (0, _timeFormat.default)(timestamp, format);
  7333. });
  7334. // 将多久以前的方法,注入到全局过滤器
  7335. Vue.filter('timeFrom', function (timestamp, format) {
  7336. return (0, _timeFrom.default)(timestamp, format);
  7337. });
  7338. Vue.prototype.$u = $u;
  7339. };var _default =
  7340. {
  7341. install: install };exports.default = _default;
  7342. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  7343. /***/ }),
  7344. /* 12 */
  7345. /*!*******************************************************************************************!*\
  7346. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/libs/mixin/mixin.js ***!
  7347. \*******************************************************************************************/
  7348. /*! no static exports found */
  7349. /***/ (function(module, exports, __webpack_require__) {
  7350. /* WEBPACK VAR INJECTION */(function(uni) {module.exports = {
  7351. data: function data() {
  7352. return {};
  7353. },
  7354. onLoad: function onLoad() {
  7355. // getRect挂载到$u上,因为这方法需要使用in(this),所以无法把它独立成一个单独的文件导出
  7356. this.$u.getRect = this.$uGetRect;
  7357. },
  7358. methods: {
  7359. // 查询节点信息
  7360. // 目前此方法在支付宝小程序中无法获取组件跟接点的尺寸,为支付宝的bug(2020-07-21)
  7361. // 解决办法为在组件根部再套一个没有任何作用的view元素
  7362. $uGetRect: function $uGetRect(selector, all) {var _this = this;
  7363. return new Promise(function (resolve) {
  7364. uni.createSelectorQuery().
  7365. in(_this)[all ? 'selectAll' : 'select'](selector).
  7366. boundingClientRect(function (rect) {
  7367. if (all && Array.isArray(rect) && rect.length) {
  7368. resolve(rect);
  7369. }
  7370. if (!all && rect) {
  7371. resolve(rect);
  7372. }
  7373. }).
  7374. exec();
  7375. });
  7376. },
  7377. getParentData: function getParentData() {var _this2 = this;var parentName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  7378. // 避免在created中去定义parent变量
  7379. if (!this.parent) this.parent = false;
  7380. // 这里的本质原理是,通过获取父组件实例(也即u-radio-group的this)
  7381. // 将父组件this中对应的参数,赋值给本组件(u-radio的this)的parentData对象中对应的属性
  7382. // 之所以需要这么做,是因为所有端中,头条小程序不支持通过this.parent.xxx去监听父组件参数的变化
  7383. this.parent = this.$u.$parent.call(this, parentName);
  7384. if (this.parent) {
  7385. // 历遍parentData中的属性,将parent中的同名属性赋值给parentData
  7386. Object.keys(this.parentData).map(function (key) {
  7387. _this2.parentData[key] = _this2.parent[key];
  7388. });
  7389. }
  7390. },
  7391. // 阻止事件冒泡
  7392. preventEvent: function preventEvent(e) {
  7393. e && e.stopPropagation && e.stopPropagation();
  7394. } },
  7395. onReachBottom: function onReachBottom() {
  7396. uni.$emit('uOnReachBottom');
  7397. },
  7398. beforeDestroy: function beforeDestroy() {var _this3 = this;
  7399. // 判断当前页面是否存在parent和chldren,一般在checkbox和checkbox-group父子联动的场景会有此情况
  7400. // 组件销毁时,移除子组件在父组件children数组中的实例,释放资源,避免数据混乱
  7401. if (this.parent && uni.$u.test.array(this.parent.children)) {
  7402. // 组件销毁时,移除父组件中的children数组中对应的实例
  7403. var childrenList = this.parent.children;
  7404. childrenList.map(function (child, index) {
  7405. // 如果相等,则移除
  7406. if (child === _this3) {
  7407. childrenList.splice(index, 1);
  7408. }
  7409. });
  7410. }
  7411. } };
  7412. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  7413. /***/ }),
  7414. /* 13 */
  7415. /*!*********************************************************************************************!*\
  7416. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/libs/request/index.js ***!
  7417. \*********************************************************************************************/
  7418. /*! no static exports found */
  7419. /***/ (function(module, exports, __webpack_require__) {
  7420. "use strict";
  7421. /* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _deepMerge = _interopRequireDefault(__webpack_require__(/*! ../function/deepMerge */ 14));
  7422. var _test = _interopRequireDefault(__webpack_require__(/*! ../function/test */ 16));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;}var
  7423. Request = /*#__PURE__*/function () {_createClass(Request, [{ key: "setConfig",
  7424. // 设置全局默认配置
  7425. value: function setConfig(customConfig) {
  7426. // 深度合并对象,否则会造成对象深层属性丢失
  7427. this.config = (0, _deepMerge.default)(this.config, customConfig);
  7428. }
  7429. // 主要请求部分
  7430. }, { key: "request", value: function request() {var _this = this;var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7431. // 检查请求拦截
  7432. if (this.interceptor.request && typeof this.interceptor.request === 'function') {
  7433. var tmpConfig = {};
  7434. var interceptorRequest = this.interceptor.request(options);
  7435. if (interceptorRequest === false) {
  7436. // 返回一个处于pending状态中的Promise,来取消原promise,避免进入then()回调
  7437. return new Promise(function () {});
  7438. }
  7439. this.options = interceptorRequest;
  7440. }
  7441. options.dataType = options.dataType || this.config.dataType;
  7442. options.responseType = options.responseType || this.config.responseType;
  7443. options.url = options.url || '';
  7444. options.params = options.params || {};
  7445. options.header = Object.assign({}, this.config.header, options.header);
  7446. options.method = options.method || this.config.method;
  7447. return new Promise(function (resolve, reject) {
  7448. options.complete = function (response) {
  7449. // 请求返回后,隐藏loading(如果请求返回快的话,可能会没有loading)
  7450. uni.hideLoading();
  7451. // 清除定时器,如果请求回来了,就无需loading
  7452. clearTimeout(_this.config.timer);
  7453. _this.config.timer = null;
  7454. // 判断用户对拦截返回数据的要求,如果originalData为true,返回所有的数据(response)到拦截器,否则只返回response.data
  7455. if (_this.config.originalData) {
  7456. // 判断是否存在拦截器
  7457. if (_this.interceptor.response && typeof _this.interceptor.response === 'function') {
  7458. var resInterceptors = _this.interceptor.response(response);
  7459. // 如果拦截器不返回false,就将拦截器返回的内容给this.$u.post的then回调
  7460. if (resInterceptors !== false) {
  7461. resolve(resInterceptors);
  7462. } else {
  7463. // 如果拦截器返回false,意味着拦截器定义者认为返回有问题,直接接入catch回调
  7464. reject(response);
  7465. }
  7466. } else {
  7467. // 如果要求返回原始数据,就算没有拦截器,也返回最原始的数据
  7468. resolve(response);
  7469. }
  7470. } else {
  7471. if (response.statusCode == 200) {
  7472. if (_this.interceptor.response && typeof _this.interceptor.response === 'function') {
  7473. var _resInterceptors = _this.interceptor.response(response.data);
  7474. if (_resInterceptors !== false) {
  7475. resolve(_resInterceptors);
  7476. } else {
  7477. reject(response.data);
  7478. }
  7479. } else {
  7480. // 如果不是返回原始数据(originalData=false),且没有拦截器的情况下,返回纯数据给then回调
  7481. resolve(response.data);
  7482. }
  7483. } else {
  7484. // 不返回原始数据的情况下,服务器状态码不为200,modal弹框提示
  7485. // if(response.errMsg) {
  7486. // uni.showModal({
  7487. // title: response.errMsg
  7488. // });
  7489. // }
  7490. reject(response);
  7491. }
  7492. }
  7493. };
  7494. // 判断用户传递的URL是否/开头,如果不是,加上/,这里使用了uView的test.js验证库的url()方法
  7495. options.url = _test.default.url(options.url) ? options.url : _this.config.baseUrl + (options.url.indexOf('/') == 0 ?
  7496. options.url : '/' + options.url);
  7497. // 是否显示loading
  7498. // 加一个是否已有timer定时器的判断,否则有两个同时请求的时候,后者会清除前者的定时器id
  7499. // 而没有清除前者的定时器,导致前者超时,一直显示loading
  7500. if (_this.config.showLoading && !_this.config.timer) {
  7501. _this.config.timer = setTimeout(function () {
  7502. uni.showLoading({
  7503. title: _this.config.loadingText,
  7504. mask: _this.config.loadingMask });
  7505. _this.config.timer = null;
  7506. }, _this.config.loadingTime);
  7507. }
  7508. uni.request(options);
  7509. });
  7510. // .catch(res => {
  7511. // // 如果返回reject(),不让其进入this.$u.post().then().catch()后面的catct()
  7512. // // 因为很多人都会忘了写后面的catch(),导致报错捕获不到catch
  7513. // return new Promise(()=>{});
  7514. // })
  7515. } }]);
  7516. function Request() {var _this2 = this;_classCallCheck(this, Request);
  7517. this.config = {
  7518. baseUrl: '', // 请求的根域名
  7519. // 默认的请求头
  7520. header: {},
  7521. method: 'POST',
  7522. // 设置为json,返回后uni.request会对数据进行一次JSON.parse
  7523. dataType: 'json',
  7524. // 此参数无需处理,因为5+和支付宝小程序不支持,默认为text即可
  7525. responseType: 'text',
  7526. showLoading: true, // 是否显示请求中的loading
  7527. loadingText: '请求中...',
  7528. loadingTime: 800, // 在此时间内,请求还没回来的话,就显示加载中动画,单位ms
  7529. timer: null, // 定时器
  7530. originalData: false, // 是否在拦截器中返回服务端的原始数据,见文档说明
  7531. loadingMask: true // 展示loading的时候,是否给一个透明的蒙层,防止触摸穿透
  7532. };
  7533. // 拦截器
  7534. this.interceptor = {
  7535. // 请求前的拦截
  7536. request: null,
  7537. // 请求后的拦截
  7538. response: null };
  7539. // get请求
  7540. this.get = function (url) {var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};var header = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  7541. return _this2.request({
  7542. method: 'GET',
  7543. url: url,
  7544. header: header,
  7545. data: data });
  7546. };
  7547. // post请求
  7548. this.post = function (url) {var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};var header = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  7549. return _this2.request({
  7550. url: url,
  7551. method: 'POST',
  7552. header: header,
  7553. data: data });
  7554. };
  7555. // put请求,不支持支付宝小程序(HX2.6.15)
  7556. this.put = function (url) {var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};var header = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  7557. return _this2.request({
  7558. url: url,
  7559. method: 'PUT',
  7560. header: header,
  7561. data: data });
  7562. };
  7563. // delete请求,不支持支付宝和头条小程序(HX2.6.15)
  7564. this.delete = function (url) {var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};var header = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  7565. return _this2.request({
  7566. url: url,
  7567. method: 'DELETE',
  7568. header: header,
  7569. data: data });
  7570. };
  7571. }return Request;}();var _default =
  7572. new Request();exports.default = _default;
  7573. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  7574. /***/ }),
  7575. /* 14 */
  7576. /*!**************************************************************************************************!*\
  7577. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/libs/function/deepMerge.js ***!
  7578. \**************************************************************************************************/
  7579. /*! no static exports found */
  7580. /***/ (function(module, exports, __webpack_require__) {
  7581. "use strict";
  7582. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _deepClone = _interopRequireDefault(__webpack_require__(/*! ./deepClone */ 15));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
  7583. // JS对象深度合并
  7584. function deepMerge() {var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  7585. target = (0, _deepClone.default)(target);
  7586. if (typeof target !== 'object' || typeof source !== 'object') return false;
  7587. for (var prop in source) {
  7588. if (!source.hasOwnProperty(prop)) continue;
  7589. if (prop in target) {
  7590. if (typeof target[prop] !== 'object') {
  7591. target[prop] = source[prop];
  7592. } else {
  7593. if (typeof source[prop] !== 'object') {
  7594. target[prop] = source[prop];
  7595. } else {
  7596. if (target[prop].concat && source[prop].concat) {
  7597. target[prop] = target[prop].concat(source[prop]);
  7598. } else {
  7599. target[prop] = deepMerge(target[prop], source[prop]);
  7600. }
  7601. }
  7602. }
  7603. } else {
  7604. target[prop] = source[prop];
  7605. }
  7606. }
  7607. return target;
  7608. }var _default =
  7609. deepMerge;exports.default = _default;
  7610. /***/ }),
  7611. /* 15 */
  7612. /*!**************************************************************************************************!*\
  7613. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/libs/function/deepClone.js ***!
  7614. \**************************************************************************************************/
  7615. /*! no static exports found */
  7616. /***/ (function(module, exports, __webpack_require__) {
  7617. "use strict";
  7618. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; // 判断arr是否为一个数组,返回一个bool值
  7619. function isArray(arr) {
  7620. return Object.prototype.toString.call(arr) === '[object Array]';
  7621. }
  7622. // 深度克隆
  7623. function deepClone(obj) {
  7624. // 对常见的“非”值,直接返回原来值
  7625. if ([null, undefined, NaN, false].includes(obj)) return obj;
  7626. if (typeof obj !== "object" && typeof obj !== 'function') {
  7627. //原始类型直接返回
  7628. return obj;
  7629. }
  7630. var o = isArray(obj) ? [] : {};
  7631. for (var i in obj) {
  7632. if (obj.hasOwnProperty(i)) {
  7633. o[i] = typeof obj[i] === "object" ? deepClone(obj[i]) : obj[i];
  7634. }
  7635. }
  7636. return o;
  7637. }var _default =
  7638. deepClone;exports.default = _default;
  7639. /***/ }),
  7640. /* 16 */
  7641. /*!*********************************************************************************************!*\
  7642. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/libs/function/test.js ***!
  7643. \*********************************************************************************************/
  7644. /*! no static exports found */
  7645. /***/ (function(module, exports, __webpack_require__) {
  7646. "use strict";
  7647. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; /**
  7648. * 验证电子邮箱格式
  7649. */
  7650. function email(value) {
  7651. return /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test(value);
  7652. }
  7653. /**
  7654. * 验证手机格式
  7655. */
  7656. function mobile(value) {
  7657. return /^1[3-9]\d{9}$/.test(value);
  7658. }
  7659. /**
  7660. * 验证URL格式
  7661. */
  7662. function url(value) {
  7663. return /http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w-.\/?%&=]*)?/.test(value);
  7664. }
  7665. /**
  7666. * 验证日期格式
  7667. */
  7668. function date(value) {
  7669. return !/Invalid|NaN/.test(new Date(value).toString());
  7670. }
  7671. /**
  7672. * 验证ISO类型的日期格式
  7673. */
  7674. function dateISO(value) {
  7675. return /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(value);
  7676. }
  7677. /**
  7678. * 验证十进制数字
  7679. */
  7680. function number(value) {
  7681. return /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value);
  7682. }
  7683. /**
  7684. * 验证整数
  7685. */
  7686. function digits(value) {
  7687. return /^\d+$/.test(value);
  7688. }
  7689. /**
  7690. * 验证身份证号码
  7691. */
  7692. function idCard(value) {
  7693. return /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(
  7694. value);
  7695. }
  7696. /**
  7697. * 是否车牌号
  7698. */
  7699. function carNo(value) {
  7700. // 新能源车牌
  7701. var xreg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/;
  7702. // 旧车牌
  7703. var creg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;
  7704. if (value.length === 7) {
  7705. return creg.test(value);
  7706. } else if (value.length === 8) {
  7707. return xreg.test(value);
  7708. } else {
  7709. return false;
  7710. }
  7711. }
  7712. /**
  7713. * 金额,只允许2位小数
  7714. */
  7715. function amount(value) {
  7716. //金额,只允许保留两位小数
  7717. return /^[1-9]\d*(,\d{3})*(\.\d{1,2})?$|^0\.\d{1,2}$/.test(value);
  7718. }
  7719. /**
  7720. * 中文
  7721. */
  7722. function chinese(value) {
  7723. var reg = /^[\u4e00-\u9fa5]+$/gi;
  7724. return reg.test(value);
  7725. }
  7726. /**
  7727. * 只能输入字母
  7728. */
  7729. function letter(value) {
  7730. return /^[a-zA-Z]*$/.test(value);
  7731. }
  7732. /**
  7733. * 只能是字母或者数字
  7734. */
  7735. function enOrNum(value) {
  7736. //英文或者数字
  7737. var reg = /^[0-9a-zA-Z]*$/g;
  7738. return reg.test(value);
  7739. }
  7740. /**
  7741. * 验证是否包含某个值
  7742. */
  7743. function contains(value, param) {
  7744. return value.indexOf(param) >= 0;
  7745. }
  7746. /**
  7747. * 验证一个值范围[min, max]
  7748. */
  7749. function range(value, param) {
  7750. return value >= param[0] && value <= param[1];
  7751. }
  7752. /**
  7753. * 验证一个长度范围[min, max]
  7754. */
  7755. function rangeLength(value, param) {
  7756. return value.length >= param[0] && value.length <= param[1];
  7757. }
  7758. /**
  7759. * 是否固定电话
  7760. */
  7761. function landline(value) {
  7762. var reg = /^\d{3,4}-\d{7,8}(-\d{3,4})?$/;
  7763. return reg.test(value);
  7764. }
  7765. /**
  7766. * 判断是否为空
  7767. */
  7768. function empty(value) {
  7769. switch (typeof value) {
  7770. case 'undefined':
  7771. return true;
  7772. case 'string':
  7773. if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true;
  7774. break;
  7775. case 'boolean':
  7776. if (!value) return true;
  7777. break;
  7778. case 'number':
  7779. if (0 === value || isNaN(value)) return true;
  7780. break;
  7781. case 'object':
  7782. if (null === value || value.length === 0) return true;
  7783. for (var i in value) {
  7784. return false;
  7785. }
  7786. return true;}
  7787. return false;
  7788. }
  7789. /**
  7790. * 是否json字符串
  7791. */
  7792. function jsonString(value) {
  7793. if (typeof value == 'string') {
  7794. try {
  7795. var obj = JSON.parse(value);
  7796. if (typeof obj == 'object' && obj) {
  7797. return true;
  7798. } else {
  7799. return false;
  7800. }
  7801. } catch (e) {
  7802. return false;
  7803. }
  7804. }
  7805. return false;
  7806. }
  7807. /**
  7808. * 是否数组
  7809. */
  7810. function array(value) {
  7811. if (typeof Array.isArray === "function") {
  7812. return Array.isArray(value);
  7813. } else {
  7814. return Object.prototype.toString.call(value) === "[object Array]";
  7815. }
  7816. }
  7817. /**
  7818. * 是否对象
  7819. */
  7820. function object(value) {
  7821. return Object.prototype.toString.call(value) === '[object Object]';
  7822. }
  7823. /**
  7824. * 是否短信验证码
  7825. */
  7826. function code(value) {var len = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 6;
  7827. return new RegExp("^\\d{".concat(len, "}$")).test(value);
  7828. }var _default =
  7829. {
  7830. email: email,
  7831. mobile: mobile,
  7832. url: url,
  7833. date: date,
  7834. dateISO: dateISO,
  7835. number: number,
  7836. digits: digits,
  7837. idCard: idCard,
  7838. carNo: carNo,
  7839. amount: amount,
  7840. chinese: chinese,
  7841. letter: letter,
  7842. enOrNum: enOrNum,
  7843. contains: contains,
  7844. range: range,
  7845. rangeLength: rangeLength,
  7846. empty: empty,
  7847. isEmpty: empty,
  7848. jsonString: jsonString,
  7849. landline: landline,
  7850. object: object,
  7851. array: array,
  7852. code: code };exports.default = _default;
  7853. /***/ }),
  7854. /* 17 */
  7855. /*!****************************************************************************************************!*\
  7856. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/libs/function/queryParams.js ***!
  7857. \****************************************************************************************************/
  7858. /*! no static exports found */
  7859. /***/ (function(module, exports, __webpack_require__) {
  7860. "use strict";
  7861. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; /**
  7862. * 对象转url参数
  7863. * @param {*} data,对象
  7864. * @param {*} isPrefix,是否自动加上"?"
  7865. */
  7866. function queryParams() {var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};var isPrefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;var arrayFormat = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'brackets';
  7867. var prefix = isPrefix ? '?' : '';
  7868. var _result = [];
  7869. if (['indices', 'brackets', 'repeat', 'comma'].indexOf(arrayFormat) == -1) arrayFormat = 'brackets';var _loop = function _loop(
  7870. key) {
  7871. var value = data[key];
  7872. // 去掉为空的参数
  7873. if (['', undefined, null].indexOf(value) >= 0) {
  7874. return "continue";
  7875. }
  7876. // 如果值为数组,另行处理
  7877. if (value.constructor === Array) {
  7878. // e.g. {ids: [1, 2, 3]}
  7879. switch (arrayFormat) {
  7880. case 'indices':
  7881. // 结果: ids[0]=1&ids[1]=2&ids[2]=3
  7882. for (var i = 0; i < value.length; i++) {
  7883. _result.push(key + '[' + i + ']=' + value[i]);
  7884. }
  7885. break;
  7886. case 'brackets':
  7887. // 结果: ids[]=1&ids[]=2&ids[]=3
  7888. value.forEach(function (_value) {
  7889. _result.push(key + '[]=' + _value);
  7890. });
  7891. break;
  7892. case 'repeat':
  7893. // 结果: ids=1&ids=2&ids=3
  7894. value.forEach(function (_value) {
  7895. _result.push(key + '=' + _value);
  7896. });
  7897. break;
  7898. case 'comma':
  7899. // 结果: ids=1,2,3
  7900. var commaStr = "";
  7901. value.forEach(function (_value) {
  7902. commaStr += (commaStr ? "," : "") + _value;
  7903. });
  7904. _result.push(key + '=' + commaStr);
  7905. break;
  7906. default:
  7907. value.forEach(function (_value) {
  7908. _result.push(key + '[]=' + _value);
  7909. });}
  7910. } else {
  7911. _result.push(key + '=' + value);
  7912. }};for (var key in data) {var _ret = _loop(key);if (_ret === "continue") continue;
  7913. }
  7914. return _result.length ? prefix + _result.join('&') : '';
  7915. }var _default =
  7916. queryParams;exports.default = _default;
  7917. /***/ }),
  7918. /* 18 */
  7919. /*!**********************************************************************************************!*\
  7920. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/libs/function/route.js ***!
  7921. \**********************************************************************************************/
  7922. /*! no static exports found */
  7923. /***/ (function(module, exports, __webpack_require__) {
  7924. "use strict";
  7925. /* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _regenerator = _interopRequireDefault(__webpack_require__(/*! ./node_modules/@babel/runtime/regenerator */ 19));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {try {var info = gen[key](arg);var value = info.value;} catch (error) {reject(error);return;}if (info.done) {resolve(value);} else {Promise.resolve(value).then(_next, _throw);}}function _asyncToGenerator(fn) {return function () {var self = this,args = arguments;return new Promise(function (resolve, reject) {var gen = fn.apply(self, args);function _next(value) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);}function _throw(err) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);}_next(undefined);});};}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;} /**
  7926. * 路由跳转方法,该方法相对于直接使用uni.xxx的好处是使用更加简单快捷
  7927. * 并且带有路由拦截功能
  7928. */var
  7929. Router = /*#__PURE__*/function () {
  7930. function Router() {_classCallCheck(this, Router);
  7931. // 原始属性定义
  7932. this.config = {
  7933. type: 'navigateTo',
  7934. url: '',
  7935. delta: 1, // navigateBack页面后退时,回退的层数
  7936. params: {}, // 传递的参数
  7937. animationType: 'pop-in', // 窗口动画,只在APP有效
  7938. animationDuration: 300, // 窗口动画持续时间,单位毫秒,只在APP有效
  7939. intercept: false // 是否需要拦截
  7940. };
  7941. // 因为route方法是需要对外赋值给另外的对象使用,同时route内部有使用this,会导致route失去上下文
  7942. // 这里在构造函数中进行this绑定
  7943. this.route = this.route.bind(this);
  7944. }
  7945. // 判断url前面是否有"/",如果没有则加上,否则无法跳转
  7946. _createClass(Router, [{ key: "addRootPath", value: function addRootPath(url) {
  7947. return url[0] === '/' ? url : "/".concat(url);
  7948. }
  7949. // 整合路由参数
  7950. }, { key: "mixinParam", value: function mixinParam(url, params) {
  7951. url = url && this.addRootPath(url);
  7952. // 使用正则匹配,主要依据是判断是否有"/","?","="等,如“/page/index/index?name=mary"
  7953. // 如果有url中有get参数,转换后无需带上"?"
  7954. var query = '';
  7955. if (/.*\/.*\?.*=.*/.test(url)) {
  7956. // object对象转为get类型的参数
  7957. query = uni.$u.queryParams(params, false);
  7958. // 因为已有get参数,所以后面拼接的参数需要带上"&"隔开
  7959. return url += "&" + query;
  7960. } else {
  7961. // 直接拼接参数,因为此处url中没有后面的query参数,也就没有"?/&"之类的符号
  7962. query = uni.$u.queryParams(params);
  7963. return url += query;
  7964. }
  7965. }
  7966. // 对外的方法名称
  7967. }, { key: "route", value: function () {var _route = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee() {var options,params,mergeConfig,isNext,_args = arguments;return _regenerator.default.wrap(function _callee$(_context) {while (1) {switch (_context.prev = _context.next) {case 0:options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};params = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
  7968. // 合并用户的配置和内部的默认配置
  7969. mergeConfig = {};
  7970. if (typeof options === 'string') {
  7971. // 如果options为字符串,则为route(url, params)的形式
  7972. mergeConfig.url = this.mixinParam(options, params);
  7973. mergeConfig.type = 'navigateTo';
  7974. } else {
  7975. mergeConfig = uni.$u.deepClone(options, this.config);
  7976. // 否则正常使用mergeConfig中的url和params进行拼接
  7977. mergeConfig.url = this.mixinParam(options.url, options.params);
  7978. }
  7979. if (params.intercept) {
  7980. this.config.intercept = params.intercept;
  7981. }
  7982. // params参数也带给拦截器
  7983. mergeConfig.params = params;
  7984. // 合并内外部参数
  7985. mergeConfig = uni.$u.deepMerge(this.config, mergeConfig);
  7986. // 判断用户是否定义了拦截器
  7987. if (!(typeof uni.$u.routeIntercept === 'function')) {_context.next = 14;break;}_context.next = 10;return (
  7988. new Promise(function (resolve, reject) {
  7989. uni.$u.routeIntercept(mergeConfig, resolve);
  7990. }));case 10:isNext = _context.sent;
  7991. // 如果isNext为true,则执行路由跳转
  7992. isNext && this.openPage(mergeConfig);_context.next = 15;break;case 14:
  7993. this.openPage(mergeConfig);case 15:case "end":return _context.stop();}}}, _callee, this);}));function route() {return _route.apply(this, arguments);}return route;}()
  7994. // 执行路由跳转
  7995. }, { key: "openPage", value: function openPage(config) {
  7996. // 解构参数
  7997. var
  7998. url =
  7999. config.url,type = config.type,delta = config.delta,animationType = config.animationType,animationDuration = config.animationDuration;
  8000. if (config.type == 'navigateTo' || config.type == 'to') {
  8001. uni.navigateTo({
  8002. url: url,
  8003. animationType: animationType,
  8004. animationDuration: animationDuration });
  8005. }
  8006. if (config.type == 'redirectTo' || config.type == 'redirect') {
  8007. uni.redirectTo({
  8008. url: url });
  8009. }
  8010. if (config.type == 'switchTab' || config.type == 'tab') {
  8011. uni.switchTab({
  8012. url: url });
  8013. }
  8014. if (config.type == 'reLaunch' || config.type == 'launch') {
  8015. uni.reLaunch({
  8016. url: url });
  8017. }
  8018. if (config.type == 'navigateBack' || config.type == 'back') {
  8019. uni.navigateBack({
  8020. delta: delta });
  8021. }
  8022. } }]);return Router;}();var _default =
  8023. new Router().route;exports.default = _default;
  8024. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  8025. /***/ }),
  8026. /* 19 */
  8027. /*!**********************************************************!*\
  8028. !*** ./node_modules/@babel/runtime/regenerator/index.js ***!
  8029. \**********************************************************/
  8030. /*! no static exports found */
  8031. /***/ (function(module, exports, __webpack_require__) {
  8032. module.exports = __webpack_require__(/*! regenerator-runtime */ 20);
  8033. /***/ }),
  8034. /* 20 */
  8035. /*!************************************************************!*\
  8036. !*** ./node_modules/regenerator-runtime/runtime-module.js ***!
  8037. \************************************************************/
  8038. /*! no static exports found */
  8039. /***/ (function(module, exports, __webpack_require__) {
  8040. /**
  8041. * Copyright (c) 2014-present, Facebook, Inc.
  8042. *
  8043. * This source code is licensed under the MIT license found in the
  8044. * LICENSE file in the root directory of this source tree.
  8045. */
  8046. // This method of obtaining a reference to the global object needs to be
  8047. // kept identical to the way it is obtained in runtime.js
  8048. var g = (function() {
  8049. return this || (typeof self === "object" && self);
  8050. })() || Function("return this")();
  8051. // Use `getOwnPropertyNames` because not all browsers support calling
  8052. // `hasOwnProperty` on the global `self` object in a worker. See #183.
  8053. var hadRuntime = g.regeneratorRuntime &&
  8054. Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0;
  8055. // Save the old regeneratorRuntime in case it needs to be restored later.
  8056. var oldRuntime = hadRuntime && g.regeneratorRuntime;
  8057. // Force reevalutation of runtime.js.
  8058. g.regeneratorRuntime = undefined;
  8059. module.exports = __webpack_require__(/*! ./runtime */ 21);
  8060. if (hadRuntime) {
  8061. // Restore the original runtime.
  8062. g.regeneratorRuntime = oldRuntime;
  8063. } else {
  8064. // Remove the global property added by runtime.js.
  8065. try {
  8066. delete g.regeneratorRuntime;
  8067. } catch(e) {
  8068. g.regeneratorRuntime = undefined;
  8069. }
  8070. }
  8071. /***/ }),
  8072. /* 21 */
  8073. /*!*****************************************************!*\
  8074. !*** ./node_modules/regenerator-runtime/runtime.js ***!
  8075. \*****************************************************/
  8076. /*! no static exports found */
  8077. /***/ (function(module, exports) {
  8078. /**
  8079. * Copyright (c) 2014-present, Facebook, Inc.
  8080. *
  8081. * This source code is licensed under the MIT license found in the
  8082. * LICENSE file in the root directory of this source tree.
  8083. */
  8084. !(function(global) {
  8085. "use strict";
  8086. var Op = Object.prototype;
  8087. var hasOwn = Op.hasOwnProperty;
  8088. var undefined; // More compressible than void 0.
  8089. var $Symbol = typeof Symbol === "function" ? Symbol : {};
  8090. var iteratorSymbol = $Symbol.iterator || "@@iterator";
  8091. var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  8092. var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  8093. var inModule = typeof module === "object";
  8094. var runtime = global.regeneratorRuntime;
  8095. if (runtime) {
  8096. if (inModule) {
  8097. // If regeneratorRuntime is defined globally and we're in a module,
  8098. // make the exports object identical to regeneratorRuntime.
  8099. module.exports = runtime;
  8100. }
  8101. // Don't bother evaluating the rest of this file if the runtime was
  8102. // already defined globally.
  8103. return;
  8104. }
  8105. // Define the runtime globally (as expected by generated code) as either
  8106. // module.exports (if we're in a module) or a new, empty object.
  8107. runtime = global.regeneratorRuntime = inModule ? module.exports : {};
  8108. function wrap(innerFn, outerFn, self, tryLocsList) {
  8109. // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
  8110. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
  8111. var generator = Object.create(protoGenerator.prototype);
  8112. var context = new Context(tryLocsList || []);
  8113. // The ._invoke method unifies the implementations of the .next,
  8114. // .throw, and .return methods.
  8115. generator._invoke = makeInvokeMethod(innerFn, self, context);
  8116. return generator;
  8117. }
  8118. runtime.wrap = wrap;
  8119. // Try/catch helper to minimize deoptimizations. Returns a completion
  8120. // record like context.tryEntries[i].completion. This interface could
  8121. // have been (and was previously) designed to take a closure to be
  8122. // invoked without arguments, but in all the cases we care about we
  8123. // already have an existing method we want to call, so there's no need
  8124. // to create a new function object. We can even get away with assuming
  8125. // the method takes exactly one argument, since that happens to be true
  8126. // in every case, so we don't have to touch the arguments object. The
  8127. // only additional allocation required is the completion record, which
  8128. // has a stable shape and so hopefully should be cheap to allocate.
  8129. function tryCatch(fn, obj, arg) {
  8130. try {
  8131. return { type: "normal", arg: fn.call(obj, arg) };
  8132. } catch (err) {
  8133. return { type: "throw", arg: err };
  8134. }
  8135. }
  8136. var GenStateSuspendedStart = "suspendedStart";
  8137. var GenStateSuspendedYield = "suspendedYield";
  8138. var GenStateExecuting = "executing";
  8139. var GenStateCompleted = "completed";
  8140. // Returning this object from the innerFn has the same effect as
  8141. // breaking out of the dispatch switch statement.
  8142. var ContinueSentinel = {};
  8143. // Dummy constructor functions that we use as the .constructor and
  8144. // .constructor.prototype properties for functions that return Generator
  8145. // objects. For full spec compliance, you may wish to configure your
  8146. // minifier not to mangle the names of these two functions.
  8147. function Generator() {}
  8148. function GeneratorFunction() {}
  8149. function GeneratorFunctionPrototype() {}
  8150. // This is a polyfill for %IteratorPrototype% for environments that
  8151. // don't natively support it.
  8152. var IteratorPrototype = {};
  8153. IteratorPrototype[iteratorSymbol] = function () {
  8154. return this;
  8155. };
  8156. var getProto = Object.getPrototypeOf;
  8157. var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  8158. if (NativeIteratorPrototype &&
  8159. NativeIteratorPrototype !== Op &&
  8160. hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
  8161. // This environment has a native %IteratorPrototype%; use it instead
  8162. // of the polyfill.
  8163. IteratorPrototype = NativeIteratorPrototype;
  8164. }
  8165. var Gp = GeneratorFunctionPrototype.prototype =
  8166. Generator.prototype = Object.create(IteratorPrototype);
  8167. GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
  8168. GeneratorFunctionPrototype.constructor = GeneratorFunction;
  8169. GeneratorFunctionPrototype[toStringTagSymbol] =
  8170. GeneratorFunction.displayName = "GeneratorFunction";
  8171. // Helper for defining the .next, .throw, and .return methods of the
  8172. // Iterator interface in terms of a single ._invoke method.
  8173. function defineIteratorMethods(prototype) {
  8174. ["next", "throw", "return"].forEach(function(method) {
  8175. prototype[method] = function(arg) {
  8176. return this._invoke(method, arg);
  8177. };
  8178. });
  8179. }
  8180. runtime.isGeneratorFunction = function(genFun) {
  8181. var ctor = typeof genFun === "function" && genFun.constructor;
  8182. return ctor
  8183. ? ctor === GeneratorFunction ||
  8184. // For the native GeneratorFunction constructor, the best we can
  8185. // do is to check its .name property.
  8186. (ctor.displayName || ctor.name) === "GeneratorFunction"
  8187. : false;
  8188. };
  8189. runtime.mark = function(genFun) {
  8190. if (Object.setPrototypeOf) {
  8191. Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
  8192. } else {
  8193. genFun.__proto__ = GeneratorFunctionPrototype;
  8194. if (!(toStringTagSymbol in genFun)) {
  8195. genFun[toStringTagSymbol] = "GeneratorFunction";
  8196. }
  8197. }
  8198. genFun.prototype = Object.create(Gp);
  8199. return genFun;
  8200. };
  8201. // Within the body of any async function, `await x` is transformed to
  8202. // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
  8203. // `hasOwn.call(value, "__await")` to determine if the yielded value is
  8204. // meant to be awaited.
  8205. runtime.awrap = function(arg) {
  8206. return { __await: arg };
  8207. };
  8208. function AsyncIterator(generator) {
  8209. function invoke(method, arg, resolve, reject) {
  8210. var record = tryCatch(generator[method], generator, arg);
  8211. if (record.type === "throw") {
  8212. reject(record.arg);
  8213. } else {
  8214. var result = record.arg;
  8215. var value = result.value;
  8216. if (value &&
  8217. typeof value === "object" &&
  8218. hasOwn.call(value, "__await")) {
  8219. return Promise.resolve(value.__await).then(function(value) {
  8220. invoke("next", value, resolve, reject);
  8221. }, function(err) {
  8222. invoke("throw", err, resolve, reject);
  8223. });
  8224. }
  8225. return Promise.resolve(value).then(function(unwrapped) {
  8226. // When a yielded Promise is resolved, its final value becomes
  8227. // the .value of the Promise<{value,done}> result for the
  8228. // current iteration.
  8229. result.value = unwrapped;
  8230. resolve(result);
  8231. }, function(error) {
  8232. // If a rejected Promise was yielded, throw the rejection back
  8233. // into the async generator function so it can be handled there.
  8234. return invoke("throw", error, resolve, reject);
  8235. });
  8236. }
  8237. }
  8238. var previousPromise;
  8239. function enqueue(method, arg) {
  8240. function callInvokeWithMethodAndArg() {
  8241. return new Promise(function(resolve, reject) {
  8242. invoke(method, arg, resolve, reject);
  8243. });
  8244. }
  8245. return previousPromise =
  8246. // If enqueue has been called before, then we want to wait until
  8247. // all previous Promises have been resolved before calling invoke,
  8248. // so that results are always delivered in the correct order. If
  8249. // enqueue has not been called before, then it is important to
  8250. // call invoke immediately, without waiting on a callback to fire,
  8251. // so that the async generator function has the opportunity to do
  8252. // any necessary setup in a predictable way. This predictability
  8253. // is why the Promise constructor synchronously invokes its
  8254. // executor callback, and why async functions synchronously
  8255. // execute code before the first await. Since we implement simple
  8256. // async functions in terms of async generators, it is especially
  8257. // important to get this right, even though it requires care.
  8258. previousPromise ? previousPromise.then(
  8259. callInvokeWithMethodAndArg,
  8260. // Avoid propagating failures to Promises returned by later
  8261. // invocations of the iterator.
  8262. callInvokeWithMethodAndArg
  8263. ) : callInvokeWithMethodAndArg();
  8264. }
  8265. // Define the unified helper method that is used to implement .next,
  8266. // .throw, and .return (see defineIteratorMethods).
  8267. this._invoke = enqueue;
  8268. }
  8269. defineIteratorMethods(AsyncIterator.prototype);
  8270. AsyncIterator.prototype[asyncIteratorSymbol] = function () {
  8271. return this;
  8272. };
  8273. runtime.AsyncIterator = AsyncIterator;
  8274. // Note that simple async functions are implemented on top of
  8275. // AsyncIterator objects; they just return a Promise for the value of
  8276. // the final result produced by the iterator.
  8277. runtime.async = function(innerFn, outerFn, self, tryLocsList) {
  8278. var iter = new AsyncIterator(
  8279. wrap(innerFn, outerFn, self, tryLocsList)
  8280. );
  8281. return runtime.isGeneratorFunction(outerFn)
  8282. ? iter // If outerFn is a generator, return the full iterator.
  8283. : iter.next().then(function(result) {
  8284. return result.done ? result.value : iter.next();
  8285. });
  8286. };
  8287. function makeInvokeMethod(innerFn, self, context) {
  8288. var state = GenStateSuspendedStart;
  8289. return function invoke(method, arg) {
  8290. if (state === GenStateExecuting) {
  8291. throw new Error("Generator is already running");
  8292. }
  8293. if (state === GenStateCompleted) {
  8294. if (method === "throw") {
  8295. throw arg;
  8296. }
  8297. // Be forgiving, per 25.3.3.3.3 of the spec:
  8298. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
  8299. return doneResult();
  8300. }
  8301. context.method = method;
  8302. context.arg = arg;
  8303. while (true) {
  8304. var delegate = context.delegate;
  8305. if (delegate) {
  8306. var delegateResult = maybeInvokeDelegate(delegate, context);
  8307. if (delegateResult) {
  8308. if (delegateResult === ContinueSentinel) continue;
  8309. return delegateResult;
  8310. }
  8311. }
  8312. if (context.method === "next") {
  8313. // Setting context._sent for legacy support of Babel's
  8314. // function.sent implementation.
  8315. context.sent = context._sent = context.arg;
  8316. } else if (context.method === "throw") {
  8317. if (state === GenStateSuspendedStart) {
  8318. state = GenStateCompleted;
  8319. throw context.arg;
  8320. }
  8321. context.dispatchException(context.arg);
  8322. } else if (context.method === "return") {
  8323. context.abrupt("return", context.arg);
  8324. }
  8325. state = GenStateExecuting;
  8326. var record = tryCatch(innerFn, self, context);
  8327. if (record.type === "normal") {
  8328. // If an exception is thrown from innerFn, we leave state ===
  8329. // GenStateExecuting and loop back for another invocation.
  8330. state = context.done
  8331. ? GenStateCompleted
  8332. : GenStateSuspendedYield;
  8333. if (record.arg === ContinueSentinel) {
  8334. continue;
  8335. }
  8336. return {
  8337. value: record.arg,
  8338. done: context.done
  8339. };
  8340. } else if (record.type === "throw") {
  8341. state = GenStateCompleted;
  8342. // Dispatch the exception by looping back around to the
  8343. // context.dispatchException(context.arg) call above.
  8344. context.method = "throw";
  8345. context.arg = record.arg;
  8346. }
  8347. }
  8348. };
  8349. }
  8350. // Call delegate.iterator[context.method](context.arg) and handle the
  8351. // result, either by returning a { value, done } result from the
  8352. // delegate iterator, or by modifying context.method and context.arg,
  8353. // setting context.delegate to null, and returning the ContinueSentinel.
  8354. function maybeInvokeDelegate(delegate, context) {
  8355. var method = delegate.iterator[context.method];
  8356. if (method === undefined) {
  8357. // A .throw or .return when the delegate iterator has no .throw
  8358. // method always terminates the yield* loop.
  8359. context.delegate = null;
  8360. if (context.method === "throw") {
  8361. if (delegate.iterator.return) {
  8362. // If the delegate iterator has a return method, give it a
  8363. // chance to clean up.
  8364. context.method = "return";
  8365. context.arg = undefined;
  8366. maybeInvokeDelegate(delegate, context);
  8367. if (context.method === "throw") {
  8368. // If maybeInvokeDelegate(context) changed context.method from
  8369. // "return" to "throw", let that override the TypeError below.
  8370. return ContinueSentinel;
  8371. }
  8372. }
  8373. context.method = "throw";
  8374. context.arg = new TypeError(
  8375. "The iterator does not provide a 'throw' method");
  8376. }
  8377. return ContinueSentinel;
  8378. }
  8379. var record = tryCatch(method, delegate.iterator, context.arg);
  8380. if (record.type === "throw") {
  8381. context.method = "throw";
  8382. context.arg = record.arg;
  8383. context.delegate = null;
  8384. return ContinueSentinel;
  8385. }
  8386. var info = record.arg;
  8387. if (! info) {
  8388. context.method = "throw";
  8389. context.arg = new TypeError("iterator result is not an object");
  8390. context.delegate = null;
  8391. return ContinueSentinel;
  8392. }
  8393. if (info.done) {
  8394. // Assign the result of the finished delegate to the temporary
  8395. // variable specified by delegate.resultName (see delegateYield).
  8396. context[delegate.resultName] = info.value;
  8397. // Resume execution at the desired location (see delegateYield).
  8398. context.next = delegate.nextLoc;
  8399. // If context.method was "throw" but the delegate handled the
  8400. // exception, let the outer generator proceed normally. If
  8401. // context.method was "next", forget context.arg since it has been
  8402. // "consumed" by the delegate iterator. If context.method was
  8403. // "return", allow the original .return call to continue in the
  8404. // outer generator.
  8405. if (context.method !== "return") {
  8406. context.method = "next";
  8407. context.arg = undefined;
  8408. }
  8409. } else {
  8410. // Re-yield the result returned by the delegate method.
  8411. return info;
  8412. }
  8413. // The delegate iterator is finished, so forget it and continue with
  8414. // the outer generator.
  8415. context.delegate = null;
  8416. return ContinueSentinel;
  8417. }
  8418. // Define Generator.prototype.{next,throw,return} in terms of the
  8419. // unified ._invoke helper method.
  8420. defineIteratorMethods(Gp);
  8421. Gp[toStringTagSymbol] = "Generator";
  8422. // A Generator should always return itself as the iterator object when the
  8423. // @@iterator function is called on it. Some browsers' implementations of the
  8424. // iterator prototype chain incorrectly implement this, causing the Generator
  8425. // object to not be returned from this call. This ensures that doesn't happen.
  8426. // See https://github.com/facebook/regenerator/issues/274 for more details.
  8427. Gp[iteratorSymbol] = function() {
  8428. return this;
  8429. };
  8430. Gp.toString = function() {
  8431. return "[object Generator]";
  8432. };
  8433. function pushTryEntry(locs) {
  8434. var entry = { tryLoc: locs[0] };
  8435. if (1 in locs) {
  8436. entry.catchLoc = locs[1];
  8437. }
  8438. if (2 in locs) {
  8439. entry.finallyLoc = locs[2];
  8440. entry.afterLoc = locs[3];
  8441. }
  8442. this.tryEntries.push(entry);
  8443. }
  8444. function resetTryEntry(entry) {
  8445. var record = entry.completion || {};
  8446. record.type = "normal";
  8447. delete record.arg;
  8448. entry.completion = record;
  8449. }
  8450. function Context(tryLocsList) {
  8451. // The root entry object (effectively a try statement without a catch
  8452. // or a finally block) gives us a place to store values thrown from
  8453. // locations where there is no enclosing try statement.
  8454. this.tryEntries = [{ tryLoc: "root" }];
  8455. tryLocsList.forEach(pushTryEntry, this);
  8456. this.reset(true);
  8457. }
  8458. runtime.keys = function(object) {
  8459. var keys = [];
  8460. for (var key in object) {
  8461. keys.push(key);
  8462. }
  8463. keys.reverse();
  8464. // Rather than returning an object with a next method, we keep
  8465. // things simple and return the next function itself.
  8466. return function next() {
  8467. while (keys.length) {
  8468. var key = keys.pop();
  8469. if (key in object) {
  8470. next.value = key;
  8471. next.done = false;
  8472. return next;
  8473. }
  8474. }
  8475. // To avoid creating an additional object, we just hang the .value
  8476. // and .done properties off the next function object itself. This
  8477. // also ensures that the minifier will not anonymize the function.
  8478. next.done = true;
  8479. return next;
  8480. };
  8481. };
  8482. function values(iterable) {
  8483. if (iterable) {
  8484. var iteratorMethod = iterable[iteratorSymbol];
  8485. if (iteratorMethod) {
  8486. return iteratorMethod.call(iterable);
  8487. }
  8488. if (typeof iterable.next === "function") {
  8489. return iterable;
  8490. }
  8491. if (!isNaN(iterable.length)) {
  8492. var i = -1, next = function next() {
  8493. while (++i < iterable.length) {
  8494. if (hasOwn.call(iterable, i)) {
  8495. next.value = iterable[i];
  8496. next.done = false;
  8497. return next;
  8498. }
  8499. }
  8500. next.value = undefined;
  8501. next.done = true;
  8502. return next;
  8503. };
  8504. return next.next = next;
  8505. }
  8506. }
  8507. // Return an iterator with no values.
  8508. return { next: doneResult };
  8509. }
  8510. runtime.values = values;
  8511. function doneResult() {
  8512. return { value: undefined, done: true };
  8513. }
  8514. Context.prototype = {
  8515. constructor: Context,
  8516. reset: function(skipTempReset) {
  8517. this.prev = 0;
  8518. this.next = 0;
  8519. // Resetting context._sent for legacy support of Babel's
  8520. // function.sent implementation.
  8521. this.sent = this._sent = undefined;
  8522. this.done = false;
  8523. this.delegate = null;
  8524. this.method = "next";
  8525. this.arg = undefined;
  8526. this.tryEntries.forEach(resetTryEntry);
  8527. if (!skipTempReset) {
  8528. for (var name in this) {
  8529. // Not sure about the optimal order of these conditions:
  8530. if (name.charAt(0) === "t" &&
  8531. hasOwn.call(this, name) &&
  8532. !isNaN(+name.slice(1))) {
  8533. this[name] = undefined;
  8534. }
  8535. }
  8536. }
  8537. },
  8538. stop: function() {
  8539. this.done = true;
  8540. var rootEntry = this.tryEntries[0];
  8541. var rootRecord = rootEntry.completion;
  8542. if (rootRecord.type === "throw") {
  8543. throw rootRecord.arg;
  8544. }
  8545. return this.rval;
  8546. },
  8547. dispatchException: function(exception) {
  8548. if (this.done) {
  8549. throw exception;
  8550. }
  8551. var context = this;
  8552. function handle(loc, caught) {
  8553. record.type = "throw";
  8554. record.arg = exception;
  8555. context.next = loc;
  8556. if (caught) {
  8557. // If the dispatched exception was caught by a catch block,
  8558. // then let that catch block handle the exception normally.
  8559. context.method = "next";
  8560. context.arg = undefined;
  8561. }
  8562. return !! caught;
  8563. }
  8564. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  8565. var entry = this.tryEntries[i];
  8566. var record = entry.completion;
  8567. if (entry.tryLoc === "root") {
  8568. // Exception thrown outside of any try block that could handle
  8569. // it, so set the completion value of the entire function to
  8570. // throw the exception.
  8571. return handle("end");
  8572. }
  8573. if (entry.tryLoc <= this.prev) {
  8574. var hasCatch = hasOwn.call(entry, "catchLoc");
  8575. var hasFinally = hasOwn.call(entry, "finallyLoc");
  8576. if (hasCatch && hasFinally) {
  8577. if (this.prev < entry.catchLoc) {
  8578. return handle(entry.catchLoc, true);
  8579. } else if (this.prev < entry.finallyLoc) {
  8580. return handle(entry.finallyLoc);
  8581. }
  8582. } else if (hasCatch) {
  8583. if (this.prev < entry.catchLoc) {
  8584. return handle(entry.catchLoc, true);
  8585. }
  8586. } else if (hasFinally) {
  8587. if (this.prev < entry.finallyLoc) {
  8588. return handle(entry.finallyLoc);
  8589. }
  8590. } else {
  8591. throw new Error("try statement without catch or finally");
  8592. }
  8593. }
  8594. }
  8595. },
  8596. abrupt: function(type, arg) {
  8597. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  8598. var entry = this.tryEntries[i];
  8599. if (entry.tryLoc <= this.prev &&
  8600. hasOwn.call(entry, "finallyLoc") &&
  8601. this.prev < entry.finallyLoc) {
  8602. var finallyEntry = entry;
  8603. break;
  8604. }
  8605. }
  8606. if (finallyEntry &&
  8607. (type === "break" ||
  8608. type === "continue") &&
  8609. finallyEntry.tryLoc <= arg &&
  8610. arg <= finallyEntry.finallyLoc) {
  8611. // Ignore the finally entry if control is not jumping to a
  8612. // location outside the try/catch block.
  8613. finallyEntry = null;
  8614. }
  8615. var record = finallyEntry ? finallyEntry.completion : {};
  8616. record.type = type;
  8617. record.arg = arg;
  8618. if (finallyEntry) {
  8619. this.method = "next";
  8620. this.next = finallyEntry.finallyLoc;
  8621. return ContinueSentinel;
  8622. }
  8623. return this.complete(record);
  8624. },
  8625. complete: function(record, afterLoc) {
  8626. if (record.type === "throw") {
  8627. throw record.arg;
  8628. }
  8629. if (record.type === "break" ||
  8630. record.type === "continue") {
  8631. this.next = record.arg;
  8632. } else if (record.type === "return") {
  8633. this.rval = this.arg = record.arg;
  8634. this.method = "return";
  8635. this.next = "end";
  8636. } else if (record.type === "normal" && afterLoc) {
  8637. this.next = afterLoc;
  8638. }
  8639. return ContinueSentinel;
  8640. },
  8641. finish: function(finallyLoc) {
  8642. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  8643. var entry = this.tryEntries[i];
  8644. if (entry.finallyLoc === finallyLoc) {
  8645. this.complete(entry.completion, entry.afterLoc);
  8646. resetTryEntry(entry);
  8647. return ContinueSentinel;
  8648. }
  8649. }
  8650. },
  8651. "catch": function(tryLoc) {
  8652. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  8653. var entry = this.tryEntries[i];
  8654. if (entry.tryLoc === tryLoc) {
  8655. var record = entry.completion;
  8656. if (record.type === "throw") {
  8657. var thrown = record.arg;
  8658. resetTryEntry(entry);
  8659. }
  8660. return thrown;
  8661. }
  8662. }
  8663. // The context.catch method must only be called with a location
  8664. // argument that corresponds to a known catch block.
  8665. throw new Error("illegal catch attempt");
  8666. },
  8667. delegateYield: function(iterable, resultName, nextLoc) {
  8668. this.delegate = {
  8669. iterator: values(iterable),
  8670. resultName: resultName,
  8671. nextLoc: nextLoc
  8672. };
  8673. if (this.method === "next") {
  8674. // Deliberately forget the last sent value so that we don't
  8675. // accidentally pass it on to the delegate.
  8676. this.arg = undefined;
  8677. }
  8678. return ContinueSentinel;
  8679. }
  8680. };
  8681. })(
  8682. // In sloppy mode, unbound `this` refers to the global object, fallback to
  8683. // Function constructor if we're in global strict mode. That is sadly a form
  8684. // of indirect eval which violates Content Security Policy.
  8685. (function() {
  8686. return this || (typeof self === "object" && self);
  8687. })() || Function("return this")()
  8688. );
  8689. /***/ }),
  8690. /* 22 */
  8691. /*!***************************************************************************************************!*\
  8692. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/libs/function/timeFormat.js ***!
  8693. \***************************************************************************************************/
  8694. /*! no static exports found */
  8695. /***/ (function(module, exports, __webpack_require__) {
  8696. "use strict";
  8697. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; // padStart 的 polyfill,因为某些机型或情况,还无法支持es7的padStart,比如电脑版的微信小程序
  8698. // 所以这里做一个兼容polyfill的兼容处理
  8699. if (!String.prototype.padStart) {
  8700. // 为了方便表示这里 fillString 用了ES6 的默认参数,不影响理解
  8701. String.prototype.padStart = function (maxLength) {var fillString = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ' ';
  8702. if (Object.prototype.toString.call(fillString) !== "[object String]") throw new TypeError(
  8703. 'fillString must be String');
  8704. var str = this;
  8705. // 返回 String(str) 这里是为了使返回的值是字符串字面量,在控制台中更符合直觉
  8706. if (str.length >= maxLength) return String(str);
  8707. var fillLength = maxLength - str.length,
  8708. times = Math.ceil(fillLength / fillString.length);
  8709. while (times >>= 1) {
  8710. fillString += fillString;
  8711. if (times === 1) {
  8712. fillString += fillString;
  8713. }
  8714. }
  8715. return fillString.slice(0, fillLength) + str;
  8716. };
  8717. }
  8718. // 其他更多是格式化有如下:
  8719. // yyyy:mm:dd|yyyy:mm|yyyy年mm月dd日|yyyy年mm月dd日 hh时MM分等,可自定义组合
  8720. function timeFormat() {var dateTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;var fmt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yyyy-mm-dd';
  8721. // 如果为null,则格式化当前时间
  8722. if (!dateTime) dateTime = Number(new Date());
  8723. // 如果dateTime长度为10或者13,则为秒和毫秒的时间戳,如果超过13位,则为其他的时间格式
  8724. if (dateTime.toString().length == 10) dateTime *= 1000;
  8725. var date = new Date(dateTime);
  8726. var ret;
  8727. var opt = {
  8728. "y+": date.getFullYear().toString(), // 年
  8729. "m+": (date.getMonth() + 1).toString(), // 月
  8730. "d+": date.getDate().toString(), // 日
  8731. "h+": date.getHours().toString(), // 时
  8732. "M+": date.getMinutes().toString(), // 分
  8733. "s+": date.getSeconds().toString() // 秒
  8734. // 有其他格式化字符需求可以继续添加,必须转化成字符串
  8735. };
  8736. for (var k in opt) {
  8737. ret = new RegExp("(" + k + ")").exec(fmt);
  8738. if (ret) {
  8739. fmt = fmt.replace(ret[1], ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, "0"));
  8740. };
  8741. };
  8742. return fmt;
  8743. }var _default =
  8744. timeFormat;exports.default = _default;
  8745. /***/ }),
  8746. /* 23 */
  8747. /*!*************************************************************************************************!*\
  8748. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/libs/function/timeFrom.js ***!
  8749. \*************************************************************************************************/
  8750. /*! no static exports found */
  8751. /***/ (function(module, exports, __webpack_require__) {
  8752. "use strict";
  8753. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _timeFormat = _interopRequireDefault(__webpack_require__(/*! ../../libs/function/timeFormat.js */ 22));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
  8754. /**
  8755. * 时间戳转为多久之前
  8756. * @param String timestamp 时间戳
  8757. * @param String | Boolean format 如果为时间格式字符串,超出一定时间范围,返回固定的时间格式;
  8758. * 如果为布尔值false,无论什么时间,都返回多久以前的格式
  8759. */
  8760. function timeFrom() {var dateTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yyyy-mm-dd';
  8761. // 如果为null,则格式化当前时间
  8762. if (!dateTime) dateTime = Number(new Date());
  8763. // 如果dateTime长度为10或者13,则为秒和毫秒的时间戳,如果超过13位,则为其他的时间格式
  8764. if (dateTime.toString().length == 10) dateTime *= 1000;
  8765. var timestamp = +new Date(Number(dateTime));
  8766. var timer = (Number(new Date()) - timestamp) / 1000;
  8767. // 如果小于5分钟,则返回"刚刚",其他以此类推
  8768. var tips = '';
  8769. switch (true) {
  8770. case timer < 300:
  8771. tips = '刚刚';
  8772. break;
  8773. case timer >= 300 && timer < 3600:
  8774. tips = parseInt(timer / 60) + '分钟前';
  8775. break;
  8776. case timer >= 3600 && timer < 86400:
  8777. tips = parseInt(timer / 3600) + '小时前';
  8778. break;
  8779. case timer >= 86400 && timer < 2592000:
  8780. tips = parseInt(timer / 86400) + '天前';
  8781. break;
  8782. default:
  8783. // 如果format为false,则无论什么时间戳,都显示xx之前
  8784. if (format === false) {
  8785. if (timer >= 2592000 && timer < 365 * 86400) {
  8786. tips = parseInt(timer / (86400 * 30)) + '个月前';
  8787. } else {
  8788. tips = parseInt(timer / (86400 * 365)) + '年前';
  8789. }
  8790. } else {
  8791. tips = (0, _timeFormat.default)(timestamp, format);
  8792. }}
  8793. return tips;
  8794. }var _default =
  8795. timeFrom;exports.default = _default;
  8796. /***/ }),
  8797. /* 24 */
  8798. /*!******************************************************************************************************!*\
  8799. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/libs/function/colorGradient.js ***!
  8800. \******************************************************************************************************/
  8801. /*! no static exports found */
  8802. /***/ (function(module, exports, __webpack_require__) {
  8803. "use strict";
  8804. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; /**
  8805. * 求两个颜色之间的渐变值
  8806. * @param {string} startColor 开始的颜色
  8807. * @param {string} endColor 结束的颜色
  8808. * @param {number} step 颜色等分的份额
  8809. * */
  8810. function colorGradient() {var startColor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'rgb(0, 0, 0)';var endColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'rgb(255, 255, 255)';var step = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10;
  8811. var startRGB = hexToRgb(startColor, false); //转换为rgb数组模式
  8812. var startR = startRGB[0];
  8813. var startG = startRGB[1];
  8814. var startB = startRGB[2];
  8815. var endRGB = hexToRgb(endColor, false);
  8816. var endR = endRGB[0];
  8817. var endG = endRGB[1];
  8818. var endB = endRGB[2];
  8819. var sR = (endR - startR) / step; //总差值
  8820. var sG = (endG - startG) / step;
  8821. var sB = (endB - startB) / step;
  8822. var colorArr = [];
  8823. for (var i = 0; i < step; i++) {
  8824. //计算每一步的hex值
  8825. var hex = rgbToHex('rgb(' + Math.round(sR * i + startR) + ',' + Math.round(sG * i + startG) + ',' + Math.round(sB *
  8826. i + startB) + ')');
  8827. colorArr.push(hex);
  8828. }
  8829. return colorArr;
  8830. }
  8831. // 将hex表示方式转换为rgb表示方式(这里返回rgb数组模式)
  8832. function hexToRgb(sColor) {var str = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  8833. var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
  8834. sColor = sColor.toLowerCase();
  8835. if (sColor && reg.test(sColor)) {
  8836. if (sColor.length === 4) {
  8837. var sColorNew = "#";
  8838. for (var i = 1; i < 4; i += 1) {
  8839. sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));
  8840. }
  8841. sColor = sColorNew;
  8842. }
  8843. //处理六位的颜色值
  8844. var sColorChange = [];
  8845. for (var _i = 1; _i < 7; _i += 2) {
  8846. sColorChange.push(parseInt("0x" + sColor.slice(_i, _i + 2)));
  8847. }
  8848. if (!str) {
  8849. return sColorChange;
  8850. } else {
  8851. return "rgb(".concat(sColorChange[0], ",").concat(sColorChange[1], ",").concat(sColorChange[2], ")");
  8852. }
  8853. } else if (/^(rgb|RGB)/.test(sColor)) {
  8854. var arr = sColor.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(",");
  8855. return arr.map(function (val) {return Number(val);});
  8856. } else {
  8857. return sColor;
  8858. }
  8859. };
  8860. // 将rgb表示方式转换为hex表示方式
  8861. function rgbToHex(rgb) {
  8862. var _this = rgb;
  8863. var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
  8864. if (/^(rgb|RGB)/.test(_this)) {
  8865. var aColor = _this.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(",");
  8866. var strHex = "#";
  8867. for (var i = 0; i < aColor.length; i++) {
  8868. var hex = Number(aColor[i]).toString(16);
  8869. hex = String(hex).length == 1 ? 0 + '' + hex : hex; // 保证每个rgb的值为2位
  8870. if (hex === "0") {
  8871. hex += hex;
  8872. }
  8873. strHex += hex;
  8874. }
  8875. if (strHex.length !== 7) {
  8876. strHex = _this;
  8877. }
  8878. return strHex;
  8879. } else if (reg.test(_this)) {
  8880. var aNum = _this.replace(/#/, "").split("");
  8881. if (aNum.length === 6) {
  8882. return _this;
  8883. } else if (aNum.length === 3) {
  8884. var numHex = "#";
  8885. for (var _i2 = 0; _i2 < aNum.length; _i2 += 1) {
  8886. numHex += aNum[_i2] + aNum[_i2];
  8887. }
  8888. return numHex;
  8889. }
  8890. } else {
  8891. return _this;
  8892. }
  8893. }
  8894. /**
  8895. * JS颜色十六进制转换为rgb或rgba,返回的格式为 rgba(255,255,255,0.5)字符串
  8896. * sHex为传入的十六进制的色值
  8897. * alpha为rgba的透明度
  8898. */
  8899. function colorToRgba(color) {var alpha = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.3;
  8900. color = rgbToHex(color);
  8901. // 十六进制颜色值的正则表达式
  8902. var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
  8903. /* 16进制颜色转为RGB格式 */
  8904. var sColor = color.toLowerCase();
  8905. if (sColor && reg.test(sColor)) {
  8906. if (sColor.length === 4) {
  8907. var sColorNew = '#';
  8908. for (var i = 1; i < 4; i += 1) {
  8909. sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));
  8910. }
  8911. sColor = sColorNew;
  8912. }
  8913. // 处理六位的颜色值
  8914. var sColorChange = [];
  8915. for (var _i3 = 1; _i3 < 7; _i3 += 2) {
  8916. sColorChange.push(parseInt('0x' + sColor.slice(_i3, _i3 + 2)));
  8917. }
  8918. // return sColorChange.join(',')
  8919. return 'rgba(' + sColorChange.join(',') + ',' + alpha + ')';
  8920. } else
  8921. {
  8922. return sColor;
  8923. }
  8924. }var _default =
  8925. {
  8926. colorGradient: colorGradient,
  8927. hexToRgb: hexToRgb,
  8928. rgbToHex: rgbToHex,
  8929. colorToRgba: colorToRgba };exports.default = _default;
  8930. /***/ }),
  8931. /* 25 */
  8932. /*!*********************************************************************************************!*\
  8933. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/libs/function/guid.js ***!
  8934. \*********************************************************************************************/
  8935. /*! no static exports found */
  8936. /***/ (function(module, exports, __webpack_require__) {
  8937. "use strict";
  8938. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; /**
  8939. * 本算法来源于简书开源代码,详见:https://www.jianshu.com/p/fdbf293d0a85
  8940. * 全局唯一标识符(uuid,Globally Unique Identifier),也称作 uuid(Universally Unique IDentifier)
  8941. * 一般用于多个组件之间,给它一个唯一的标识符,或者v-for循环的时候,如果使用数组的index可能会导致更新列表出现问题
  8942. * 最可能的情况是左滑删除item或者对某条信息流"不喜欢"并去掉它的时候,会导致组件内的数据可能出现错乱
  8943. * v-for的时候,推荐使用后端返回的id而不是循环的index
  8944. * @param {Number} len uuid的长度
  8945. * @param {Boolean} firstU 将返回的首字母置为"u"
  8946. * @param {Nubmer} radix 生成uuid的基数(意味着返回的字符串都是这个基数),2-二进制,8-八进制,10-十进制,16-十六进制
  8947. */
  8948. function guid() {var len = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 32;var firstU = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;var radix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  8949. var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
  8950. var uuid = [];
  8951. radix = radix || chars.length;
  8952. if (len) {
  8953. // 如果指定uuid长度,只是取随机的字符,0|x为位运算,能去掉x的小数位,返回整数位
  8954. for (var i = 0; i < len; i++) {uuid[i] = chars[0 | Math.random() * radix];}
  8955. } else {
  8956. var r;
  8957. // rfc4122标准要求返回的uuid中,某些位为固定的字符
  8958. uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
  8959. uuid[14] = '4';
  8960. for (var _i = 0; _i < 36; _i++) {
  8961. if (!uuid[_i]) {
  8962. r = 0 | Math.random() * 16;
  8963. uuid[_i] = chars[_i == 19 ? r & 0x3 | 0x8 : r];
  8964. }
  8965. }
  8966. }
  8967. // 移除第一个字符,并用u替代,因为第一个字符为数值时,该guuid不能用作id或者class
  8968. if (firstU) {
  8969. uuid.shift();
  8970. return 'u' + uuid.join('');
  8971. } else {
  8972. return uuid.join('');
  8973. }
  8974. }var _default =
  8975. guid;exports.default = _default;
  8976. /***/ }),
  8977. /* 26 */
  8978. /*!**********************************************************************************************!*\
  8979. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/libs/function/color.js ***!
  8980. \**********************************************************************************************/
  8981. /*! no static exports found */
  8982. /***/ (function(module, exports, __webpack_require__) {
  8983. "use strict";
  8984. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; // 为了让用户能够自定义主题,会逐步弃用此文件,各颜色通过css提供
  8985. // 为了给某些特殊场景使用和向后兼容,无需删除此文件(2020-06-20)
  8986. var color = {
  8987. primary: "#2979ff",
  8988. primaryDark: "#2b85e4",
  8989. primaryDisabled: "#a0cfff",
  8990. primaryLight: "#ecf5ff",
  8991. bgColor: "#f3f4f6",
  8992. info: "#909399",
  8993. infoDark: "#82848a",
  8994. infoDisabled: "#c8c9cc",
  8995. infoLight: "#f4f4f5",
  8996. warning: "#ff9900",
  8997. warningDark: "#f29100",
  8998. warningDisabled: "#fcbd71",
  8999. warningLight: "#fdf6ec",
  9000. error: "#fa3534",
  9001. errorDark: "#dd6161",
  9002. errorDisabled: "#fab6b6",
  9003. errorLight: "#fef0f0",
  9004. success: "#19be6b",
  9005. successDark: "#18b566",
  9006. successDisabled: "#71d5a1",
  9007. successLight: "#dbf1e1",
  9008. mainColor: "#303133",
  9009. contentColor: "#606266",
  9010. tipsColor: "#909399",
  9011. lightColor: "#c0c4cc",
  9012. borderColor: "#e4e7ed" };var _default =
  9013. color;exports.default = _default;
  9014. /***/ }),
  9015. /* 27 */
  9016. /*!**************************************************************************************************!*\
  9017. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/libs/function/type2icon.js ***!
  9018. \**************************************************************************************************/
  9019. /*! no static exports found */
  9020. /***/ (function(module, exports, __webpack_require__) {
  9021. "use strict";
  9022. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; /**
  9023. * 根据主题type值,获取对应的图标
  9024. * @param String type 主题名称,primary|info|error|warning|success
  9025. * @param String fill 是否使用fill填充实体的图标
  9026. */
  9027. function type2icon() {var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'success';var fill = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  9028. // 如果非预置值,默认为success
  9029. if (['primary', 'info', 'error', 'warning', 'success'].indexOf(type) == -1) type = 'success';
  9030. var iconName = '';
  9031. // 目前(2019-12-12),info和primary使用同一个图标
  9032. switch (type) {
  9033. case 'primary':
  9034. iconName = 'info-circle';
  9035. break;
  9036. case 'info':
  9037. iconName = 'info-circle';
  9038. break;
  9039. case 'error':
  9040. iconName = 'close-circle';
  9041. break;
  9042. case 'warning':
  9043. iconName = 'error-circle';
  9044. break;
  9045. case 'success':
  9046. iconName = 'checkmark-circle';
  9047. break;
  9048. default:
  9049. iconName = 'checkmark-circle';}
  9050. // 是否是实体类型,加上-fill,在icon组件库中,实体的类名是后面加-fill的
  9051. if (fill) iconName += '-fill';
  9052. return iconName;
  9053. }var _default =
  9054. type2icon;exports.default = _default;
  9055. /***/ }),
  9056. /* 28 */
  9057. /*!****************************************************************************************************!*\
  9058. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/libs/function/randomArray.js ***!
  9059. \****************************************************************************************************/
  9060. /*! no static exports found */
  9061. /***/ (function(module, exports, __webpack_require__) {
  9062. "use strict";
  9063. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; // 打乱数组
  9064. function randomArray() {var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  9065. // 原理是sort排序,Math.random()产生0<= x < 1之间的数,会导致x-0.05大于或者小于0
  9066. return array.sort(function () {return Math.random() - 0.5;});
  9067. }var _default =
  9068. randomArray;exports.default = _default;
  9069. /***/ }),
  9070. /* 29 */
  9071. /*!************************************************************************************************!*\
  9072. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/libs/function/addUnit.js ***!
  9073. \************************************************************************************************/
  9074. /*! no static exports found */
  9075. /***/ (function(module, exports, __webpack_require__) {
  9076. "use strict";
  9077. Object.defineProperty(exports, "__esModule", { value: true });exports.default = addUnit;var _test = _interopRequireDefault(__webpack_require__(/*! ./test.js */ 16));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
  9078. // 添加单位,如果有rpx,%,px等单位结尾或者值为auto,直接返回,否则加上rpx单位结尾
  9079. function addUnit() {var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'auto';var unit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'rpx';
  9080. value = String(value);
  9081. // 用uView内置验证规则中的number判断是否为数值
  9082. return _test.default.number(value) ? "".concat(value).concat(unit) : value;
  9083. }
  9084. /***/ }),
  9085. /* 30 */
  9086. /*!***********************************************************************************************!*\
  9087. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/libs/function/random.js ***!
  9088. \***********************************************************************************************/
  9089. /*! no static exports found */
  9090. /***/ (function(module, exports, __webpack_require__) {
  9091. "use strict";
  9092. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;function random(min, max) {
  9093. if (min >= 0 && max > 0 && max >= min) {
  9094. var gab = max - min + 1;
  9095. return Math.floor(Math.random() * gab + min);
  9096. } else {
  9097. return 0;
  9098. }
  9099. }var _default =
  9100. random;exports.default = _default;
  9101. /***/ }),
  9102. /* 31 */
  9103. /*!*********************************************************************************************!*\
  9104. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/libs/function/trim.js ***!
  9105. \*********************************************************************************************/
  9106. /*! no static exports found */
  9107. /***/ (function(module, exports, __webpack_require__) {
  9108. "use strict";
  9109. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;function trim(str) {var pos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'both';
  9110. if (pos == 'both') {
  9111. return str.replace(/^\s+|\s+$/g, "");
  9112. } else if (pos == "left") {
  9113. return str.replace(/^\s*/, '');
  9114. } else if (pos == 'right') {
  9115. return str.replace(/(\s*$)/g, "");
  9116. } else if (pos == 'all') {
  9117. return str.replace(/\s+/g, "");
  9118. } else {
  9119. return str;
  9120. }
  9121. }var _default =
  9122. trim;exports.default = _default;
  9123. /***/ }),
  9124. /* 32 */
  9125. /*!**********************************************************************************************!*\
  9126. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/libs/function/toast.js ***!
  9127. \**********************************************************************************************/
  9128. /*! no static exports found */
  9129. /***/ (function(module, exports, __webpack_require__) {
  9130. "use strict";
  9131. /* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;function toast(title) {var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1500;
  9132. uni.showToast({
  9133. title: title,
  9134. icon: 'none',
  9135. duration: duration });
  9136. }var _default =
  9137. toast;exports.default = _default;
  9138. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  9139. /***/ }),
  9140. /* 33 */
  9141. /*!**************************************************************************************************!*\
  9142. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/libs/function/getParent.js ***!
  9143. \**************************************************************************************************/
  9144. /*! no static exports found */
  9145. /***/ (function(module, exports, __webpack_require__) {
  9146. "use strict";
  9147. Object.defineProperty(exports, "__esModule", { value: true });exports.default = getParent; // 获取父组件的参数,因为支付宝小程序不支持provide/inject的写法
  9148. // this.$parent在非H5中,可以准确获取到父组件,但是在H5中,需要多次this.$parent.$parent.xxx
  9149. function getParent(name, keys) {
  9150. var parent = this.$parent;
  9151. // 通过while历遍,这里主要是为了H5需要多层解析的问题
  9152. while (parent) {
  9153. // 父组件
  9154. if (parent.$options.name !== name) {
  9155. // 如果组件的name不相等,继续上一级寻找
  9156. parent = parent.$parent;
  9157. } else {var _ret = function () {
  9158. var data = {};
  9159. // 判断keys是否数组,如果传过来的是一个数组,那么直接使用数组元素值当做键值去父组件寻找
  9160. if (Array.isArray(keys)) {
  9161. keys.map(function (val) {
  9162. data[val] = parent[val] ? parent[val] : '';
  9163. });
  9164. } else {
  9165. // 历遍传过来的对象参数
  9166. for (var i in keys) {
  9167. // 如果子组件有此值则用,无此值则用父组件的值
  9168. // 判断是否空数组,如果是,则用父组件的值,否则用子组件的值
  9169. if (Array.isArray(keys[i])) {
  9170. if (keys[i].length) {
  9171. data[i] = keys[i];
  9172. } else {
  9173. data[i] = parent[i];
  9174. }
  9175. } else if (keys[i].constructor === Object) {
  9176. // 判断是否对象,如果是对象,且有属性,那么使用子组件的值,否则使用父组件的值
  9177. if (Object.keys(keys[i]).length) {
  9178. data[i] = keys[i];
  9179. } else {
  9180. data[i] = parent[i];
  9181. }
  9182. } else {
  9183. // 只要子组件有传值,即使是false值,也是“传值”了,也需要覆盖父组件的同名参数
  9184. data[i] = keys[i] || keys[i] === false ? keys[i] : parent[i];
  9185. }
  9186. }
  9187. }
  9188. return { v: data };}();if (typeof _ret === "object") return _ret.v;
  9189. }
  9190. }
  9191. return {};
  9192. }
  9193. /***/ }),
  9194. /* 34 */
  9195. /*!************************************************************************************************!*\
  9196. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/libs/function/$parent.js ***!
  9197. \************************************************************************************************/
  9198. /*! no static exports found */
  9199. /***/ (function(module, exports, __webpack_require__) {
  9200. "use strict";
  9201. Object.defineProperty(exports, "__esModule", { value: true });exports.default = $parent; // 获取父组件的参数,因为支付宝小程序不支持provide/inject的写法
  9202. // this.$parent在非H5中,可以准确获取到父组件,但是在H5中,需要多次this.$parent.$parent.xxx
  9203. // 这里默认值等于undefined有它的含义,因为最顶层元素(组件)的$parent就是undefined,意味着不传name
  9204. // 值(默认为undefined),就是查找最顶层的$parent
  9205. function $parent() {var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
  9206. var parent = this.$parent;
  9207. // 通过while历遍,这里主要是为了H5需要多层解析的问题
  9208. while (parent) {
  9209. // 父组件
  9210. if (parent.$options && parent.$options.name !== name) {
  9211. // 如果组件的name不相等,继续上一级寻找
  9212. parent = parent.$parent;
  9213. } else {
  9214. return parent;
  9215. }
  9216. }
  9217. return false;
  9218. }
  9219. /***/ }),
  9220. /* 35 */
  9221. /*!********************************************************************************************!*\
  9222. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/libs/function/sys.js ***!
  9223. \********************************************************************************************/
  9224. /*! no static exports found */
  9225. /***/ (function(module, exports, __webpack_require__) {
  9226. "use strict";
  9227. /* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.os = os;exports.sys = sys;function os() {
  9228. return uni.getSystemInfoSync().platform;
  9229. };
  9230. function sys() {
  9231. return uni.getSystemInfoSync();
  9232. }
  9233. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  9234. /***/ }),
  9235. /* 36 */
  9236. /*!*************************************************************************************************!*\
  9237. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/libs/function/debounce.js ***!
  9238. \*************************************************************************************************/
  9239. /*! no static exports found */
  9240. /***/ (function(module, exports, __webpack_require__) {
  9241. "use strict";
  9242. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var timeout = null;
  9243. /**
  9244. * 防抖原理:一定时间内,只有最后一次操作,再过wait毫秒后才执行函数
  9245. *
  9246. * @param {Function} func 要执行的回调函数
  9247. * @param {Number} wait 延时的时间
  9248. * @param {Boolean} immediate 是否立即执行
  9249. * @return null
  9250. */
  9251. function debounce(func) {var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;var immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  9252. // 清除定时器
  9253. if (timeout !== null) clearTimeout(timeout);
  9254. // 立即执行,此类情况一般用不到
  9255. if (immediate) {
  9256. var callNow = !timeout;
  9257. timeout = setTimeout(function () {
  9258. timeout = null;
  9259. }, wait);
  9260. if (callNow) typeof func === 'function' && func();
  9261. } else {
  9262. // 设置定时器,当最后一次操作后,timeout不会再被清除,所以在延时wait毫秒后执行func回调方法
  9263. timeout = setTimeout(function () {
  9264. typeof func === 'function' && func();
  9265. }, wait);
  9266. }
  9267. }var _default =
  9268. debounce;exports.default = _default;
  9269. /***/ }),
  9270. /* 37 */
  9271. /*!*************************************************************************************************!*\
  9272. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/libs/function/throttle.js ***!
  9273. \*************************************************************************************************/
  9274. /*! no static exports found */
  9275. /***/ (function(module, exports, __webpack_require__) {
  9276. "use strict";
  9277. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var timer, flag;
  9278. /**
  9279. * 节流原理:在一定时间内,只能触发一次
  9280. *
  9281. * @param {Function} func 要执行的回调函数
  9282. * @param {Number} wait 延时的时间
  9283. * @param {Boolean} immediate 是否立即执行
  9284. * @return null
  9285. */
  9286. function throttle(func) {var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;var immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  9287. if (immediate) {
  9288. if (!flag) {
  9289. flag = true;
  9290. // 如果是立即执行,则在wait毫秒内开始时执行
  9291. typeof func === 'function' && func();
  9292. timer = setTimeout(function () {
  9293. flag = false;
  9294. }, wait);
  9295. }
  9296. } else {
  9297. if (!flag) {
  9298. flag = true;
  9299. // 如果是非立即执行,则在wait毫秒内的结束处执行
  9300. timer = setTimeout(function () {
  9301. flag = false;
  9302. typeof func === 'function' && func();
  9303. }, wait);
  9304. }
  9305. }
  9306. };var _default =
  9307. throttle;exports.default = _default;
  9308. /***/ }),
  9309. /* 38 */
  9310. /*!*********************************************************************************************!*\
  9311. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/libs/config/config.js ***!
  9312. \*********************************************************************************************/
  9313. /*! no static exports found */
  9314. /***/ (function(module, exports, __webpack_require__) {
  9315. "use strict";
  9316. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; // 此版本发布于2020-03-17
  9317. var version = '1.8.4';var _default =
  9318. {
  9319. v: version,
  9320. version: version,
  9321. // 主题名称
  9322. type: [
  9323. 'primary',
  9324. 'success',
  9325. 'info',
  9326. 'error',
  9327. 'warning'] };exports.default = _default;
  9328. /***/ }),
  9329. /* 39 */
  9330. /*!*********************************************************************************************!*\
  9331. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uview-ui/libs/config/zIndex.js ***!
  9332. \*********************************************************************************************/
  9333. /*! no static exports found */
  9334. /***/ (function(module, exports, __webpack_require__) {
  9335. "use strict";
  9336. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; // uniapp在H5中各API的z-index值如下:
  9337. /**
  9338. * actionsheet: 999
  9339. * modal: 999
  9340. * navigate: 998
  9341. * tabbar: 998
  9342. * toast: 999
  9343. */var _default =
  9344. {
  9345. toast: 10090,
  9346. noNetwork: 10080,
  9347. // popup包含popup,actionsheet,keyboard,picker的值
  9348. popup: 10075,
  9349. mask: 10070,
  9350. navbar: 980,
  9351. topTips: 975,
  9352. sticky: 970,
  9353. indexListSticky: 965 };exports.default = _default;
  9354. /***/ }),
  9355. /* 40 */,
  9356. /* 41 */,
  9357. /* 42 */,
  9358. /* 43 */,
  9359. /* 44 */,
  9360. /* 45 */,
  9361. /* 46 */
  9362. /*!*************************************************************************!*\
  9363. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/api/api.js ***!
  9364. \*************************************************************************/
  9365. /*! no static exports found */
  9366. /***/ (function(module, exports, __webpack_require__) {
  9367. "use strict";
  9368. Object.defineProperty(exports, "__esModule", { value: true });exports.getHome = getHome;exports.getPond = getPond;exports.getOpenId = getOpenId;exports.getBanner = getBanner;exports.getSignList = getSignList;exports.setReClaim = setReClaim;exports.setDrawGain = setDrawGain;exports.getUrl = getUrl;exports.setReceive = setReceive;exports.config = void 0;var _regenerator = _interopRequireDefault(__webpack_require__(/*! ./node_modules/@babel/runtime/regenerator */ 19));var _request = __webpack_require__(/*! @/utils/request */ 47);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {try {var info = gen[key](arg);var value = info.value;} catch (error) {reject(error);return;}if (info.done) {resolve(value);} else {Promise.resolve(value).then(_next, _throw);}}function _asyncToGenerator(fn) {return function () {var self = this,args = arguments;return new Promise(function (resolve, reject) {var gen = fn.apply(self, args);function _next(value) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);}function _throw(err) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);}_next(undefined);});};}
  9369. /**
  9370. * 大转盘小程序
  9371. * wx021e792baf529aff 好运赢书券
  9372. * wxe1b04d1d8f6df382 书币礼包送不停(转盘抽奖)
  9373. * wx4e8c3f946c06c519 书币礼包领不停(转盘抽奖)
  9374. */
  9375. var config = {
  9376. appid: 'wx4e8c3f946c06c519' };exports.config = config;function
  9377. getHome(_x) {return _getHome.apply(this, arguments);}
  9378. // 获取公众号将此
  9379. function _getHome() {_getHome = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee(data) {return _regenerator.default.wrap(function _callee$(_context) {while (1) {switch (_context.prev = _context.next) {case 0:return _context.abrupt("return", (0, _request.request)({ url: "/luck/draw/home", data: data }));case 1:case "end":return _context.stop();}}}, _callee);}));return _getHome.apply(this, arguments);}function getPond(_x2) {return _getPond.apply(this, arguments);}
  9380. // 获取openId
  9381. function _getPond() {_getPond = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee2(data) {return _regenerator.default.wrap(function _callee2$(_context2) {while (1) {switch (_context2.prev = _context2.next) {case 0:return _context2.abrupt("return", (0, _request.request)({ url: "/luck/draw/prize/pond", data: data }));case 1:case "end":return _context2.stop();}}}, _callee2);}));return _getPond.apply(this, arguments);}function getOpenId(_x3) {return _getOpenId.apply(this, arguments);}
  9382. // 获取轮播消息
  9383. function _getOpenId() {_getOpenId = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee3(data) {return _regenerator.default.wrap(function _callee3$(_context3) {while (1) {switch (_context3.prev = _context3.next) {case 0:return _context3.abrupt("return", (0, _request.request)({ url: "/applet/openId", data: data }));case 1:case "end":return _context3.stop();}}}, _callee3);}));return _getOpenId.apply(this, arguments);}function getBanner(_x4) {return _getBanner.apply(this, arguments);}
  9384. // 获取中奖记录列表
  9385. function _getBanner() {_getBanner = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee4(data) {return _regenerator.default.wrap(function _callee4$(_context4) {while (1) {switch (_context4.prev = _context4.next) {case 0:return _context4.abrupt("return", (0, _request.request)({ url: "/luck/draw/home/banner", data: data }));case 1:case "end":return _context4.stop();}}}, _callee4);}));return _getBanner.apply(this, arguments);}function getSignList(_x5) {return _getSignList.apply(this, arguments);}
  9386. // 书币充值失败重新领取
  9387. function _getSignList() {_getSignList = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee5(data) {return _regenerator.default.wrap(function _callee5$(_context5) {while (1) {switch (_context5.prev = _context5.next) {case 0:return _context5.abrupt("return", (0, _request.request)({ url: "/luck/draw/record", data: data }));case 1:case "end":return _context5.stop();}}}, _callee5);}));return _getSignList.apply(this, arguments);}function setReClaim(_x6) {return _setReClaim.apply(this, arguments);}
  9388. // 抽奖
  9389. function _setReClaim() {_setReClaim = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee6(data) {return _regenerator.default.wrap(function _callee6$(_context6) {while (1) {switch (_context6.prev = _context6.next) {case 0:return _context6.abrupt("return", (0, _request.request)({ url: "/luck/draw/reClaim", data: data }));case 1:case "end":return _context6.stop();}}}, _callee6);}));return _setReClaim.apply(this, arguments);}function setDrawGain(_x7) {return _setDrawGain.apply(this, arguments);}
  9390. // 获取公众号文章
  9391. function _setDrawGain() {_setDrawGain = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee7(data) {return _regenerator.default.wrap(function _callee7$(_context7) {while (1) {switch (_context7.prev = _context7.next) {case 0:return _context7.abrupt("return", (0, _request.request)({ url: "/luck/draw/gain", data: data }));case 1:case "end":return _context7.stop();}}}, _callee7);}));return _setDrawGain.apply(this, arguments);}function getUrl(_x8) {return _getUrl.apply(this, arguments);}
  9392. // 头两次领取
  9393. function _getUrl() {_getUrl = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee8(data) {return _regenerator.default.wrap(function _callee8$(_context8) {while (1) {switch (_context8.prev = _context8.next) {case 0:return _context8.abrupt("return", (0, _request.request)({ url: "/applet/mp/url", data: data }));case 1:case "end":return _context8.stop();}}}, _callee8);}));return _getUrl.apply(this, arguments);}function setReceive(_x9) {return _setReceive.apply(this, arguments);}function _setReceive() {_setReceive = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee9(data) {return _regenerator.default.wrap(function _callee9$(_context9) {while (1) {switch (_context9.prev = _context9.next) {case 0:return _context9.abrupt("return",
  9394. (0, _request.request)({ url: "/luck/draw/gain/receive", data: data }));case 1:case "end":return _context9.stop();}}}, _callee9);}));return _setReceive.apply(this, arguments);}
  9395. /***/ }),
  9396. /* 47 */
  9397. /*!*******************************************************************************!*\
  9398. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/utils/request.js ***!
  9399. \*******************************************************************************/
  9400. /*! no static exports found */
  9401. /***/ (function(module, exports, __webpack_require__) {
  9402. "use strict";
  9403. /* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.request = request; // let apiUrl = 'https://test.api.zanxiangnet.com/miniapp'
  9404. var apiUrl = 'https://api.zanxiangnet.com/miniapp';
  9405. var isopen = false; // 控制loading
  9406. var openLoading = function openLoading() {
  9407. if (!isopen) {
  9408. isopen = true;
  9409. uni.showLoading({
  9410. title: '加载中' });
  9411. }
  9412. };
  9413. var hiddenLoading = function hiddenLoading() {
  9414. isopen = false;
  9415. uni.hideLoading();
  9416. };
  9417. function request(props) {var
  9418. url =
  9419. props.url,data = props.data,config = props.config,method = props.method,_props$backspace = props.backspace,backspace = _props$backspace === void 0 ? false : _props$backspace,_props$isLoading = props.isLoading,isLoading = _props$isLoading === void 0 ? true : _props$isLoading,_props$isToast = props.isToast,isToast = _props$isToast === void 0 ? true : _props$isToast;
  9420. var _loading = false;
  9421. var reqTimer = null;
  9422. if (isLoading) {
  9423. reqTimer = setTimeout(function () {
  9424. openLoading();
  9425. _loading = true;
  9426. }, 500);
  9427. }
  9428. return new Promise(function (resolve, reject) {
  9429. uni.request({
  9430. url: "".concat(apiUrl).concat(url),
  9431. data: data,
  9432. method: method || 'GET',
  9433. success: function success(res) {
  9434. console.log("请求返回数据---》", res);
  9435. reqTimer && clearTimeout(reqTimer);
  9436. if (_loading) {
  9437. hiddenLoading();
  9438. }
  9439. if (res.data.code === 500) {
  9440. uni.showToast({
  9441. title: res.data.msg || "".concat(apiUrl).concat(url, "\u8BF7\u6C42\u9519\u8BEF"),
  9442. icon: 'none',
  9443. duration: 2000 });
  9444. return;
  9445. }
  9446. resolve(res.data);
  9447. },
  9448. fail: function fail(err) {
  9449. reqTimer && clearTimeout(reqTimer);
  9450. if (_loading) {
  9451. hiddenLoading();
  9452. }
  9453. reject("".concat(url, "\u63A5\u53E3\u8C03\u7528\u5931\u8D25").concat(err));
  9454. } });
  9455. });
  9456. }
  9457. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  9458. /***/ }),
  9459. /* 48 */
  9460. /*!***************************************************************************************************************!*\
  9461. !*** C:/Users/77876/Documents/HBuilderProjects/qc-luckyDraw/uni_modules/almost-lottery/utils/almost-utils.js ***!
  9462. \***************************************************************************************************************/
  9463. /*! no static exports found */
  9464. /***/ (function(module, exports, __webpack_require__) {
  9465. "use strict";
  9466. /* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.base64ToPath = exports.pathToBase64 = exports.clearCacheFile = exports.downloadFile = exports.clacTextLen = exports.clearStore = exports.getStore = exports.setStore = void 0; /**
  9467. * 存储 localStorage 数据
  9468. * @param {String} name - 缓存数据的标识
  9469. * @param {any} content - 缓存的数据内容
  9470. */
  9471. var setStore = function setStore(name, content) {
  9472. if (!name) return;
  9473. if (typeof content !== 'string') {
  9474. content = JSON.stringify(content);
  9475. }
  9476. uni.setStorageSync(name, content);
  9477. };
  9478. /**
  9479. * 获取 localStorage 数据
  9480. * @param {String} name - 缓存数据的标识
  9481. */exports.setStore = setStore;
  9482. var getStore = function getStore(name) {
  9483. if (!name) return;
  9484. return uni.getStorageSync(name);
  9485. };
  9486. /**
  9487. * 清除 localStorage 数据
  9488. * @param {String} name - 缓存数据的标识
  9489. */exports.getStore = getStore;
  9490. var clearStore = function clearStore(name) {
  9491. if (name) {
  9492. uni.removeStorageSync(name);
  9493. } else {
  9494. console.log('清理本地全部缓存');
  9495. uni.clearStorageSync();
  9496. }
  9497. };
  9498. /**
  9499. * 计算文本的长度
  9500. * @param {String} text - 文本内容
  9501. */exports.clearStore = clearStore;
  9502. var clacTextLen = function clacTextLen(text) {
  9503. if (!text) return { byteLen: 0, realLen: 0 };
  9504. text += '';
  9505. var clacLen = 0;
  9506. for (var i = 0; i < text.length; i++) {
  9507. if (text.charCodeAt(i) < 0 || text.charCodeAt(i) > 255) {
  9508. clacLen += 2;
  9509. } else {
  9510. clacLen += 1;
  9511. }
  9512. }
  9513. // console.log(`当前文本 ${text} 的长度为 ${clacLen / 2}`)
  9514. return {
  9515. byteLen: clacLen,
  9516. realLen: clacLen / 2 };
  9517. };
  9518. /**
  9519. * 下载文件,并返回临时路径
  9520. * @return {String} 临时路径
  9521. * @param {String} fileUrl - 网络地址
  9522. */exports.clacTextLen = clacTextLen;
  9523. var downloadFile = function downloadFile(fileUrl) {
  9524. return new Promise(function (resolve) {
  9525. uni.downloadFile({
  9526. url: fileUrl,
  9527. success: function success(res) {
  9528. if (res.statusCode === 200) {
  9529. resolve({
  9530. ok: true,
  9531. data: res.errMsg,
  9532. tempFilePath: res.tempFilePath });
  9533. } else {
  9534. resolve({
  9535. ok: false,
  9536. data: res.errMsg,
  9537. msg: '图片下载失败' });
  9538. }
  9539. },
  9540. fail: function fail(err) {
  9541. resolve({
  9542. ok: false,
  9543. data: err.errMsg,
  9544. msg: '图片下载失败' });
  9545. } });
  9546. });
  9547. };
  9548. /**
  9549. * 清理应用已缓存的文件
  9550. */exports.downloadFile = downloadFile;
  9551. var clearCacheFile = function clearCacheFile() {
  9552. uni.getSavedFileList({
  9553. success: function success(res) {
  9554. var fileList = res.fileList;
  9555. if (fileList.length) {
  9556. for (var i = 0; i < fileList.length; i++) {
  9557. uni.removeSavedFile({
  9558. filePath: fileList[i].filePath,
  9559. complete: function complete() {
  9560. console.log('清除缓存已完成');
  9561. } });
  9562. }
  9563. }
  9564. },
  9565. fail: function fail(err) {
  9566. console.log('getSavedFileList Fail');
  9567. } });
  9568. };
  9569. // 图像转换工具,可用于图像和base64的转换
  9570. // https://ext.dcloud.net.cn/plugin?id=123
  9571. exports.clearCacheFile = clearCacheFile;var getLocalFilePath = function getLocalFilePath(path) {
  9572. if (
  9573. path.indexOf('_www') === 0 ||
  9574. path.indexOf('_doc') === 0 ||
  9575. path.indexOf('_documents') === 0 ||
  9576. path.indexOf('_downloads') === 0)
  9577. return path;
  9578. if (path.indexOf('/storage/emulated/0/') === 0) return path;
  9579. if (path.indexOf('/storage/sdcard0/') === 0) return path;
  9580. if (path.indexOf('/var/mobile/') === 0) return path;
  9581. if (path.indexOf('file://') === 0) return path;
  9582. if (path.indexOf('/') === 0) {
  9583. // ios 无法获取本地路径
  9584. var localFilePath = plus.os.name === 'iOS' ? path : plus.io.convertLocalFileSystemURL(path);
  9585. if (localFilePath !== path) {
  9586. return localFilePath;
  9587. } else {
  9588. path = path.substring(1);
  9589. }
  9590. }
  9591. return '_www/' + path;
  9592. };
  9593. var pathToBase64 = function pathToBase64(path) {
  9594. return new Promise(function (resolve, reject) {
  9595. if (typeof window === 'object' && 'document' in window) {
  9596. if (typeof FileReader === 'function') {
  9597. var xhr = new XMLHttpRequest();
  9598. xhr.open('GET', path, true);
  9599. xhr.responseType = 'blob';
  9600. xhr.onload = function () {
  9601. if (this.status === 200) {
  9602. var fileReader = new FileReader();
  9603. fileReader.onload = function (e) {
  9604. resolve(e.target.result);
  9605. };
  9606. fileReader.onerror = reject;
  9607. fileReader.readAsDataURL(this.response);
  9608. }
  9609. };
  9610. xhr.onerror = reject;
  9611. xhr.send();
  9612. return;
  9613. }
  9614. var canvas = document.createElement('canvas');
  9615. var c2x = canvas.getContext('2d');
  9616. var img = new Image();
  9617. img.onload = function () {
  9618. canvas.width = img.width;
  9619. canvas.height = img.height;
  9620. c2x.drawImage(img, 0, 0);
  9621. resolve(canvas.toDataURL());
  9622. canvas.height = canvas.width = 0;
  9623. };
  9624. img.onerror = reject;
  9625. img.src = path;
  9626. return;
  9627. }
  9628. if (typeof plus === 'object') {
  9629. var tempPath = getLocalFilePath(path);
  9630. plus.io.resolveLocalFileSystemURL(tempPath, function (entry) {
  9631. entry.file(function (file) {
  9632. var fileReader = new plus.io.FileReader();
  9633. fileReader.onload = function (data) {
  9634. resolve(data.target.result);
  9635. };
  9636. fileReader.onerror = function (error) {
  9637. console.log(error);
  9638. reject(error);
  9639. };
  9640. fileReader.readAsDataURL(file);
  9641. }, function (error) {
  9642. reject(error);
  9643. });
  9644. }, function (error) {
  9645. reject(error);
  9646. });
  9647. return;
  9648. }
  9649. if (typeof wx === 'object' && wx.canIUse('getFileSystemManager')) {
  9650. wx.getFileSystemManager().readFile({
  9651. filePath: path,
  9652. encoding: 'base64',
  9653. success: function success(res) {
  9654. resolve('data:image/png;base64,' + res.data);
  9655. },
  9656. fail: function fail(error) {
  9657. reject(error);
  9658. } });
  9659. return;
  9660. }
  9661. reject(new Error('not support'));
  9662. });
  9663. };exports.pathToBase64 = pathToBase64;
  9664. var base64ToPath = function base64ToPath(base64) {
  9665. return new Promise(function (resolve, reject) {
  9666. if (typeof window === 'object' && 'document' in window) {
  9667. base64 = base64.split(',');
  9668. var type = base64[0].match(/:(.*?);/)[1];
  9669. var str = atob(base64[1]);
  9670. var n = str.length;
  9671. var array = new Uint8Array(n);
  9672. while (n--) {
  9673. array[n] = str.charCodeAt(n);
  9674. }
  9675. return resolve((window.URL || window.webkitURL).createObjectURL(new Blob([array], {
  9676. type: type })));
  9677. }
  9678. var extName = base64.match(/data\:\S+\/(\S+);/);
  9679. if (extName) {
  9680. extName = extName[1];
  9681. } else {
  9682. reject(new Error('base64 error'));
  9683. }
  9684. var fileName = Date.now() + '.' + extName;
  9685. if (typeof plus === 'object') {
  9686. var bitmap = new plus.nativeObj.Bitmap('bitmap' + Date.now());
  9687. bitmap.loadBase64Data(base64, function () {
  9688. var filePath = '_doc/uniapp_temp/' + fileName;
  9689. bitmap.save(filePath, {}, function () {
  9690. bitmap.clear();
  9691. resolve(filePath);
  9692. }, function (error) {
  9693. bitmap.clear();
  9694. reject(error);
  9695. });
  9696. }, function (error) {
  9697. bitmap.clear();
  9698. reject(error);
  9699. });
  9700. return;
  9701. }
  9702. if (typeof wx === 'object' && wx.canIUse('getFileSystemManager')) {
  9703. var filePath = wx.env.USER_DATA_PATH + '/' + fileName;
  9704. wx.getFileSystemManager().writeFile({
  9705. filePath: filePath,
  9706. data: base64.replace(/^data:\S+\/\S+;base64,/, ''),
  9707. encoding: 'base64',
  9708. success: function success() {
  9709. resolve(filePath);
  9710. },
  9711. fail: function fail(error) {
  9712. reject(error);
  9713. } });
  9714. return;
  9715. }
  9716. reject(new Error('not support'));
  9717. });
  9718. };exports.base64ToPath = base64ToPath;
  9719. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  9720. /***/ })
  9721. ]]);
  9722. //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map