vendor.js 350 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021
  1. (global["webpackJsonp"] = global["webpackJsonp"] || []).push([["common/vendor"],[
  2. /* 0 */,
  3. /* 1 */
  4. /*!*********************************************************!*\
  5. !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js ***!
  6. \*********************************************************/
  7. /*! no static exports found */
  8. /***/ (function(module, exports, __webpack_require__) {
  9. "use strict";
  10. Object.defineProperty(exports, "__esModule", {
  11. value: true
  12. });
  13. exports.default = void 0;
  14. var objectKeys = ['qy', 'env', 'error', 'version', 'lanDebug', 'cloud', 'serviceMarket', 'router', 'worklet', '__webpack_require_UNI_MP_PLUGIN__'];
  15. var singlePageDisableKey = ['lanDebug', 'router', 'worklet'];
  16. var target = typeof globalThis !== 'undefined' ? globalThis : function () {
  17. return this;
  18. }();
  19. var key = ['w', 'x'].join('');
  20. var oldWx = target[key];
  21. var launchOption = oldWx.getLaunchOptionsSync ? oldWx.getLaunchOptionsSync() : null;
  22. function isWxKey(key) {
  23. if (launchOption && launchOption.scene === 1154 && singlePageDisableKey.includes(key)) {
  24. return false;
  25. }
  26. return objectKeys.indexOf(key) > -1 || typeof oldWx[key] === 'function';
  27. }
  28. function initWx() {
  29. var newWx = {};
  30. for (var _key in oldWx) {
  31. if (isWxKey(_key)) {
  32. // TODO wrapper function
  33. newWx[_key] = oldWx[_key];
  34. }
  35. }
  36. return newWx;
  37. }
  38. target[key] = initWx();
  39. var _default = target[key];
  40. exports.default = _default;
  41. /***/ }),
  42. /* 2 */
  43. /*!************************************************************!*\
  44. !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js ***!
  45. \************************************************************/
  46. /*! no static exports found */
  47. /***/ (function(module, exports, __webpack_require__) {
  48. "use strict";
  49. /* WEBPACK VAR INJECTION */(function(wx, global) {
  50. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  51. Object.defineProperty(exports, "__esModule", {
  52. value: true
  53. });
  54. exports.createApp = createApp;
  55. exports.createComponent = createComponent;
  56. exports.createPage = createPage;
  57. exports.createPlugin = createPlugin;
  58. exports.createSubpackageApp = createSubpackageApp;
  59. exports.default = void 0;
  60. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
  61. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  62. var _construct2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/construct */ 15));
  63. var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ 18));
  64. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  65. var _uniI18n = __webpack_require__(/*! @dcloudio/uni-i18n */ 22);
  66. var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 25));
  67. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  68. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  69. var realAtob;
  70. var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  71. var b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
  72. if (typeof atob !== 'function') {
  73. realAtob = function realAtob(str) {
  74. str = String(str).replace(/[\t\n\f\r ]+/g, '');
  75. if (!b64re.test(str)) {
  76. throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
  77. }
  78. // Adding the padding if missing, for semplicity
  79. str += '=='.slice(2 - (str.length & 3));
  80. var bitmap;
  81. var result = '';
  82. var r1;
  83. var r2;
  84. var i = 0;
  85. for (; i < str.length;) {
  86. bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 | (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++)));
  87. result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) : r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) : String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255);
  88. }
  89. return result;
  90. };
  91. } else {
  92. // 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法
  93. realAtob = atob;
  94. }
  95. function b64DecodeUnicode(str) {
  96. return decodeURIComponent(realAtob(str).split('').map(function (c) {
  97. return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
  98. }).join(''));
  99. }
  100. function getCurrentUserInfo() {
  101. var token = wx.getStorageSync('uni_id_token') || '';
  102. var tokenArr = token.split('.');
  103. if (!token || tokenArr.length !== 3) {
  104. return {
  105. uid: null,
  106. role: [],
  107. permission: [],
  108. tokenExpired: 0
  109. };
  110. }
  111. var userInfo;
  112. try {
  113. userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
  114. } catch (error) {
  115. throw new Error('获取当前用户信息出错,详细错误信息为:' + error.message);
  116. }
  117. userInfo.tokenExpired = userInfo.exp * 1000;
  118. delete userInfo.exp;
  119. delete userInfo.iat;
  120. return userInfo;
  121. }
  122. function uniIdMixin(Vue) {
  123. Vue.prototype.uniIDHasRole = function (roleId) {
  124. var _getCurrentUserInfo = getCurrentUserInfo(),
  125. role = _getCurrentUserInfo.role;
  126. return role.indexOf(roleId) > -1;
  127. };
  128. Vue.prototype.uniIDHasPermission = function (permissionId) {
  129. var _getCurrentUserInfo2 = getCurrentUserInfo(),
  130. permission = _getCurrentUserInfo2.permission;
  131. return this.uniIDHasRole('admin') || permission.indexOf(permissionId) > -1;
  132. };
  133. Vue.prototype.uniIDTokenValid = function () {
  134. var _getCurrentUserInfo3 = getCurrentUserInfo(),
  135. tokenExpired = _getCurrentUserInfo3.tokenExpired;
  136. return tokenExpired > Date.now();
  137. };
  138. }
  139. var _toString = Object.prototype.toString;
  140. var hasOwnProperty = Object.prototype.hasOwnProperty;
  141. function isFn(fn) {
  142. return typeof fn === 'function';
  143. }
  144. function isStr(str) {
  145. return typeof str === 'string';
  146. }
  147. function isObject(obj) {
  148. return obj !== null && (0, _typeof2.default)(obj) === 'object';
  149. }
  150. function isPlainObject(obj) {
  151. return _toString.call(obj) === '[object Object]';
  152. }
  153. function hasOwn(obj, key) {
  154. return hasOwnProperty.call(obj, key);
  155. }
  156. function noop() {}
  157. /**
  158. * Create a cached version of a pure function.
  159. */
  160. function cached(fn) {
  161. var cache = Object.create(null);
  162. return function cachedFn(str) {
  163. var hit = cache[str];
  164. return hit || (cache[str] = fn(str));
  165. };
  166. }
  167. /**
  168. * Camelize a hyphen-delimited string.
  169. */
  170. var camelizeRE = /-(\w)/g;
  171. var camelize = cached(function (str) {
  172. return str.replace(camelizeRE, function (_, c) {
  173. return c ? c.toUpperCase() : '';
  174. });
  175. });
  176. function sortObject(obj) {
  177. var sortObj = {};
  178. if (isPlainObject(obj)) {
  179. Object.keys(obj).sort().forEach(function (key) {
  180. sortObj[key] = obj[key];
  181. });
  182. }
  183. return !Object.keys(sortObj) ? obj : sortObj;
  184. }
  185. var HOOKS = ['invoke', 'success', 'fail', 'complete', 'returnValue'];
  186. var globalInterceptors = {};
  187. var scopedInterceptors = {};
  188. function mergeHook(parentVal, childVal) {
  189. var res = childVal ? parentVal ? parentVal.concat(childVal) : Array.isArray(childVal) ? childVal : [childVal] : parentVal;
  190. return res ? dedupeHooks(res) : res;
  191. }
  192. function dedupeHooks(hooks) {
  193. var res = [];
  194. for (var i = 0; i < hooks.length; i++) {
  195. if (res.indexOf(hooks[i]) === -1) {
  196. res.push(hooks[i]);
  197. }
  198. }
  199. return res;
  200. }
  201. function removeHook(hooks, hook) {
  202. var index = hooks.indexOf(hook);
  203. if (index !== -1) {
  204. hooks.splice(index, 1);
  205. }
  206. }
  207. function mergeInterceptorHook(interceptor, option) {
  208. Object.keys(option).forEach(function (hook) {
  209. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  210. interceptor[hook] = mergeHook(interceptor[hook], option[hook]);
  211. }
  212. });
  213. }
  214. function removeInterceptorHook(interceptor, option) {
  215. if (!interceptor || !option) {
  216. return;
  217. }
  218. Object.keys(option).forEach(function (hook) {
  219. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  220. removeHook(interceptor[hook], option[hook]);
  221. }
  222. });
  223. }
  224. function addInterceptor(method, option) {
  225. if (typeof method === 'string' && isPlainObject(option)) {
  226. mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), option);
  227. } else if (isPlainObject(method)) {
  228. mergeInterceptorHook(globalInterceptors, method);
  229. }
  230. }
  231. function removeInterceptor(method, option) {
  232. if (typeof method === 'string') {
  233. if (isPlainObject(option)) {
  234. removeInterceptorHook(scopedInterceptors[method], option);
  235. } else {
  236. delete scopedInterceptors[method];
  237. }
  238. } else if (isPlainObject(method)) {
  239. removeInterceptorHook(globalInterceptors, method);
  240. }
  241. }
  242. function wrapperHook(hook, params) {
  243. return function (data) {
  244. return hook(data, params) || data;
  245. };
  246. }
  247. function isPromise(obj) {
  248. return !!obj && ((0, _typeof2.default)(obj) === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
  249. }
  250. function queue(hooks, data, params) {
  251. var promise = false;
  252. for (var i = 0; i < hooks.length; i++) {
  253. var hook = hooks[i];
  254. if (promise) {
  255. promise = Promise.resolve(wrapperHook(hook, params));
  256. } else {
  257. var res = hook(data, params);
  258. if (isPromise(res)) {
  259. promise = Promise.resolve(res);
  260. }
  261. if (res === false) {
  262. return {
  263. then: function then() {}
  264. };
  265. }
  266. }
  267. }
  268. return promise || {
  269. then: function then(callback) {
  270. return callback(data);
  271. }
  272. };
  273. }
  274. function wrapperOptions(interceptor) {
  275. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  276. ['success', 'fail', 'complete'].forEach(function (name) {
  277. if (Array.isArray(interceptor[name])) {
  278. var oldCallback = options[name];
  279. options[name] = function callbackInterceptor(res) {
  280. queue(interceptor[name], res, options).then(function (res) {
  281. /* eslint-disable no-mixed-operators */
  282. return isFn(oldCallback) && oldCallback(res) || res;
  283. });
  284. };
  285. }
  286. });
  287. return options;
  288. }
  289. function wrapperReturnValue(method, returnValue) {
  290. var returnValueHooks = [];
  291. if (Array.isArray(globalInterceptors.returnValue)) {
  292. returnValueHooks.push.apply(returnValueHooks, (0, _toConsumableArray2.default)(globalInterceptors.returnValue));
  293. }
  294. var interceptor = scopedInterceptors[method];
  295. if (interceptor && Array.isArray(interceptor.returnValue)) {
  296. returnValueHooks.push.apply(returnValueHooks, (0, _toConsumableArray2.default)(interceptor.returnValue));
  297. }
  298. returnValueHooks.forEach(function (hook) {
  299. returnValue = hook(returnValue) || returnValue;
  300. });
  301. return returnValue;
  302. }
  303. function getApiInterceptorHooks(method) {
  304. var interceptor = Object.create(null);
  305. Object.keys(globalInterceptors).forEach(function (hook) {
  306. if (hook !== 'returnValue') {
  307. interceptor[hook] = globalInterceptors[hook].slice();
  308. }
  309. });
  310. var scopedInterceptor = scopedInterceptors[method];
  311. if (scopedInterceptor) {
  312. Object.keys(scopedInterceptor).forEach(function (hook) {
  313. if (hook !== 'returnValue') {
  314. interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
  315. }
  316. });
  317. }
  318. return interceptor;
  319. }
  320. function invokeApi(method, api, options) {
  321. for (var _len = arguments.length, params = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
  322. params[_key - 3] = arguments[_key];
  323. }
  324. var interceptor = getApiInterceptorHooks(method);
  325. if (interceptor && Object.keys(interceptor).length) {
  326. if (Array.isArray(interceptor.invoke)) {
  327. var res = queue(interceptor.invoke, options);
  328. return res.then(function (options) {
  329. // 重新访问 getApiInterceptorHooks, 允许 invoke 中再次调用 addInterceptor,removeInterceptor
  330. return api.apply(void 0, [wrapperOptions(getApiInterceptorHooks(method), options)].concat(params));
  331. });
  332. } else {
  333. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  334. }
  335. }
  336. return api.apply(void 0, [options].concat(params));
  337. }
  338. var promiseInterceptor = {
  339. returnValue: function returnValue(res) {
  340. if (!isPromise(res)) {
  341. return res;
  342. }
  343. return new Promise(function (resolve, reject) {
  344. res.then(function (res) {
  345. if (res[0]) {
  346. reject(res[0]);
  347. } else {
  348. resolve(res[1]);
  349. }
  350. });
  351. });
  352. }
  353. };
  354. var SYNC_API_RE = /^\$|Window$|WindowStyle$|sendHostEvent|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getLocale|setLocale|invokePushCallback|getWindowInfo|getDeviceInfo|getAppBaseInfo|getSystemSetting|getAppAuthorizeSetting|initUTS|requireUTS|registerUTS/;
  355. var CONTEXT_API_RE = /^create|Manager$/;
  356. // Context例外情况
  357. var CONTEXT_API_RE_EXC = ['createBLEConnection'];
  358. // 同步例外情况
  359. var ASYNC_API = ['createBLEConnection', 'createPushMessage'];
  360. var CALLBACK_API_RE = /^on|^off/;
  361. function isContextApi(name) {
  362. return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1;
  363. }
  364. function isSyncApi(name) {
  365. return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1;
  366. }
  367. function isCallbackApi(name) {
  368. return CALLBACK_API_RE.test(name) && name !== 'onPush';
  369. }
  370. function handlePromise(promise) {
  371. return promise.then(function (data) {
  372. return [null, data];
  373. }).catch(function (err) {
  374. return [err];
  375. });
  376. }
  377. function shouldPromise(name) {
  378. if (isContextApi(name) || isSyncApi(name) || isCallbackApi(name)) {
  379. return false;
  380. }
  381. return true;
  382. }
  383. /* eslint-disable no-extend-native */
  384. if (!Promise.prototype.finally) {
  385. Promise.prototype.finally = function (callback) {
  386. var promise = this.constructor;
  387. return this.then(function (value) {
  388. return promise.resolve(callback()).then(function () {
  389. return value;
  390. });
  391. }, function (reason) {
  392. return promise.resolve(callback()).then(function () {
  393. throw reason;
  394. });
  395. });
  396. };
  397. }
  398. function promisify(name, api) {
  399. if (!shouldPromise(name) || !isFn(api)) {
  400. return api;
  401. }
  402. return function promiseApi() {
  403. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  404. for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  405. params[_key2 - 1] = arguments[_key2];
  406. }
  407. if (isFn(options.success) || isFn(options.fail) || isFn(options.complete)) {
  408. return wrapperReturnValue(name, invokeApi.apply(void 0, [name, api, options].concat(params)));
  409. }
  410. return wrapperReturnValue(name, handlePromise(new Promise(function (resolve, reject) {
  411. invokeApi.apply(void 0, [name, api, Object.assign({}, options, {
  412. success: resolve,
  413. fail: reject
  414. })].concat(params));
  415. })));
  416. };
  417. }
  418. var EPS = 1e-4;
  419. var BASE_DEVICE_WIDTH = 750;
  420. var isIOS = false;
  421. var deviceWidth = 0;
  422. var deviceDPR = 0;
  423. function checkDeviceWidth() {
  424. var _wx$getSystemInfoSync = wx.getSystemInfoSync(),
  425. platform = _wx$getSystemInfoSync.platform,
  426. pixelRatio = _wx$getSystemInfoSync.pixelRatio,
  427. windowWidth = _wx$getSystemInfoSync.windowWidth; // uni=>wx runtime 编译目标是 uni 对象,内部不允许直接使用 uni
  428. deviceWidth = windowWidth;
  429. deviceDPR = pixelRatio;
  430. isIOS = platform === 'ios';
  431. }
  432. function upx2px(number, newDeviceWidth) {
  433. if (deviceWidth === 0) {
  434. checkDeviceWidth();
  435. }
  436. number = Number(number);
  437. if (number === 0) {
  438. return 0;
  439. }
  440. var result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth);
  441. if (result < 0) {
  442. result = -result;
  443. }
  444. result = Math.floor(result + EPS);
  445. if (result === 0) {
  446. if (deviceDPR === 1 || !isIOS) {
  447. result = 1;
  448. } else {
  449. result = 0.5;
  450. }
  451. }
  452. return number < 0 ? -result : result;
  453. }
  454. var LOCALE_ZH_HANS = 'zh-Hans';
  455. var LOCALE_ZH_HANT = 'zh-Hant';
  456. var LOCALE_EN = 'en';
  457. var LOCALE_FR = 'fr';
  458. var LOCALE_ES = 'es';
  459. var messages = {};
  460. var locale;
  461. {
  462. locale = normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN;
  463. }
  464. function initI18nMessages() {
  465. if (!isEnableLocale()) {
  466. return;
  467. }
  468. var localeKeys = Object.keys(__uniConfig.locales);
  469. if (localeKeys.length) {
  470. localeKeys.forEach(function (locale) {
  471. var curMessages = messages[locale];
  472. var userMessages = __uniConfig.locales[locale];
  473. if (curMessages) {
  474. Object.assign(curMessages, userMessages);
  475. } else {
  476. messages[locale] = userMessages;
  477. }
  478. });
  479. }
  480. }
  481. initI18nMessages();
  482. var i18n = (0, _uniI18n.initVueI18n)(locale, {});
  483. var t = i18n.t;
  484. var i18nMixin = i18n.mixin = {
  485. beforeCreate: function beforeCreate() {
  486. var _this = this;
  487. var unwatch = i18n.i18n.watchLocale(function () {
  488. _this.$forceUpdate();
  489. });
  490. this.$once('hook:beforeDestroy', function () {
  491. unwatch();
  492. });
  493. },
  494. methods: {
  495. $$t: function $$t(key, values) {
  496. return t(key, values);
  497. }
  498. }
  499. };
  500. var setLocale = i18n.setLocale;
  501. var getLocale = i18n.getLocale;
  502. function initAppLocale(Vue, appVm, locale) {
  503. var state = Vue.observable({
  504. locale: locale || i18n.getLocale()
  505. });
  506. var localeWatchers = [];
  507. appVm.$watchLocale = function (fn) {
  508. localeWatchers.push(fn);
  509. };
  510. Object.defineProperty(appVm, '$locale', {
  511. get: function get() {
  512. return state.locale;
  513. },
  514. set: function set(v) {
  515. state.locale = v;
  516. localeWatchers.forEach(function (watch) {
  517. return watch(v);
  518. });
  519. }
  520. });
  521. }
  522. function isEnableLocale() {
  523. return typeof __uniConfig !== 'undefined' && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length;
  524. }
  525. function include(str, parts) {
  526. return !!parts.find(function (part) {
  527. return str.indexOf(part) !== -1;
  528. });
  529. }
  530. function startsWith(str, parts) {
  531. return parts.find(function (part) {
  532. return str.indexOf(part) === 0;
  533. });
  534. }
  535. function normalizeLocale(locale, messages) {
  536. if (!locale) {
  537. return;
  538. }
  539. locale = locale.trim().replace(/_/g, '-');
  540. if (messages && messages[locale]) {
  541. return locale;
  542. }
  543. locale = locale.toLowerCase();
  544. if (locale === 'chinese') {
  545. // 支付宝
  546. return LOCALE_ZH_HANS;
  547. }
  548. if (locale.indexOf('zh') === 0) {
  549. if (locale.indexOf('-hans') > -1) {
  550. return LOCALE_ZH_HANS;
  551. }
  552. if (locale.indexOf('-hant') > -1) {
  553. return LOCALE_ZH_HANT;
  554. }
  555. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  556. return LOCALE_ZH_HANT;
  557. }
  558. return LOCALE_ZH_HANS;
  559. }
  560. var lang = startsWith(locale, [LOCALE_EN, LOCALE_FR, LOCALE_ES]);
  561. if (lang) {
  562. return lang;
  563. }
  564. }
  565. // export function initI18n() {
  566. // const localeKeys = Object.keys(__uniConfig.locales || {})
  567. // if (localeKeys.length) {
  568. // localeKeys.forEach((locale) =>
  569. // i18n.add(locale, __uniConfig.locales[locale])
  570. // )
  571. // }
  572. // }
  573. function getLocale$1() {
  574. // 优先使用 $locale
  575. if (isFn(getApp)) {
  576. var app = getApp({
  577. allowDefault: true
  578. });
  579. if (app && app.$vm) {
  580. return app.$vm.$locale;
  581. }
  582. }
  583. return normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN;
  584. }
  585. function setLocale$1(locale) {
  586. var app = isFn(getApp) ? getApp() : false;
  587. if (!app) {
  588. return false;
  589. }
  590. var oldLocale = app.$vm.$locale;
  591. if (oldLocale !== locale) {
  592. app.$vm.$locale = locale;
  593. onLocaleChangeCallbacks.forEach(function (fn) {
  594. return fn({
  595. locale: locale
  596. });
  597. });
  598. return true;
  599. }
  600. return false;
  601. }
  602. var onLocaleChangeCallbacks = [];
  603. function onLocaleChange(fn) {
  604. if (onLocaleChangeCallbacks.indexOf(fn) === -1) {
  605. onLocaleChangeCallbacks.push(fn);
  606. }
  607. }
  608. if (typeof global !== 'undefined') {
  609. global.getLocale = getLocale$1;
  610. }
  611. var interceptors = {
  612. promiseInterceptor: promiseInterceptor
  613. };
  614. var baseApi = /*#__PURE__*/Object.freeze({
  615. __proto__: null,
  616. upx2px: upx2px,
  617. getLocale: getLocale$1,
  618. setLocale: setLocale$1,
  619. onLocaleChange: onLocaleChange,
  620. addInterceptor: addInterceptor,
  621. removeInterceptor: removeInterceptor,
  622. interceptors: interceptors
  623. });
  624. function findExistsPageIndex(url) {
  625. var pages = getCurrentPages();
  626. var len = pages.length;
  627. while (len--) {
  628. var page = pages[len];
  629. if (page.$page && page.$page.fullPath === url) {
  630. return len;
  631. }
  632. }
  633. return -1;
  634. }
  635. var redirectTo = {
  636. name: function name(fromArgs) {
  637. if (fromArgs.exists === 'back' && fromArgs.delta) {
  638. return 'navigateBack';
  639. }
  640. return 'redirectTo';
  641. },
  642. args: function args(fromArgs) {
  643. if (fromArgs.exists === 'back' && fromArgs.url) {
  644. var existsPageIndex = findExistsPageIndex(fromArgs.url);
  645. if (existsPageIndex !== -1) {
  646. var delta = getCurrentPages().length - 1 - existsPageIndex;
  647. if (delta > 0) {
  648. fromArgs.delta = delta;
  649. }
  650. }
  651. }
  652. }
  653. };
  654. var previewImage = {
  655. args: function args(fromArgs) {
  656. var currentIndex = parseInt(fromArgs.current);
  657. if (isNaN(currentIndex)) {
  658. return;
  659. }
  660. var urls = fromArgs.urls;
  661. if (!Array.isArray(urls)) {
  662. return;
  663. }
  664. var len = urls.length;
  665. if (!len) {
  666. return;
  667. }
  668. if (currentIndex < 0) {
  669. currentIndex = 0;
  670. } else if (currentIndex >= len) {
  671. currentIndex = len - 1;
  672. }
  673. if (currentIndex > 0) {
  674. fromArgs.current = urls[currentIndex];
  675. fromArgs.urls = urls.filter(function (item, index) {
  676. return index < currentIndex ? item !== urls[currentIndex] : true;
  677. });
  678. } else {
  679. fromArgs.current = urls[0];
  680. }
  681. return {
  682. indicator: false,
  683. loop: false
  684. };
  685. }
  686. };
  687. var UUID_KEY = '__DC_STAT_UUID';
  688. var deviceId;
  689. function useDeviceId(result) {
  690. deviceId = deviceId || wx.getStorageSync(UUID_KEY);
  691. if (!deviceId) {
  692. deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7);
  693. wx.setStorage({
  694. key: UUID_KEY,
  695. data: deviceId
  696. });
  697. }
  698. result.deviceId = deviceId;
  699. }
  700. function addSafeAreaInsets(result) {
  701. if (result.safeArea) {
  702. var safeArea = result.safeArea;
  703. result.safeAreaInsets = {
  704. top: safeArea.top,
  705. left: safeArea.left,
  706. right: result.windowWidth - safeArea.right,
  707. bottom: result.screenHeight - safeArea.bottom
  708. };
  709. }
  710. }
  711. function populateParameters(result) {
  712. var _result$brand = result.brand,
  713. brand = _result$brand === void 0 ? '' : _result$brand,
  714. _result$model = result.model,
  715. model = _result$model === void 0 ? '' : _result$model,
  716. _result$system = result.system,
  717. system = _result$system === void 0 ? '' : _result$system,
  718. _result$language = result.language,
  719. language = _result$language === void 0 ? '' : _result$language,
  720. theme = result.theme,
  721. version = result.version,
  722. platform = result.platform,
  723. fontSizeSetting = result.fontSizeSetting,
  724. SDKVersion = result.SDKVersion,
  725. pixelRatio = result.pixelRatio,
  726. deviceOrientation = result.deviceOrientation;
  727. // const isQuickApp = "mp-weixin".indexOf('quickapp-webview') !== -1
  728. var extraParam = {};
  729. // osName osVersion
  730. var osName = '';
  731. var osVersion = '';
  732. {
  733. osName = system.split(' ')[0] || '';
  734. osVersion = system.split(' ')[1] || '';
  735. }
  736. var hostVersion = version;
  737. // deviceType
  738. var deviceType = getGetDeviceType(result, model);
  739. // deviceModel
  740. var deviceBrand = getDeviceBrand(brand);
  741. // hostName
  742. var _hostName = getHostName(result);
  743. // deviceOrientation
  744. var _deviceOrientation = deviceOrientation; // 仅 微信 百度 支持
  745. // devicePixelRatio
  746. var _devicePixelRatio = pixelRatio;
  747. // SDKVersion
  748. var _SDKVersion = SDKVersion;
  749. // hostLanguage
  750. var hostLanguage = language.replace(/_/g, '-');
  751. // wx.getAccountInfoSync
  752. var parameters = {
  753. appId: "__UNI__7140AF8",
  754. appName: "tiyu",
  755. appVersion: "1.0.0",
  756. appVersionCode: "100",
  757. appLanguage: getAppLanguage(hostLanguage),
  758. uniCompileVersion: "3.96",
  759. uniRuntimeVersion: "3.96",
  760. uniPlatform: undefined || "mp-weixin",
  761. deviceBrand: deviceBrand,
  762. deviceModel: model,
  763. deviceType: deviceType,
  764. devicePixelRatio: _devicePixelRatio,
  765. deviceOrientation: _deviceOrientation,
  766. osName: osName.toLocaleLowerCase(),
  767. osVersion: osVersion,
  768. hostTheme: theme,
  769. hostVersion: hostVersion,
  770. hostLanguage: hostLanguage,
  771. hostName: _hostName,
  772. hostSDKVersion: _SDKVersion,
  773. hostFontSizeSetting: fontSizeSetting,
  774. windowTop: 0,
  775. windowBottom: 0,
  776. // TODO
  777. osLanguage: undefined,
  778. osTheme: undefined,
  779. ua: undefined,
  780. hostPackageName: undefined,
  781. browserName: undefined,
  782. browserVersion: undefined
  783. };
  784. Object.assign(result, parameters, extraParam);
  785. }
  786. function getGetDeviceType(result, model) {
  787. var deviceType = result.deviceType || 'phone';
  788. {
  789. var deviceTypeMaps = {
  790. ipad: 'pad',
  791. windows: 'pc',
  792. mac: 'pc'
  793. };
  794. var deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
  795. var _model = model.toLocaleLowerCase();
  796. for (var index = 0; index < deviceTypeMapsKeys.length; index++) {
  797. var _m = deviceTypeMapsKeys[index];
  798. if (_model.indexOf(_m) !== -1) {
  799. deviceType = deviceTypeMaps[_m];
  800. break;
  801. }
  802. }
  803. }
  804. return deviceType;
  805. }
  806. function getDeviceBrand(brand) {
  807. var deviceBrand = brand;
  808. if (deviceBrand) {
  809. deviceBrand = brand.toLocaleLowerCase();
  810. }
  811. return deviceBrand;
  812. }
  813. function getAppLanguage(defaultLanguage) {
  814. return getLocale$1 ? getLocale$1() : defaultLanguage;
  815. }
  816. function getHostName(result) {
  817. var _platform = 'WeChat';
  818. var _hostName = result.hostName || _platform; // mp-jd
  819. {
  820. if (result.environment) {
  821. _hostName = result.environment;
  822. } else if (result.host && result.host.env) {
  823. _hostName = result.host.env;
  824. }
  825. }
  826. return _hostName;
  827. }
  828. var getSystemInfo = {
  829. returnValue: function returnValue(result) {
  830. useDeviceId(result);
  831. addSafeAreaInsets(result);
  832. populateParameters(result);
  833. }
  834. };
  835. var showActionSheet = {
  836. args: function args(fromArgs) {
  837. if ((0, _typeof2.default)(fromArgs) === 'object') {
  838. fromArgs.alertText = fromArgs.title;
  839. }
  840. }
  841. };
  842. var getAppBaseInfo = {
  843. returnValue: function returnValue(result) {
  844. var _result = result,
  845. version = _result.version,
  846. language = _result.language,
  847. SDKVersion = _result.SDKVersion,
  848. theme = _result.theme;
  849. var _hostName = getHostName(result);
  850. var hostLanguage = language.replace('_', '-');
  851. result = sortObject(Object.assign(result, {
  852. appId: "__UNI__7140AF8",
  853. appName: "tiyu",
  854. appVersion: "1.0.0",
  855. appVersionCode: "100",
  856. appLanguage: getAppLanguage(hostLanguage),
  857. hostVersion: version,
  858. hostLanguage: hostLanguage,
  859. hostName: _hostName,
  860. hostSDKVersion: SDKVersion,
  861. hostTheme: theme
  862. }));
  863. }
  864. };
  865. var getDeviceInfo = {
  866. returnValue: function returnValue(result) {
  867. var _result2 = result,
  868. brand = _result2.brand,
  869. model = _result2.model;
  870. var deviceType = getGetDeviceType(result, model);
  871. var deviceBrand = getDeviceBrand(brand);
  872. useDeviceId(result);
  873. result = sortObject(Object.assign(result, {
  874. deviceType: deviceType,
  875. deviceBrand: deviceBrand,
  876. deviceModel: model
  877. }));
  878. }
  879. };
  880. var getWindowInfo = {
  881. returnValue: function returnValue(result) {
  882. addSafeAreaInsets(result);
  883. result = sortObject(Object.assign(result, {
  884. windowTop: 0,
  885. windowBottom: 0
  886. }));
  887. }
  888. };
  889. var getAppAuthorizeSetting = {
  890. returnValue: function returnValue(result) {
  891. var locationReducedAccuracy = result.locationReducedAccuracy;
  892. result.locationAccuracy = 'unsupported';
  893. if (locationReducedAccuracy === true) {
  894. result.locationAccuracy = 'reduced';
  895. } else if (locationReducedAccuracy === false) {
  896. result.locationAccuracy = 'full';
  897. }
  898. }
  899. };
  900. // import navigateTo from 'uni-helpers/navigate-to'
  901. var compressImage = {
  902. args: function args(fromArgs) {
  903. // https://developers.weixin.qq.com/community/develop/doc/000c08940c865011298e0a43256800?highLine=compressHeight
  904. if (fromArgs.compressedHeight && !fromArgs.compressHeight) {
  905. fromArgs.compressHeight = fromArgs.compressedHeight;
  906. }
  907. if (fromArgs.compressedWidth && !fromArgs.compressWidth) {
  908. fromArgs.compressWidth = fromArgs.compressedWidth;
  909. }
  910. }
  911. };
  912. var protocols = {
  913. redirectTo: redirectTo,
  914. // navigateTo, // 由于在微信开发者工具的页面参数,会显示__id__参数,因此暂时关闭mp-weixin对于navigateTo的AOP
  915. previewImage: previewImage,
  916. getSystemInfo: getSystemInfo,
  917. getSystemInfoSync: getSystemInfo,
  918. showActionSheet: showActionSheet,
  919. getAppBaseInfo: getAppBaseInfo,
  920. getDeviceInfo: getDeviceInfo,
  921. getWindowInfo: getWindowInfo,
  922. getAppAuthorizeSetting: getAppAuthorizeSetting,
  923. compressImage: compressImage
  924. };
  925. var todos = ['vibrate', 'preloadPage', 'unPreloadPage', 'loadSubPackage'];
  926. var canIUses = [];
  927. var CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
  928. function processCallback(methodName, method, returnValue) {
  929. return function (res) {
  930. return method(processReturnValue(methodName, res, returnValue));
  931. };
  932. }
  933. function processArgs(methodName, fromArgs) {
  934. var argsOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  935. var returnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  936. var keepFromArgs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  937. if (isPlainObject(fromArgs)) {
  938. // 一般 api 的参数解析
  939. var toArgs = keepFromArgs === true ? fromArgs : {}; // returnValue 为 false 时,说明是格式化返回值,直接在返回值对象上修改赋值
  940. if (isFn(argsOption)) {
  941. argsOption = argsOption(fromArgs, toArgs) || {};
  942. }
  943. for (var key in fromArgs) {
  944. if (hasOwn(argsOption, key)) {
  945. var keyOption = argsOption[key];
  946. if (isFn(keyOption)) {
  947. keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
  948. }
  949. if (!keyOption) {
  950. // 不支持的参数
  951. console.warn("The '".concat(methodName, "' method of platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support option '").concat(key, "'"));
  952. } else if (isStr(keyOption)) {
  953. // 重写参数 key
  954. toArgs[keyOption] = fromArgs[key];
  955. } else if (isPlainObject(keyOption)) {
  956. // {name:newName,value:value}可重新指定参数 key:value
  957. toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
  958. }
  959. } else if (CALLBACKS.indexOf(key) !== -1) {
  960. if (isFn(fromArgs[key])) {
  961. toArgs[key] = processCallback(methodName, fromArgs[key], returnValue);
  962. }
  963. } else {
  964. if (!keepFromArgs) {
  965. toArgs[key] = fromArgs[key];
  966. }
  967. }
  968. }
  969. return toArgs;
  970. } else if (isFn(fromArgs)) {
  971. fromArgs = processCallback(methodName, fromArgs, returnValue);
  972. }
  973. return fromArgs;
  974. }
  975. function processReturnValue(methodName, res, returnValue) {
  976. var keepReturnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  977. if (isFn(protocols.returnValue)) {
  978. // 处理通用 returnValue
  979. res = protocols.returnValue(methodName, res);
  980. }
  981. return processArgs(methodName, res, returnValue, {}, keepReturnValue);
  982. }
  983. function wrapper(methodName, method) {
  984. if (hasOwn(protocols, methodName)) {
  985. var protocol = protocols[methodName];
  986. if (!protocol) {
  987. // 暂不支持的 api
  988. return function () {
  989. console.error("Platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support '".concat(methodName, "'."));
  990. };
  991. }
  992. return function (arg1, arg2) {
  993. // 目前 api 最多两个参数
  994. var options = protocol;
  995. if (isFn(protocol)) {
  996. options = protocol(arg1);
  997. }
  998. arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
  999. var args = [arg1];
  1000. if (typeof arg2 !== 'undefined') {
  1001. args.push(arg2);
  1002. }
  1003. if (isFn(options.name)) {
  1004. methodName = options.name(arg1);
  1005. } else if (isStr(options.name)) {
  1006. methodName = options.name;
  1007. }
  1008. var returnValue = wx[methodName].apply(wx, args);
  1009. if (isSyncApi(methodName)) {
  1010. // 同步 api
  1011. return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
  1012. }
  1013. return returnValue;
  1014. };
  1015. }
  1016. return method;
  1017. }
  1018. var todoApis = Object.create(null);
  1019. var TODOS = ['onTabBarMidButtonTap', 'subscribePush', 'unsubscribePush', 'onPush', 'offPush', 'share'];
  1020. function createTodoApi(name) {
  1021. return function todoApi(_ref) {
  1022. var fail = _ref.fail,
  1023. complete = _ref.complete;
  1024. var res = {
  1025. errMsg: "".concat(name, ":fail method '").concat(name, "' not supported")
  1026. };
  1027. isFn(fail) && fail(res);
  1028. isFn(complete) && complete(res);
  1029. };
  1030. }
  1031. TODOS.forEach(function (name) {
  1032. todoApis[name] = createTodoApi(name);
  1033. });
  1034. var providers = {
  1035. oauth: ['weixin'],
  1036. share: ['weixin'],
  1037. payment: ['wxpay'],
  1038. push: ['weixin']
  1039. };
  1040. function getProvider(_ref2) {
  1041. var service = _ref2.service,
  1042. success = _ref2.success,
  1043. fail = _ref2.fail,
  1044. complete = _ref2.complete;
  1045. var res = false;
  1046. if (providers[service]) {
  1047. res = {
  1048. errMsg: 'getProvider:ok',
  1049. service: service,
  1050. provider: providers[service]
  1051. };
  1052. isFn(success) && success(res);
  1053. } else {
  1054. res = {
  1055. errMsg: 'getProvider:fail service not found'
  1056. };
  1057. isFn(fail) && fail(res);
  1058. }
  1059. isFn(complete) && complete(res);
  1060. }
  1061. var extraApi = /*#__PURE__*/Object.freeze({
  1062. __proto__: null,
  1063. getProvider: getProvider
  1064. });
  1065. var getEmitter = function () {
  1066. var Emitter;
  1067. return function getUniEmitter() {
  1068. if (!Emitter) {
  1069. Emitter = new _vue.default();
  1070. }
  1071. return Emitter;
  1072. };
  1073. }();
  1074. function apply(ctx, method, args) {
  1075. return ctx[method].apply(ctx, args);
  1076. }
  1077. function $on() {
  1078. return apply(getEmitter(), '$on', Array.prototype.slice.call(arguments));
  1079. }
  1080. function $off() {
  1081. return apply(getEmitter(), '$off', Array.prototype.slice.call(arguments));
  1082. }
  1083. function $once() {
  1084. return apply(getEmitter(), '$once', Array.prototype.slice.call(arguments));
  1085. }
  1086. function $emit() {
  1087. return apply(getEmitter(), '$emit', Array.prototype.slice.call(arguments));
  1088. }
  1089. var eventApi = /*#__PURE__*/Object.freeze({
  1090. __proto__: null,
  1091. $on: $on,
  1092. $off: $off,
  1093. $once: $once,
  1094. $emit: $emit
  1095. });
  1096. /**
  1097. * 框架内 try-catch
  1098. */
  1099. /**
  1100. * 开发者 try-catch
  1101. */
  1102. function tryCatch(fn) {
  1103. return function () {
  1104. try {
  1105. return fn.apply(fn, arguments);
  1106. } catch (e) {
  1107. // TODO
  1108. console.error(e);
  1109. }
  1110. };
  1111. }
  1112. function getApiCallbacks(params) {
  1113. var apiCallbacks = {};
  1114. for (var name in params) {
  1115. var param = params[name];
  1116. if (isFn(param)) {
  1117. apiCallbacks[name] = tryCatch(param);
  1118. delete params[name];
  1119. }
  1120. }
  1121. return apiCallbacks;
  1122. }
  1123. var cid;
  1124. var cidErrMsg;
  1125. var enabled;
  1126. function normalizePushMessage(message) {
  1127. try {
  1128. return JSON.parse(message);
  1129. } catch (e) {}
  1130. return message;
  1131. }
  1132. function invokePushCallback(args) {
  1133. if (args.type === 'enabled') {
  1134. enabled = true;
  1135. } else if (args.type === 'clientId') {
  1136. cid = args.cid;
  1137. cidErrMsg = args.errMsg;
  1138. invokeGetPushCidCallbacks(cid, args.errMsg);
  1139. } else if (args.type === 'pushMsg') {
  1140. var message = {
  1141. type: 'receive',
  1142. data: normalizePushMessage(args.message)
  1143. };
  1144. for (var i = 0; i < onPushMessageCallbacks.length; i++) {
  1145. var callback = onPushMessageCallbacks[i];
  1146. callback(message);
  1147. // 该消息已被阻止
  1148. if (message.stopped) {
  1149. break;
  1150. }
  1151. }
  1152. } else if (args.type === 'click') {
  1153. onPushMessageCallbacks.forEach(function (callback) {
  1154. callback({
  1155. type: 'click',
  1156. data: normalizePushMessage(args.message)
  1157. });
  1158. });
  1159. }
  1160. }
  1161. var getPushCidCallbacks = [];
  1162. function invokeGetPushCidCallbacks(cid, errMsg) {
  1163. getPushCidCallbacks.forEach(function (callback) {
  1164. callback(cid, errMsg);
  1165. });
  1166. getPushCidCallbacks.length = 0;
  1167. }
  1168. function getPushClientId(args) {
  1169. if (!isPlainObject(args)) {
  1170. args = {};
  1171. }
  1172. var _getApiCallbacks = getApiCallbacks(args),
  1173. success = _getApiCallbacks.success,
  1174. fail = _getApiCallbacks.fail,
  1175. complete = _getApiCallbacks.complete;
  1176. var hasSuccess = isFn(success);
  1177. var hasFail = isFn(fail);
  1178. var hasComplete = isFn(complete);
  1179. Promise.resolve().then(function () {
  1180. if (typeof enabled === 'undefined') {
  1181. enabled = false;
  1182. cid = '';
  1183. cidErrMsg = 'uniPush is not enabled';
  1184. }
  1185. getPushCidCallbacks.push(function (cid, errMsg) {
  1186. var res;
  1187. if (cid) {
  1188. res = {
  1189. errMsg: 'getPushClientId:ok',
  1190. cid: cid
  1191. };
  1192. hasSuccess && success(res);
  1193. } else {
  1194. res = {
  1195. errMsg: 'getPushClientId:fail' + (errMsg ? ' ' + errMsg : '')
  1196. };
  1197. hasFail && fail(res);
  1198. }
  1199. hasComplete && complete(res);
  1200. });
  1201. if (typeof cid !== 'undefined') {
  1202. invokeGetPushCidCallbacks(cid, cidErrMsg);
  1203. }
  1204. });
  1205. }
  1206. var onPushMessageCallbacks = [];
  1207. // 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
  1208. var onPushMessage = function onPushMessage(fn) {
  1209. if (onPushMessageCallbacks.indexOf(fn) === -1) {
  1210. onPushMessageCallbacks.push(fn);
  1211. }
  1212. };
  1213. var offPushMessage = function offPushMessage(fn) {
  1214. if (!fn) {
  1215. onPushMessageCallbacks.length = 0;
  1216. } else {
  1217. var index = onPushMessageCallbacks.indexOf(fn);
  1218. if (index > -1) {
  1219. onPushMessageCallbacks.splice(index, 1);
  1220. }
  1221. }
  1222. };
  1223. var baseInfo = wx.getAppBaseInfo && wx.getAppBaseInfo();
  1224. if (!baseInfo) {
  1225. baseInfo = wx.getSystemInfoSync();
  1226. }
  1227. var host = baseInfo ? baseInfo.host : null;
  1228. var shareVideoMessage = host && host.env === 'SAAASDK' ? wx.miniapp.shareVideoMessage : wx.shareVideoMessage;
  1229. var api = /*#__PURE__*/Object.freeze({
  1230. __proto__: null,
  1231. shareVideoMessage: shareVideoMessage,
  1232. getPushClientId: getPushClientId,
  1233. onPushMessage: onPushMessage,
  1234. offPushMessage: offPushMessage,
  1235. invokePushCallback: invokePushCallback
  1236. });
  1237. var mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
  1238. function findVmByVueId(vm, vuePid) {
  1239. var $children = vm.$children;
  1240. // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
  1241. for (var i = $children.length - 1; i >= 0; i--) {
  1242. var childVm = $children[i];
  1243. if (childVm.$scope._$vueId === vuePid) {
  1244. return childVm;
  1245. }
  1246. }
  1247. // 反向递归查找
  1248. var parentVm;
  1249. for (var _i = $children.length - 1; _i >= 0; _i--) {
  1250. parentVm = findVmByVueId($children[_i], vuePid);
  1251. if (parentVm) {
  1252. return parentVm;
  1253. }
  1254. }
  1255. }
  1256. function initBehavior(options) {
  1257. return Behavior(options);
  1258. }
  1259. function isPage() {
  1260. return !!this.route;
  1261. }
  1262. function initRelation(detail) {
  1263. this.triggerEvent('__l', detail);
  1264. }
  1265. function selectAllComponents(mpInstance, selector, $refs) {
  1266. var components = mpInstance.selectAllComponents(selector) || [];
  1267. components.forEach(function (component) {
  1268. var ref = component.dataset.ref;
  1269. $refs[ref] = component.$vm || toSkip(component);
  1270. {
  1271. if (component.dataset.vueGeneric === 'scoped') {
  1272. component.selectAllComponents('.scoped-ref').forEach(function (scopedComponent) {
  1273. selectAllComponents(scopedComponent, selector, $refs);
  1274. });
  1275. }
  1276. }
  1277. });
  1278. }
  1279. function syncRefs(refs, newRefs) {
  1280. var oldKeys = (0, _construct2.default)(Set, (0, _toConsumableArray2.default)(Object.keys(refs)));
  1281. var newKeys = Object.keys(newRefs);
  1282. newKeys.forEach(function (key) {
  1283. var oldValue = refs[key];
  1284. var newValue = newRefs[key];
  1285. if (Array.isArray(oldValue) && Array.isArray(newValue) && oldValue.length === newValue.length && newValue.every(function (value) {
  1286. return oldValue.includes(value);
  1287. })) {
  1288. return;
  1289. }
  1290. refs[key] = newValue;
  1291. oldKeys.delete(key);
  1292. });
  1293. oldKeys.forEach(function (key) {
  1294. delete refs[key];
  1295. });
  1296. return refs;
  1297. }
  1298. function initRefs(vm) {
  1299. var mpInstance = vm.$scope;
  1300. var refs = {};
  1301. Object.defineProperty(vm, '$refs', {
  1302. get: function get() {
  1303. var $refs = {};
  1304. selectAllComponents(mpInstance, '.vue-ref', $refs);
  1305. // TODO 暂不考虑 for 中的 scoped
  1306. var forComponents = mpInstance.selectAllComponents('.vue-ref-in-for') || [];
  1307. forComponents.forEach(function (component) {
  1308. var ref = component.dataset.ref;
  1309. if (!$refs[ref]) {
  1310. $refs[ref] = [];
  1311. }
  1312. $refs[ref].push(component.$vm || toSkip(component));
  1313. });
  1314. return syncRefs(refs, $refs);
  1315. }
  1316. });
  1317. }
  1318. function handleLink(event) {
  1319. var _ref3 = event.detail || event.value,
  1320. vuePid = _ref3.vuePid,
  1321. vueOptions = _ref3.vueOptions; // detail 是微信,value 是百度(dipatch)
  1322. var parentVm;
  1323. if (vuePid) {
  1324. parentVm = findVmByVueId(this.$vm, vuePid);
  1325. }
  1326. if (!parentVm) {
  1327. parentVm = this.$vm;
  1328. }
  1329. vueOptions.parent = parentVm;
  1330. }
  1331. function markMPComponent(component) {
  1332. // 在 Vue 中标记为小程序组件
  1333. var IS_MP = '__v_isMPComponent';
  1334. Object.defineProperty(component, IS_MP, {
  1335. configurable: true,
  1336. enumerable: false,
  1337. value: true
  1338. });
  1339. return component;
  1340. }
  1341. function toSkip(obj) {
  1342. var OB = '__ob__';
  1343. var SKIP = '__v_skip';
  1344. if (isObject(obj) && Object.isExtensible(obj)) {
  1345. // 避免被 @vue/composition-api 观测
  1346. Object.defineProperty(obj, OB, {
  1347. configurable: true,
  1348. enumerable: false,
  1349. value: (0, _defineProperty2.default)({}, SKIP, true)
  1350. });
  1351. }
  1352. return obj;
  1353. }
  1354. var WORKLET_RE = /_(.*)_worklet_factory_/;
  1355. function initWorkletMethods(mpMethods, vueMethods) {
  1356. if (vueMethods) {
  1357. Object.keys(vueMethods).forEach(function (name) {
  1358. var matches = name.match(WORKLET_RE);
  1359. if (matches) {
  1360. var workletName = matches[1];
  1361. mpMethods[name] = vueMethods[name];
  1362. mpMethods[workletName] = vueMethods[workletName];
  1363. }
  1364. });
  1365. }
  1366. }
  1367. var MPPage = Page;
  1368. var MPComponent = Component;
  1369. var customizeRE = /:/g;
  1370. var customize = cached(function (str) {
  1371. return camelize(str.replace(customizeRE, '-'));
  1372. });
  1373. function initTriggerEvent(mpInstance) {
  1374. var oldTriggerEvent = mpInstance.triggerEvent;
  1375. var newTriggerEvent = function newTriggerEvent(event) {
  1376. for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
  1377. args[_key3 - 1] = arguments[_key3];
  1378. }
  1379. // 事件名统一转驼峰格式,仅处理:当前组件为 vue 组件、当前组件为 vue 组件子组件
  1380. if (this.$vm || this.dataset && this.dataset.comType) {
  1381. event = customize(event);
  1382. } else {
  1383. // 针对微信/QQ小程序单独补充驼峰格式事件,以兼容历史项目
  1384. var newEvent = customize(event);
  1385. if (newEvent !== event) {
  1386. oldTriggerEvent.apply(this, [newEvent].concat(args));
  1387. }
  1388. }
  1389. return oldTriggerEvent.apply(this, [event].concat(args));
  1390. };
  1391. try {
  1392. // 京东小程序 triggerEvent 为只读
  1393. mpInstance.triggerEvent = newTriggerEvent;
  1394. } catch (error) {
  1395. mpInstance._triggerEvent = newTriggerEvent;
  1396. }
  1397. }
  1398. function initHook(name, options, isComponent) {
  1399. var oldHook = options[name];
  1400. options[name] = function () {
  1401. markMPComponent(this);
  1402. initTriggerEvent(this);
  1403. if (oldHook) {
  1404. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  1405. args[_key4] = arguments[_key4];
  1406. }
  1407. return oldHook.apply(this, args);
  1408. }
  1409. };
  1410. }
  1411. if (!MPPage.__$wrappered) {
  1412. MPPage.__$wrappered = true;
  1413. Page = function Page() {
  1414. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1415. initHook('onLoad', options);
  1416. return MPPage(options);
  1417. };
  1418. Page.after = MPPage.after;
  1419. Component = function Component() {
  1420. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1421. initHook('created', options);
  1422. return MPComponent(options);
  1423. };
  1424. }
  1425. var PAGE_EVENT_HOOKS = ['onPullDownRefresh', 'onReachBottom', 'onAddToFavorites', 'onShareTimeline', 'onShareAppMessage', 'onPageScroll', 'onResize', 'onTabItemTap'];
  1426. function initMocks(vm, mocks) {
  1427. var mpInstance = vm.$mp[vm.mpType];
  1428. mocks.forEach(function (mock) {
  1429. if (hasOwn(mpInstance, mock)) {
  1430. vm[mock] = mpInstance[mock];
  1431. }
  1432. });
  1433. }
  1434. function hasHook(hook, vueOptions) {
  1435. if (!vueOptions) {
  1436. return true;
  1437. }
  1438. if (_vue.default.options && Array.isArray(_vue.default.options[hook])) {
  1439. return true;
  1440. }
  1441. vueOptions = vueOptions.default || vueOptions;
  1442. if (isFn(vueOptions)) {
  1443. if (isFn(vueOptions.extendOptions[hook])) {
  1444. return true;
  1445. }
  1446. if (vueOptions.super && vueOptions.super.options && Array.isArray(vueOptions.super.options[hook])) {
  1447. return true;
  1448. }
  1449. return false;
  1450. }
  1451. if (isFn(vueOptions[hook]) || Array.isArray(vueOptions[hook])) {
  1452. return true;
  1453. }
  1454. var mixins = vueOptions.mixins;
  1455. if (Array.isArray(mixins)) {
  1456. return !!mixins.find(function (mixin) {
  1457. return hasHook(hook, mixin);
  1458. });
  1459. }
  1460. }
  1461. function initHooks(mpOptions, hooks, vueOptions) {
  1462. hooks.forEach(function (hook) {
  1463. if (hasHook(hook, vueOptions)) {
  1464. mpOptions[hook] = function (args) {
  1465. return this.$vm && this.$vm.__call_hook(hook, args);
  1466. };
  1467. }
  1468. });
  1469. }
  1470. function initUnknownHooks(mpOptions, vueOptions) {
  1471. var excludes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  1472. findHooks(vueOptions).forEach(function (hook) {
  1473. return initHook$1(mpOptions, hook, excludes);
  1474. });
  1475. }
  1476. function findHooks(vueOptions) {
  1477. var hooks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  1478. if (vueOptions) {
  1479. Object.keys(vueOptions).forEach(function (name) {
  1480. if (name.indexOf('on') === 0 && isFn(vueOptions[name])) {
  1481. hooks.push(name);
  1482. }
  1483. });
  1484. }
  1485. return hooks;
  1486. }
  1487. function initHook$1(mpOptions, hook, excludes) {
  1488. if (excludes.indexOf(hook) === -1 && !hasOwn(mpOptions, hook)) {
  1489. mpOptions[hook] = function (args) {
  1490. return this.$vm && this.$vm.__call_hook(hook, args);
  1491. };
  1492. }
  1493. }
  1494. function initVueComponent(Vue, vueOptions) {
  1495. vueOptions = vueOptions.default || vueOptions;
  1496. var VueComponent;
  1497. if (isFn(vueOptions)) {
  1498. VueComponent = vueOptions;
  1499. } else {
  1500. VueComponent = Vue.extend(vueOptions);
  1501. }
  1502. vueOptions = VueComponent.options;
  1503. return [VueComponent, vueOptions];
  1504. }
  1505. function initSlots(vm, vueSlots) {
  1506. if (Array.isArray(vueSlots) && vueSlots.length) {
  1507. var $slots = Object.create(null);
  1508. vueSlots.forEach(function (slotName) {
  1509. $slots[slotName] = true;
  1510. });
  1511. vm.$scopedSlots = vm.$slots = $slots;
  1512. }
  1513. }
  1514. function initVueIds(vueIds, mpInstance) {
  1515. vueIds = (vueIds || '').split(',');
  1516. var len = vueIds.length;
  1517. if (len === 1) {
  1518. mpInstance._$vueId = vueIds[0];
  1519. } else if (len === 2) {
  1520. mpInstance._$vueId = vueIds[0];
  1521. mpInstance._$vuePid = vueIds[1];
  1522. }
  1523. }
  1524. function initData(vueOptions, context) {
  1525. var data = vueOptions.data || {};
  1526. var methods = vueOptions.methods || {};
  1527. if (typeof data === 'function') {
  1528. try {
  1529. data = data.call(context); // 支持 Vue.prototype 上挂的数据
  1530. } catch (e) {
  1531. if (Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"tiyu","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  1532. console.warn('根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。', data);
  1533. }
  1534. }
  1535. } else {
  1536. try {
  1537. // 对 data 格式化
  1538. data = JSON.parse(JSON.stringify(data));
  1539. } catch (e) {}
  1540. }
  1541. if (!isPlainObject(data)) {
  1542. data = {};
  1543. }
  1544. Object.keys(methods).forEach(function (methodName) {
  1545. if (context.__lifecycle_hooks__.indexOf(methodName) === -1 && !hasOwn(data, methodName)) {
  1546. data[methodName] = methods[methodName];
  1547. }
  1548. });
  1549. return data;
  1550. }
  1551. var PROP_TYPES = [String, Number, Boolean, Object, Array, null];
  1552. function createObserver(name) {
  1553. return function observer(newVal, oldVal) {
  1554. if (this.$vm) {
  1555. this.$vm[name] = newVal; // 为了触发其他非 render watcher
  1556. }
  1557. };
  1558. }
  1559. function initBehaviors(vueOptions, initBehavior) {
  1560. var vueBehaviors = vueOptions.behaviors;
  1561. var vueExtends = vueOptions.extends;
  1562. var vueMixins = vueOptions.mixins;
  1563. var vueProps = vueOptions.props;
  1564. if (!vueProps) {
  1565. vueOptions.props = vueProps = [];
  1566. }
  1567. var behaviors = [];
  1568. if (Array.isArray(vueBehaviors)) {
  1569. vueBehaviors.forEach(function (behavior) {
  1570. behaviors.push(behavior.replace('uni://', "wx".concat("://")));
  1571. if (behavior === 'uni://form-field') {
  1572. if (Array.isArray(vueProps)) {
  1573. vueProps.push('name');
  1574. vueProps.push('value');
  1575. } else {
  1576. vueProps.name = {
  1577. type: String,
  1578. default: ''
  1579. };
  1580. vueProps.value = {
  1581. type: [String, Number, Boolean, Array, Object, Date],
  1582. default: ''
  1583. };
  1584. }
  1585. }
  1586. });
  1587. }
  1588. if (isPlainObject(vueExtends) && vueExtends.props) {
  1589. behaviors.push(initBehavior({
  1590. properties: initProperties(vueExtends.props, true)
  1591. }));
  1592. }
  1593. if (Array.isArray(vueMixins)) {
  1594. vueMixins.forEach(function (vueMixin) {
  1595. if (isPlainObject(vueMixin) && vueMixin.props) {
  1596. behaviors.push(initBehavior({
  1597. properties: initProperties(vueMixin.props, true)
  1598. }));
  1599. }
  1600. });
  1601. }
  1602. return behaviors;
  1603. }
  1604. function parsePropType(key, type, defaultValue, file) {
  1605. // [String]=>String
  1606. if (Array.isArray(type) && type.length === 1) {
  1607. return type[0];
  1608. }
  1609. return type;
  1610. }
  1611. function initProperties(props) {
  1612. var isBehavior = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  1613. var file = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
  1614. var options = arguments.length > 3 ? arguments[3] : undefined;
  1615. var properties = {};
  1616. if (!isBehavior) {
  1617. properties.vueId = {
  1618. type: String,
  1619. value: ''
  1620. };
  1621. {
  1622. if (options.virtualHost) {
  1623. properties.virtualHostStyle = {
  1624. type: null,
  1625. value: ''
  1626. };
  1627. properties.virtualHostClass = {
  1628. type: null,
  1629. value: ''
  1630. };
  1631. }
  1632. }
  1633. // scopedSlotsCompiler auto
  1634. properties.scopedSlotsCompiler = {
  1635. type: String,
  1636. value: ''
  1637. };
  1638. properties.vueSlots = {
  1639. // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
  1640. type: null,
  1641. value: [],
  1642. observer: function observer(newVal, oldVal) {
  1643. var $slots = Object.create(null);
  1644. newVal.forEach(function (slotName) {
  1645. $slots[slotName] = true;
  1646. });
  1647. this.setData({
  1648. $slots: $slots
  1649. });
  1650. }
  1651. };
  1652. }
  1653. if (Array.isArray(props)) {
  1654. // ['title']
  1655. props.forEach(function (key) {
  1656. properties[key] = {
  1657. type: null,
  1658. observer: createObserver(key)
  1659. };
  1660. });
  1661. } else if (isPlainObject(props)) {
  1662. // {title:{type:String,default:''},content:String}
  1663. Object.keys(props).forEach(function (key) {
  1664. var opts = props[key];
  1665. if (isPlainObject(opts)) {
  1666. // title:{type:String,default:''}
  1667. var value = opts.default;
  1668. if (isFn(value)) {
  1669. value = value();
  1670. }
  1671. opts.type = parsePropType(key, opts.type);
  1672. properties[key] = {
  1673. type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
  1674. value: value,
  1675. observer: createObserver(key)
  1676. };
  1677. } else {
  1678. // content:String
  1679. var type = parsePropType(key, opts);
  1680. properties[key] = {
  1681. type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
  1682. observer: createObserver(key)
  1683. };
  1684. }
  1685. });
  1686. }
  1687. return properties;
  1688. }
  1689. function wrapper$1(event) {
  1690. // TODO 又得兼容 mpvue 的 mp 对象
  1691. try {
  1692. event.mp = JSON.parse(JSON.stringify(event));
  1693. } catch (e) {}
  1694. event.stopPropagation = noop;
  1695. event.preventDefault = noop;
  1696. event.target = event.target || {};
  1697. if (!hasOwn(event, 'detail')) {
  1698. event.detail = {};
  1699. }
  1700. if (hasOwn(event, 'markerId')) {
  1701. event.detail = (0, _typeof2.default)(event.detail) === 'object' ? event.detail : {};
  1702. event.detail.markerId = event.markerId;
  1703. }
  1704. if (isPlainObject(event.detail)) {
  1705. event.target = Object.assign({}, event.target, event.detail);
  1706. }
  1707. return event;
  1708. }
  1709. function getExtraValue(vm, dataPathsArray) {
  1710. var context = vm;
  1711. dataPathsArray.forEach(function (dataPathArray) {
  1712. var dataPath = dataPathArray[0];
  1713. var value = dataPathArray[2];
  1714. if (dataPath || typeof value !== 'undefined') {
  1715. // ['','',index,'disable']
  1716. var propPath = dataPathArray[1];
  1717. var valuePath = dataPathArray[3];
  1718. var vFor;
  1719. if (Number.isInteger(dataPath)) {
  1720. vFor = dataPath;
  1721. } else if (!dataPath) {
  1722. vFor = context;
  1723. } else if (typeof dataPath === 'string' && dataPath) {
  1724. if (dataPath.indexOf('#s#') === 0) {
  1725. vFor = dataPath.substr(3);
  1726. } else {
  1727. vFor = vm.__get_value(dataPath, context);
  1728. }
  1729. }
  1730. if (Number.isInteger(vFor)) {
  1731. context = value;
  1732. } else if (!propPath) {
  1733. context = vFor[value];
  1734. } else {
  1735. if (Array.isArray(vFor)) {
  1736. context = vFor.find(function (vForItem) {
  1737. return vm.__get_value(propPath, vForItem) === value;
  1738. });
  1739. } else if (isPlainObject(vFor)) {
  1740. context = Object.keys(vFor).find(function (vForKey) {
  1741. return vm.__get_value(propPath, vFor[vForKey]) === value;
  1742. });
  1743. } else {
  1744. console.error('v-for 暂不支持循环数据:', vFor);
  1745. }
  1746. }
  1747. if (valuePath) {
  1748. context = vm.__get_value(valuePath, context);
  1749. }
  1750. }
  1751. });
  1752. return context;
  1753. }
  1754. function processEventExtra(vm, extra, event, __args__) {
  1755. var extraObj = {};
  1756. if (Array.isArray(extra) && extra.length) {
  1757. /**
  1758. *[
  1759. * ['data.items', 'data.id', item.data.id],
  1760. * ['metas', 'id', meta.id]
  1761. *],
  1762. *[
  1763. * ['data.items', 'data.id', item.data.id],
  1764. * ['metas', 'id', meta.id]
  1765. *],
  1766. *'test'
  1767. */
  1768. extra.forEach(function (dataPath, index) {
  1769. if (typeof dataPath === 'string') {
  1770. if (!dataPath) {
  1771. // model,prop.sync
  1772. extraObj['$' + index] = vm;
  1773. } else {
  1774. if (dataPath === '$event') {
  1775. // $event
  1776. extraObj['$' + index] = event;
  1777. } else if (dataPath === 'arguments') {
  1778. extraObj['$' + index] = event.detail ? event.detail.__args__ || __args__ : __args__;
  1779. } else if (dataPath.indexOf('$event.') === 0) {
  1780. // $event.target.value
  1781. extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
  1782. } else {
  1783. extraObj['$' + index] = vm.__get_value(dataPath);
  1784. }
  1785. }
  1786. } else {
  1787. extraObj['$' + index] = getExtraValue(vm, dataPath);
  1788. }
  1789. });
  1790. }
  1791. return extraObj;
  1792. }
  1793. function getObjByArray(arr) {
  1794. var obj = {};
  1795. for (var i = 1; i < arr.length; i++) {
  1796. var element = arr[i];
  1797. obj[element[0]] = element[1];
  1798. }
  1799. return obj;
  1800. }
  1801. function processEventArgs(vm, event) {
  1802. var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  1803. var extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  1804. var isCustom = arguments.length > 4 ? arguments[4] : undefined;
  1805. var methodName = arguments.length > 5 ? arguments[5] : undefined;
  1806. var isCustomMPEvent = false; // wxcomponent 组件,传递原始 event 对象
  1807. // fixed 用户直接触发 mpInstance.triggerEvent
  1808. var __args__ = isPlainObject(event.detail) ? event.detail.__args__ || [event.detail] : [event.detail];
  1809. if (isCustom) {
  1810. // 自定义事件
  1811. isCustomMPEvent = event.currentTarget && event.currentTarget.dataset && event.currentTarget.dataset.comType === 'wx';
  1812. if (!args.length) {
  1813. // 无参数,直接传入 event 或 detail 数组
  1814. if (isCustomMPEvent) {
  1815. return [event];
  1816. }
  1817. return __args__;
  1818. }
  1819. }
  1820. var extraObj = processEventExtra(vm, extra, event, __args__);
  1821. var ret = [];
  1822. args.forEach(function (arg) {
  1823. if (arg === '$event') {
  1824. if (methodName === '__set_model' && !isCustom) {
  1825. // input v-model value
  1826. ret.push(event.target.value);
  1827. } else {
  1828. if (isCustom && !isCustomMPEvent) {
  1829. ret.push(__args__[0]);
  1830. } else {
  1831. // wxcomponent 组件或内置组件
  1832. ret.push(event);
  1833. }
  1834. }
  1835. } else {
  1836. if (Array.isArray(arg) && arg[0] === 'o') {
  1837. ret.push(getObjByArray(arg));
  1838. } else if (typeof arg === 'string' && hasOwn(extraObj, arg)) {
  1839. ret.push(extraObj[arg]);
  1840. } else {
  1841. ret.push(arg);
  1842. }
  1843. }
  1844. });
  1845. return ret;
  1846. }
  1847. var ONCE = '~';
  1848. var CUSTOM = '^';
  1849. function isMatchEventType(eventType, optType) {
  1850. return eventType === optType || optType === 'regionchange' && (eventType === 'begin' || eventType === 'end');
  1851. }
  1852. function getContextVm(vm) {
  1853. var $parent = vm.$parent;
  1854. // 父组件是 scoped slots 或者其他自定义组件时继续查找
  1855. while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) {
  1856. $parent = $parent.$parent;
  1857. }
  1858. return $parent && $parent.$parent;
  1859. }
  1860. function handleEvent(event) {
  1861. var _this2 = this;
  1862. event = wrapper$1(event);
  1863. // [['tap',[['handle',[1,2,a]],['handle1',[1,2,a]]]]]
  1864. var dataset = (event.currentTarget || event.target).dataset;
  1865. if (!dataset) {
  1866. return console.warn('事件信息不存在');
  1867. }
  1868. var eventOpts = dataset.eventOpts || dataset['event-opts']; // 支付宝 web-view 组件 dataset 非驼峰
  1869. if (!eventOpts) {
  1870. return console.warn('事件信息不存在');
  1871. }
  1872. // [['handle',[1,2,a]],['handle1',[1,2,a]]]
  1873. var eventType = event.type;
  1874. var ret = [];
  1875. eventOpts.forEach(function (eventOpt) {
  1876. var type = eventOpt[0];
  1877. var eventsArray = eventOpt[1];
  1878. var isCustom = type.charAt(0) === CUSTOM;
  1879. type = isCustom ? type.slice(1) : type;
  1880. var isOnce = type.charAt(0) === ONCE;
  1881. type = isOnce ? type.slice(1) : type;
  1882. if (eventsArray && isMatchEventType(eventType, type)) {
  1883. eventsArray.forEach(function (eventArray) {
  1884. var methodName = eventArray[0];
  1885. if (methodName) {
  1886. var handlerCtx = _this2.$vm;
  1887. if (handlerCtx.$options.generic) {
  1888. // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
  1889. handlerCtx = getContextVm(handlerCtx) || handlerCtx;
  1890. }
  1891. if (methodName === '$emit') {
  1892. handlerCtx.$emit.apply(handlerCtx, processEventArgs(_this2.$vm, event, eventArray[1], eventArray[2], isCustom, methodName));
  1893. return;
  1894. }
  1895. var handler = handlerCtx[methodName];
  1896. if (!isFn(handler)) {
  1897. var _type = _this2.$vm.mpType === 'page' ? 'Page' : 'Component';
  1898. var path = _this2.route || _this2.is;
  1899. throw new Error("".concat(_type, " \"").concat(path, "\" does not have a method \"").concat(methodName, "\""));
  1900. }
  1901. if (isOnce) {
  1902. if (handler.once) {
  1903. return;
  1904. }
  1905. handler.once = true;
  1906. }
  1907. var params = processEventArgs(_this2.$vm, event, eventArray[1], eventArray[2], isCustom, methodName);
  1908. params = Array.isArray(params) ? params : [];
  1909. // 参数尾部增加原始事件对象用于复杂表达式内获取额外数据
  1910. if (/=\s*\S+\.eventParams\s*\|\|\s*\S+\[['"]event-params['"]\]/.test(handler.toString())) {
  1911. // eslint-disable-next-line no-sparse-arrays
  1912. params = params.concat([,,,,,,,,,, event]);
  1913. }
  1914. ret.push(handler.apply(handlerCtx, params));
  1915. }
  1916. });
  1917. }
  1918. });
  1919. if (eventType === 'input' && ret.length === 1 && typeof ret[0] !== 'undefined') {
  1920. return ret[0];
  1921. }
  1922. }
  1923. var eventChannels = {};
  1924. function getEventChannel(id) {
  1925. var eventChannel = eventChannels[id];
  1926. delete eventChannels[id];
  1927. return eventChannel;
  1928. }
  1929. var hooks = ['onShow', 'onHide', 'onError', 'onPageNotFound', 'onThemeChange', 'onUnhandledRejection'];
  1930. function initEventChannel() {
  1931. _vue.default.prototype.getOpenerEventChannel = function () {
  1932. // 微信小程序使用自身getOpenerEventChannel
  1933. {
  1934. return this.$scope.getOpenerEventChannel();
  1935. }
  1936. };
  1937. var callHook = _vue.default.prototype.__call_hook;
  1938. _vue.default.prototype.__call_hook = function (hook, args) {
  1939. if (hook === 'onLoad' && args && args.__id__) {
  1940. this.__eventChannel__ = getEventChannel(args.__id__);
  1941. delete args.__id__;
  1942. }
  1943. return callHook.call(this, hook, args);
  1944. };
  1945. }
  1946. function initScopedSlotsParams() {
  1947. var center = {};
  1948. var parents = {};
  1949. function currentId(fn) {
  1950. var vueIds = this.$options.propsData.vueId;
  1951. if (vueIds) {
  1952. var vueId = vueIds.split(',')[0];
  1953. fn(vueId);
  1954. }
  1955. }
  1956. _vue.default.prototype.$hasSSP = function (vueId) {
  1957. var slot = center[vueId];
  1958. if (!slot) {
  1959. parents[vueId] = this;
  1960. this.$on('hook:destroyed', function () {
  1961. delete parents[vueId];
  1962. });
  1963. }
  1964. return slot;
  1965. };
  1966. _vue.default.prototype.$getSSP = function (vueId, name, needAll) {
  1967. var slot = center[vueId];
  1968. if (slot) {
  1969. var params = slot[name] || [];
  1970. if (needAll) {
  1971. return params;
  1972. }
  1973. return params[0];
  1974. }
  1975. };
  1976. _vue.default.prototype.$setSSP = function (name, value) {
  1977. var index = 0;
  1978. currentId.call(this, function (vueId) {
  1979. var slot = center[vueId];
  1980. var params = slot[name] = slot[name] || [];
  1981. params.push(value);
  1982. index = params.length - 1;
  1983. });
  1984. return index;
  1985. };
  1986. _vue.default.prototype.$initSSP = function () {
  1987. currentId.call(this, function (vueId) {
  1988. center[vueId] = {};
  1989. });
  1990. };
  1991. _vue.default.prototype.$callSSP = function () {
  1992. currentId.call(this, function (vueId) {
  1993. if (parents[vueId]) {
  1994. parents[vueId].$forceUpdate();
  1995. }
  1996. });
  1997. };
  1998. _vue.default.mixin({
  1999. destroyed: function destroyed() {
  2000. var propsData = this.$options.propsData;
  2001. var vueId = propsData && propsData.vueId;
  2002. if (vueId) {
  2003. delete center[vueId];
  2004. delete parents[vueId];
  2005. }
  2006. }
  2007. });
  2008. }
  2009. function parseBaseApp(vm, _ref4) {
  2010. var mocks = _ref4.mocks,
  2011. initRefs = _ref4.initRefs;
  2012. initEventChannel();
  2013. {
  2014. initScopedSlotsParams();
  2015. }
  2016. if (vm.$options.store) {
  2017. _vue.default.prototype.$store = vm.$options.store;
  2018. }
  2019. uniIdMixin(_vue.default);
  2020. _vue.default.prototype.mpHost = "mp-weixin";
  2021. _vue.default.mixin({
  2022. beforeCreate: function beforeCreate() {
  2023. if (!this.$options.mpType) {
  2024. return;
  2025. }
  2026. this.mpType = this.$options.mpType;
  2027. this.$mp = (0, _defineProperty2.default)({
  2028. data: {}
  2029. }, this.mpType, this.$options.mpInstance);
  2030. this.$scope = this.$options.mpInstance;
  2031. delete this.$options.mpType;
  2032. delete this.$options.mpInstance;
  2033. if (this.mpType === 'page' && typeof getApp === 'function') {
  2034. // hack vue-i18n
  2035. var app = getApp();
  2036. if (app.$vm && app.$vm.$i18n) {
  2037. this._i18n = app.$vm.$i18n;
  2038. }
  2039. }
  2040. if (this.mpType !== 'app') {
  2041. initRefs(this);
  2042. initMocks(this, mocks);
  2043. }
  2044. }
  2045. });
  2046. var appOptions = {
  2047. onLaunch: function onLaunch(args) {
  2048. if (this.$vm) {
  2049. // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
  2050. return;
  2051. }
  2052. {
  2053. if (wx.canIUse && !wx.canIUse('nextTick')) {
  2054. // 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断
  2055. console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上');
  2056. }
  2057. }
  2058. this.$vm = vm;
  2059. this.$vm.$mp = {
  2060. app: this
  2061. };
  2062. this.$vm.$scope = this;
  2063. // vm 上也挂载 globalData
  2064. this.$vm.globalData = this.globalData;
  2065. this.$vm._isMounted = true;
  2066. this.$vm.__call_hook('mounted', args);
  2067. this.$vm.__call_hook('onLaunch', args);
  2068. }
  2069. };
  2070. // 兼容旧版本 globalData
  2071. appOptions.globalData = vm.$options.globalData || {};
  2072. // 将 methods 中的方法挂在 getApp() 中
  2073. var methods = vm.$options.methods;
  2074. if (methods) {
  2075. Object.keys(methods).forEach(function (name) {
  2076. appOptions[name] = methods[name];
  2077. });
  2078. }
  2079. initAppLocale(_vue.default, vm, normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN);
  2080. initHooks(appOptions, hooks);
  2081. initUnknownHooks(appOptions, vm.$options);
  2082. return appOptions;
  2083. }
  2084. function parseApp(vm) {
  2085. return parseBaseApp(vm, {
  2086. mocks: mocks,
  2087. initRefs: initRefs
  2088. });
  2089. }
  2090. function createApp(vm) {
  2091. App(parseApp(vm));
  2092. return vm;
  2093. }
  2094. var encodeReserveRE = /[!'()*]/g;
  2095. var encodeReserveReplacer = function encodeReserveReplacer(c) {
  2096. return '%' + c.charCodeAt(0).toString(16);
  2097. };
  2098. var commaRE = /%2C/g;
  2099. // fixed encodeURIComponent which is more conformant to RFC3986:
  2100. // - escapes [!'()*]
  2101. // - preserve commas
  2102. var encode = function encode(str) {
  2103. return encodeURIComponent(str).replace(encodeReserveRE, encodeReserveReplacer).replace(commaRE, ',');
  2104. };
  2105. function stringifyQuery(obj) {
  2106. var encodeStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : encode;
  2107. var res = obj ? Object.keys(obj).map(function (key) {
  2108. var val = obj[key];
  2109. if (val === undefined) {
  2110. return '';
  2111. }
  2112. if (val === null) {
  2113. return encodeStr(key);
  2114. }
  2115. if (Array.isArray(val)) {
  2116. var result = [];
  2117. val.forEach(function (val2) {
  2118. if (val2 === undefined) {
  2119. return;
  2120. }
  2121. if (val2 === null) {
  2122. result.push(encodeStr(key));
  2123. } else {
  2124. result.push(encodeStr(key) + '=' + encodeStr(val2));
  2125. }
  2126. });
  2127. return result.join('&');
  2128. }
  2129. return encodeStr(key) + '=' + encodeStr(val);
  2130. }).filter(function (x) {
  2131. return x.length > 0;
  2132. }).join('&') : null;
  2133. return res ? "?".concat(res) : '';
  2134. }
  2135. function parseBaseComponent(vueComponentOptions) {
  2136. var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  2137. isPage = _ref5.isPage,
  2138. initRelation = _ref5.initRelation;
  2139. var needVueOptions = arguments.length > 2 ? arguments[2] : undefined;
  2140. var _initVueComponent = initVueComponent(_vue.default, vueComponentOptions),
  2141. _initVueComponent2 = (0, _slicedToArray2.default)(_initVueComponent, 2),
  2142. VueComponent = _initVueComponent2[0],
  2143. vueOptions = _initVueComponent2[1];
  2144. var options = _objectSpread({
  2145. multipleSlots: true,
  2146. // styleIsolation: 'apply-shared',
  2147. addGlobalClass: true
  2148. }, vueOptions.options || {});
  2149. {
  2150. // 微信 multipleSlots 部分情况有 bug,导致内容顺序错乱 如 u-list,提供覆盖选项
  2151. if (vueOptions['mp-weixin'] && vueOptions['mp-weixin'].options) {
  2152. Object.assign(options, vueOptions['mp-weixin'].options);
  2153. }
  2154. }
  2155. var componentOptions = {
  2156. options: options,
  2157. data: initData(vueOptions, _vue.default.prototype),
  2158. behaviors: initBehaviors(vueOptions, initBehavior),
  2159. properties: initProperties(vueOptions.props, false, vueOptions.__file, options),
  2160. lifetimes: {
  2161. attached: function attached() {
  2162. var properties = this.properties;
  2163. var options = {
  2164. mpType: isPage.call(this) ? 'page' : 'component',
  2165. mpInstance: this,
  2166. propsData: properties
  2167. };
  2168. initVueIds(properties.vueId, this);
  2169. // 处理父子关系
  2170. initRelation.call(this, {
  2171. vuePid: this._$vuePid,
  2172. vueOptions: options
  2173. });
  2174. // 初始化 vue 实例
  2175. this.$vm = new VueComponent(options);
  2176. // 处理$slots,$scopedSlots(暂不支持动态变化$slots)
  2177. initSlots(this.$vm, properties.vueSlots);
  2178. // 触发首次 setData
  2179. this.$vm.$mount();
  2180. },
  2181. ready: function ready() {
  2182. // 当组件 props 默认值为 true,初始化时传入 false 会导致 created,ready 触发, 但 attached 不触发
  2183. // https://developers.weixin.qq.com/community/develop/doc/00066ae2844cc0f8eb883e2a557800
  2184. if (this.$vm) {
  2185. this.$vm._isMounted = true;
  2186. this.$vm.__call_hook('mounted');
  2187. this.$vm.__call_hook('onReady');
  2188. }
  2189. },
  2190. detached: function detached() {
  2191. this.$vm && this.$vm.$destroy();
  2192. }
  2193. },
  2194. pageLifetimes: {
  2195. show: function show(args) {
  2196. this.$vm && this.$vm.__call_hook('onPageShow', args);
  2197. },
  2198. hide: function hide() {
  2199. this.$vm && this.$vm.__call_hook('onPageHide');
  2200. },
  2201. resize: function resize(size) {
  2202. this.$vm && this.$vm.__call_hook('onPageResize', size);
  2203. }
  2204. },
  2205. methods: {
  2206. __l: handleLink,
  2207. __e: handleEvent
  2208. }
  2209. };
  2210. // externalClasses
  2211. if (vueOptions.externalClasses) {
  2212. componentOptions.externalClasses = vueOptions.externalClasses;
  2213. }
  2214. if (Array.isArray(vueOptions.wxsCallMethods)) {
  2215. vueOptions.wxsCallMethods.forEach(function (callMethod) {
  2216. componentOptions.methods[callMethod] = function (args) {
  2217. return this.$vm[callMethod](args);
  2218. };
  2219. });
  2220. }
  2221. if (needVueOptions) {
  2222. return [componentOptions, vueOptions, VueComponent];
  2223. }
  2224. if (isPage) {
  2225. return componentOptions;
  2226. }
  2227. return [componentOptions, VueComponent];
  2228. }
  2229. function parseComponent(vueComponentOptions, needVueOptions) {
  2230. return parseBaseComponent(vueComponentOptions, {
  2231. isPage: isPage,
  2232. initRelation: initRelation
  2233. }, needVueOptions);
  2234. }
  2235. var hooks$1 = ['onShow', 'onHide', 'onUnload'];
  2236. hooks$1.push.apply(hooks$1, PAGE_EVENT_HOOKS);
  2237. function parseBasePage(vuePageOptions) {
  2238. var _parseComponent = parseComponent(vuePageOptions, true),
  2239. _parseComponent2 = (0, _slicedToArray2.default)(_parseComponent, 2),
  2240. pageOptions = _parseComponent2[0],
  2241. vueOptions = _parseComponent2[1];
  2242. initHooks(pageOptions.methods, hooks$1, vueOptions);
  2243. pageOptions.methods.onLoad = function (query) {
  2244. this.options = query;
  2245. var copyQuery = Object.assign({}, query);
  2246. delete copyQuery.__id__;
  2247. this.$page = {
  2248. fullPath: '/' + (this.route || this.is) + stringifyQuery(copyQuery)
  2249. };
  2250. this.$vm.$mp.query = query; // 兼容 mpvue
  2251. this.$vm.__call_hook('onLoad', query);
  2252. };
  2253. {
  2254. initUnknownHooks(pageOptions.methods, vuePageOptions, ['onReady']);
  2255. }
  2256. {
  2257. initWorkletMethods(pageOptions.methods, vueOptions.methods);
  2258. }
  2259. return pageOptions;
  2260. }
  2261. function parsePage(vuePageOptions) {
  2262. return parseBasePage(vuePageOptions);
  2263. }
  2264. function createPage(vuePageOptions) {
  2265. {
  2266. return Component(parsePage(vuePageOptions));
  2267. }
  2268. }
  2269. function createComponent(vueOptions) {
  2270. {
  2271. return Component(parseComponent(vueOptions));
  2272. }
  2273. }
  2274. function createSubpackageApp(vm) {
  2275. var appOptions = parseApp(vm);
  2276. var app = getApp({
  2277. allowDefault: true
  2278. });
  2279. vm.$scope = app;
  2280. var globalData = app.globalData;
  2281. if (globalData) {
  2282. Object.keys(appOptions.globalData).forEach(function (name) {
  2283. if (!hasOwn(globalData, name)) {
  2284. globalData[name] = appOptions.globalData[name];
  2285. }
  2286. });
  2287. }
  2288. Object.keys(appOptions).forEach(function (name) {
  2289. if (!hasOwn(app, name)) {
  2290. app[name] = appOptions[name];
  2291. }
  2292. });
  2293. if (isFn(appOptions.onShow) && wx.onAppShow) {
  2294. wx.onAppShow(function () {
  2295. for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
  2296. args[_key5] = arguments[_key5];
  2297. }
  2298. vm.__call_hook('onShow', args);
  2299. });
  2300. }
  2301. if (isFn(appOptions.onHide) && wx.onAppHide) {
  2302. wx.onAppHide(function () {
  2303. for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
  2304. args[_key6] = arguments[_key6];
  2305. }
  2306. vm.__call_hook('onHide', args);
  2307. });
  2308. }
  2309. if (isFn(appOptions.onLaunch)) {
  2310. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  2311. vm.__call_hook('onLaunch', args);
  2312. }
  2313. return vm;
  2314. }
  2315. function createPlugin(vm) {
  2316. var appOptions = parseApp(vm);
  2317. if (isFn(appOptions.onShow) && wx.onAppShow) {
  2318. wx.onAppShow(function () {
  2319. for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
  2320. args[_key7] = arguments[_key7];
  2321. }
  2322. vm.__call_hook('onShow', args);
  2323. });
  2324. }
  2325. if (isFn(appOptions.onHide) && wx.onAppHide) {
  2326. wx.onAppHide(function () {
  2327. for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
  2328. args[_key8] = arguments[_key8];
  2329. }
  2330. vm.__call_hook('onHide', args);
  2331. });
  2332. }
  2333. if (isFn(appOptions.onLaunch)) {
  2334. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  2335. vm.__call_hook('onLaunch', args);
  2336. }
  2337. return vm;
  2338. }
  2339. todos.forEach(function (todoApi) {
  2340. protocols[todoApi] = false;
  2341. });
  2342. canIUses.forEach(function (canIUseApi) {
  2343. var apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name : canIUseApi;
  2344. if (!wx.canIUse(apiName)) {
  2345. protocols[canIUseApi] = false;
  2346. }
  2347. });
  2348. var uni = {};
  2349. if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') {
  2350. uni = new Proxy({}, {
  2351. get: function get(target, name) {
  2352. if (hasOwn(target, name)) {
  2353. return target[name];
  2354. }
  2355. if (baseApi[name]) {
  2356. return baseApi[name];
  2357. }
  2358. if (api[name]) {
  2359. return promisify(name, api[name]);
  2360. }
  2361. {
  2362. if (extraApi[name]) {
  2363. return promisify(name, extraApi[name]);
  2364. }
  2365. if (todoApis[name]) {
  2366. return promisify(name, todoApis[name]);
  2367. }
  2368. }
  2369. if (eventApi[name]) {
  2370. return eventApi[name];
  2371. }
  2372. return promisify(name, wrapper(name, wx[name]));
  2373. },
  2374. set: function set(target, name, value) {
  2375. target[name] = value;
  2376. return true;
  2377. }
  2378. });
  2379. } else {
  2380. Object.keys(baseApi).forEach(function (name) {
  2381. uni[name] = baseApi[name];
  2382. });
  2383. {
  2384. Object.keys(todoApis).forEach(function (name) {
  2385. uni[name] = promisify(name, todoApis[name]);
  2386. });
  2387. Object.keys(extraApi).forEach(function (name) {
  2388. uni[name] = promisify(name, extraApi[name]);
  2389. });
  2390. }
  2391. Object.keys(eventApi).forEach(function (name) {
  2392. uni[name] = eventApi[name];
  2393. });
  2394. Object.keys(api).forEach(function (name) {
  2395. uni[name] = promisify(name, api[name]);
  2396. });
  2397. Object.keys(wx).forEach(function (name) {
  2398. if (hasOwn(wx, name) || hasOwn(protocols, name)) {
  2399. uni[name] = promisify(name, wrapper(name, wx[name]));
  2400. }
  2401. });
  2402. }
  2403. wx.createApp = createApp;
  2404. wx.createPage = createPage;
  2405. wx.createComponent = createComponent;
  2406. wx.createSubpackageApp = createSubpackageApp;
  2407. wx.createPlugin = createPlugin;
  2408. var uni$1 = uni;
  2409. var _default = uni$1;
  2410. exports.default = _default;
  2411. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"], __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 3)))
  2412. /***/ }),
  2413. /* 3 */
  2414. /*!***********************************!*\
  2415. !*** (webpack)/buildin/global.js ***!
  2416. \***********************************/
  2417. /*! no static exports found */
  2418. /***/ (function(module, exports) {
  2419. var g;
  2420. // This works in non-strict mode
  2421. g = (function() {
  2422. return this;
  2423. })();
  2424. try {
  2425. // This works if eval is allowed (see CSP)
  2426. g = g || new Function("return this")();
  2427. } catch (e) {
  2428. // This works if the window reference is available
  2429. if (typeof window === "object") g = window;
  2430. }
  2431. // g can still be undefined, but nothing to do about it...
  2432. // We return undefined, instead of nothing here, so it's
  2433. // easier to handle this case. if(!global) { ...}
  2434. module.exports = g;
  2435. /***/ }),
  2436. /* 4 */
  2437. /*!**********************************************************************!*\
  2438. !*** ./node_modules/@babel/runtime/helpers/interopRequireDefault.js ***!
  2439. \**********************************************************************/
  2440. /*! no static exports found */
  2441. /***/ (function(module, exports) {
  2442. function _interopRequireDefault(obj) {
  2443. return obj && obj.__esModule ? obj : {
  2444. "default": obj
  2445. };
  2446. }
  2447. module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2448. /***/ }),
  2449. /* 5 */
  2450. /*!**************************************************************!*\
  2451. !*** ./node_modules/@babel/runtime/helpers/slicedToArray.js ***!
  2452. \**************************************************************/
  2453. /*! no static exports found */
  2454. /***/ (function(module, exports, __webpack_require__) {
  2455. var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles.js */ 6);
  2456. var iterableToArrayLimit = __webpack_require__(/*! ./iterableToArrayLimit.js */ 7);
  2457. var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ 8);
  2458. var nonIterableRest = __webpack_require__(/*! ./nonIterableRest.js */ 10);
  2459. function _slicedToArray(arr, i) {
  2460. return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
  2461. }
  2462. module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2463. /***/ }),
  2464. /* 6 */
  2465. /*!***************************************************************!*\
  2466. !*** ./node_modules/@babel/runtime/helpers/arrayWithHoles.js ***!
  2467. \***************************************************************/
  2468. /*! no static exports found */
  2469. /***/ (function(module, exports) {
  2470. function _arrayWithHoles(arr) {
  2471. if (Array.isArray(arr)) return arr;
  2472. }
  2473. module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2474. /***/ }),
  2475. /* 7 */
  2476. /*!*********************************************************************!*\
  2477. !*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
  2478. \*********************************************************************/
  2479. /*! no static exports found */
  2480. /***/ (function(module, exports) {
  2481. function _iterableToArrayLimit(arr, i) {
  2482. var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
  2483. if (null != _i) {
  2484. var _s,
  2485. _e,
  2486. _x,
  2487. _r,
  2488. _arr = [],
  2489. _n = !0,
  2490. _d = !1;
  2491. try {
  2492. if (_x = (_i = _i.call(arr)).next, 0 === i) {
  2493. if (Object(_i) !== _i) return;
  2494. _n = !1;
  2495. } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) {
  2496. ;
  2497. }
  2498. } catch (err) {
  2499. _d = !0, _e = err;
  2500. } finally {
  2501. try {
  2502. if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
  2503. } finally {
  2504. if (_d) throw _e;
  2505. }
  2506. }
  2507. return _arr;
  2508. }
  2509. }
  2510. module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2511. /***/ }),
  2512. /* 8 */
  2513. /*!***************************************************************************!*\
  2514. !*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!
  2515. \***************************************************************************/
  2516. /*! no static exports found */
  2517. /***/ (function(module, exports, __webpack_require__) {
  2518. var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ 9);
  2519. function _unsupportedIterableToArray(o, minLen) {
  2520. if (!o) return;
  2521. if (typeof o === "string") return arrayLikeToArray(o, minLen);
  2522. var n = Object.prototype.toString.call(o).slice(8, -1);
  2523. if (n === "Object" && o.constructor) n = o.constructor.name;
  2524. if (n === "Map" || n === "Set") return Array.from(o);
  2525. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
  2526. }
  2527. module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2528. /***/ }),
  2529. /* 9 */
  2530. /*!*****************************************************************!*\
  2531. !*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***!
  2532. \*****************************************************************/
  2533. /*! no static exports found */
  2534. /***/ (function(module, exports) {
  2535. function _arrayLikeToArray(arr, len) {
  2536. if (len == null || len > arr.length) len = arr.length;
  2537. for (var i = 0, arr2 = new Array(len); i < len; i++) {
  2538. arr2[i] = arr[i];
  2539. }
  2540. return arr2;
  2541. }
  2542. module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2543. /***/ }),
  2544. /* 10 */
  2545. /*!****************************************************************!*\
  2546. !*** ./node_modules/@babel/runtime/helpers/nonIterableRest.js ***!
  2547. \****************************************************************/
  2548. /*! no static exports found */
  2549. /***/ (function(module, exports) {
  2550. function _nonIterableRest() {
  2551. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  2552. }
  2553. module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2554. /***/ }),
  2555. /* 11 */
  2556. /*!***************************************************************!*\
  2557. !*** ./node_modules/@babel/runtime/helpers/defineProperty.js ***!
  2558. \***************************************************************/
  2559. /*! no static exports found */
  2560. /***/ (function(module, exports, __webpack_require__) {
  2561. var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ 12);
  2562. function _defineProperty(obj, key, value) {
  2563. key = toPropertyKey(key);
  2564. if (key in obj) {
  2565. Object.defineProperty(obj, key, {
  2566. value: value,
  2567. enumerable: true,
  2568. configurable: true,
  2569. writable: true
  2570. });
  2571. } else {
  2572. obj[key] = value;
  2573. }
  2574. return obj;
  2575. }
  2576. module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2577. /***/ }),
  2578. /* 12 */
  2579. /*!**************************************************************!*\
  2580. !*** ./node_modules/@babel/runtime/helpers/toPropertyKey.js ***!
  2581. \**************************************************************/
  2582. /*! no static exports found */
  2583. /***/ (function(module, exports, __webpack_require__) {
  2584. var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
  2585. var toPrimitive = __webpack_require__(/*! ./toPrimitive.js */ 14);
  2586. function _toPropertyKey(arg) {
  2587. var key = toPrimitive(arg, "string");
  2588. return _typeof(key) === "symbol" ? key : String(key);
  2589. }
  2590. module.exports = _toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2591. /***/ }),
  2592. /* 13 */
  2593. /*!*******************************************************!*\
  2594. !*** ./node_modules/@babel/runtime/helpers/typeof.js ***!
  2595. \*******************************************************/
  2596. /*! no static exports found */
  2597. /***/ (function(module, exports) {
  2598. function _typeof(obj) {
  2599. "@babel/helpers - typeof";
  2600. return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
  2601. return typeof obj;
  2602. } : function (obj) {
  2603. return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  2604. }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
  2605. }
  2606. module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2607. /***/ }),
  2608. /* 14 */
  2609. /*!************************************************************!*\
  2610. !*** ./node_modules/@babel/runtime/helpers/toPrimitive.js ***!
  2611. \************************************************************/
  2612. /*! no static exports found */
  2613. /***/ (function(module, exports, __webpack_require__) {
  2614. var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
  2615. function _toPrimitive(input, hint) {
  2616. if (_typeof(input) !== "object" || input === null) return input;
  2617. var prim = input[Symbol.toPrimitive];
  2618. if (prim !== undefined) {
  2619. var res = prim.call(input, hint || "default");
  2620. if (_typeof(res) !== "object") return res;
  2621. throw new TypeError("@@toPrimitive must return a primitive value.");
  2622. }
  2623. return (hint === "string" ? String : Number)(input);
  2624. }
  2625. module.exports = _toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2626. /***/ }),
  2627. /* 15 */
  2628. /*!**********************************************************!*\
  2629. !*** ./node_modules/@babel/runtime/helpers/construct.js ***!
  2630. \**********************************************************/
  2631. /*! no static exports found */
  2632. /***/ (function(module, exports, __webpack_require__) {
  2633. var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ 16);
  2634. var isNativeReflectConstruct = __webpack_require__(/*! ./isNativeReflectConstruct.js */ 17);
  2635. function _construct(Parent, args, Class) {
  2636. if (isNativeReflectConstruct()) {
  2637. module.exports = _construct = Reflect.construct.bind(), module.exports.__esModule = true, module.exports["default"] = module.exports;
  2638. } else {
  2639. module.exports = _construct = function _construct(Parent, args, Class) {
  2640. var a = [null];
  2641. a.push.apply(a, args);
  2642. var Constructor = Function.bind.apply(Parent, a);
  2643. var instance = new Constructor();
  2644. if (Class) setPrototypeOf(instance, Class.prototype);
  2645. return instance;
  2646. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2647. }
  2648. return _construct.apply(null, arguments);
  2649. }
  2650. module.exports = _construct, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2651. /***/ }),
  2652. /* 16 */
  2653. /*!***************************************************************!*\
  2654. !*** ./node_modules/@babel/runtime/helpers/setPrototypeOf.js ***!
  2655. \***************************************************************/
  2656. /*! no static exports found */
  2657. /***/ (function(module, exports) {
  2658. function _setPrototypeOf(o, p) {
  2659. module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
  2660. o.__proto__ = p;
  2661. return o;
  2662. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2663. return _setPrototypeOf(o, p);
  2664. }
  2665. module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2666. /***/ }),
  2667. /* 17 */
  2668. /*!*************************************************************************!*\
  2669. !*** ./node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js ***!
  2670. \*************************************************************************/
  2671. /*! no static exports found */
  2672. /***/ (function(module, exports) {
  2673. function _isNativeReflectConstruct() {
  2674. if (typeof Reflect === "undefined" || !Reflect.construct) return false;
  2675. if (Reflect.construct.sham) return false;
  2676. if (typeof Proxy === "function") return true;
  2677. try {
  2678. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
  2679. return true;
  2680. } catch (e) {
  2681. return false;
  2682. }
  2683. }
  2684. module.exports = _isNativeReflectConstruct, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2685. /***/ }),
  2686. /* 18 */
  2687. /*!******************************************************************!*\
  2688. !*** ./node_modules/@babel/runtime/helpers/toConsumableArray.js ***!
  2689. \******************************************************************/
  2690. /*! no static exports found */
  2691. /***/ (function(module, exports, __webpack_require__) {
  2692. var arrayWithoutHoles = __webpack_require__(/*! ./arrayWithoutHoles.js */ 19);
  2693. var iterableToArray = __webpack_require__(/*! ./iterableToArray.js */ 20);
  2694. var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ 8);
  2695. var nonIterableSpread = __webpack_require__(/*! ./nonIterableSpread.js */ 21);
  2696. function _toConsumableArray(arr) {
  2697. return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
  2698. }
  2699. module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2700. /***/ }),
  2701. /* 19 */
  2702. /*!******************************************************************!*\
  2703. !*** ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***!
  2704. \******************************************************************/
  2705. /*! no static exports found */
  2706. /***/ (function(module, exports, __webpack_require__) {
  2707. var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ 9);
  2708. function _arrayWithoutHoles(arr) {
  2709. if (Array.isArray(arr)) return arrayLikeToArray(arr);
  2710. }
  2711. module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2712. /***/ }),
  2713. /* 20 */
  2714. /*!****************************************************************!*\
  2715. !*** ./node_modules/@babel/runtime/helpers/iterableToArray.js ***!
  2716. \****************************************************************/
  2717. /*! no static exports found */
  2718. /***/ (function(module, exports) {
  2719. function _iterableToArray(iter) {
  2720. if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
  2721. }
  2722. module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2723. /***/ }),
  2724. /* 21 */
  2725. /*!******************************************************************!*\
  2726. !*** ./node_modules/@babel/runtime/helpers/nonIterableSpread.js ***!
  2727. \******************************************************************/
  2728. /*! no static exports found */
  2729. /***/ (function(module, exports) {
  2730. function _nonIterableSpread() {
  2731. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  2732. }
  2733. module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2734. /***/ }),
  2735. /* 22 */
  2736. /*!*************************************************************!*\
  2737. !*** ./node_modules/@dcloudio/uni-i18n/dist/uni-i18n.es.js ***!
  2738. \*************************************************************/
  2739. /*! no static exports found */
  2740. /***/ (function(module, exports, __webpack_require__) {
  2741. "use strict";
  2742. /* WEBPACK VAR INJECTION */(function(uni, global) {
  2743. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  2744. Object.defineProperty(exports, "__esModule", {
  2745. value: true
  2746. });
  2747. exports.LOCALE_ZH_HANT = exports.LOCALE_ZH_HANS = exports.LOCALE_FR = exports.LOCALE_ES = exports.LOCALE_EN = exports.I18n = exports.Formatter = void 0;
  2748. exports.compileI18nJsonStr = compileI18nJsonStr;
  2749. exports.hasI18nJson = hasI18nJson;
  2750. exports.initVueI18n = initVueI18n;
  2751. exports.isI18nStr = isI18nStr;
  2752. exports.isString = void 0;
  2753. exports.normalizeLocale = normalizeLocale;
  2754. exports.parseI18nJson = parseI18nJson;
  2755. exports.resolveLocale = resolveLocale;
  2756. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
  2757. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
  2758. var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
  2759. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  2760. var isObject = function isObject(val) {
  2761. return val !== null && (0, _typeof2.default)(val) === 'object';
  2762. };
  2763. var defaultDelimiters = ['{', '}'];
  2764. var BaseFormatter = /*#__PURE__*/function () {
  2765. function BaseFormatter() {
  2766. (0, _classCallCheck2.default)(this, BaseFormatter);
  2767. this._caches = Object.create(null);
  2768. }
  2769. (0, _createClass2.default)(BaseFormatter, [{
  2770. key: "interpolate",
  2771. value: function interpolate(message, values) {
  2772. var delimiters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultDelimiters;
  2773. if (!values) {
  2774. return [message];
  2775. }
  2776. var tokens = this._caches[message];
  2777. if (!tokens) {
  2778. tokens = parse(message, delimiters);
  2779. this._caches[message] = tokens;
  2780. }
  2781. return compile(tokens, values);
  2782. }
  2783. }]);
  2784. return BaseFormatter;
  2785. }();
  2786. exports.Formatter = BaseFormatter;
  2787. var RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
  2788. var RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
  2789. function parse(format, _ref) {
  2790. var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
  2791. startDelimiter = _ref2[0],
  2792. endDelimiter = _ref2[1];
  2793. var tokens = [];
  2794. var position = 0;
  2795. var text = '';
  2796. while (position < format.length) {
  2797. var char = format[position++];
  2798. if (char === startDelimiter) {
  2799. if (text) {
  2800. tokens.push({
  2801. type: 'text',
  2802. value: text
  2803. });
  2804. }
  2805. text = '';
  2806. var sub = '';
  2807. char = format[position++];
  2808. while (char !== undefined && char !== endDelimiter) {
  2809. sub += char;
  2810. char = format[position++];
  2811. }
  2812. var isClosed = char === endDelimiter;
  2813. var type = RE_TOKEN_LIST_VALUE.test(sub) ? 'list' : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ? 'named' : 'unknown';
  2814. tokens.push({
  2815. value: sub,
  2816. type: type
  2817. });
  2818. }
  2819. // else if (char === '%') {
  2820. // // when found rails i18n syntax, skip text capture
  2821. // if (format[position] !== '{') {
  2822. // text += char
  2823. // }
  2824. // }
  2825. else {
  2826. text += char;
  2827. }
  2828. }
  2829. text && tokens.push({
  2830. type: 'text',
  2831. value: text
  2832. });
  2833. return tokens;
  2834. }
  2835. function compile(tokens, values) {
  2836. var compiled = [];
  2837. var index = 0;
  2838. var mode = Array.isArray(values) ? 'list' : isObject(values) ? 'named' : 'unknown';
  2839. if (mode === 'unknown') {
  2840. return compiled;
  2841. }
  2842. while (index < tokens.length) {
  2843. var token = tokens[index];
  2844. switch (token.type) {
  2845. case 'text':
  2846. compiled.push(token.value);
  2847. break;
  2848. case 'list':
  2849. compiled.push(values[parseInt(token.value, 10)]);
  2850. break;
  2851. case 'named':
  2852. if (mode === 'named') {
  2853. compiled.push(values[token.value]);
  2854. } else {
  2855. if (true) {
  2856. console.warn("Type of token '".concat(token.type, "' and format of value '").concat(mode, "' don't match!"));
  2857. }
  2858. }
  2859. break;
  2860. case 'unknown':
  2861. if (true) {
  2862. console.warn("Detect 'unknown' type of token!");
  2863. }
  2864. break;
  2865. }
  2866. index++;
  2867. }
  2868. return compiled;
  2869. }
  2870. var LOCALE_ZH_HANS = 'zh-Hans';
  2871. exports.LOCALE_ZH_HANS = LOCALE_ZH_HANS;
  2872. var LOCALE_ZH_HANT = 'zh-Hant';
  2873. exports.LOCALE_ZH_HANT = LOCALE_ZH_HANT;
  2874. var LOCALE_EN = 'en';
  2875. exports.LOCALE_EN = LOCALE_EN;
  2876. var LOCALE_FR = 'fr';
  2877. exports.LOCALE_FR = LOCALE_FR;
  2878. var LOCALE_ES = 'es';
  2879. exports.LOCALE_ES = LOCALE_ES;
  2880. var hasOwnProperty = Object.prototype.hasOwnProperty;
  2881. var hasOwn = function hasOwn(val, key) {
  2882. return hasOwnProperty.call(val, key);
  2883. };
  2884. var defaultFormatter = new BaseFormatter();
  2885. function include(str, parts) {
  2886. return !!parts.find(function (part) {
  2887. return str.indexOf(part) !== -1;
  2888. });
  2889. }
  2890. function startsWith(str, parts) {
  2891. return parts.find(function (part) {
  2892. return str.indexOf(part) === 0;
  2893. });
  2894. }
  2895. function normalizeLocale(locale, messages) {
  2896. if (!locale) {
  2897. return;
  2898. }
  2899. locale = locale.trim().replace(/_/g, '-');
  2900. if (messages && messages[locale]) {
  2901. return locale;
  2902. }
  2903. locale = locale.toLowerCase();
  2904. if (locale === 'chinese') {
  2905. // 支付宝
  2906. return LOCALE_ZH_HANS;
  2907. }
  2908. if (locale.indexOf('zh') === 0) {
  2909. if (locale.indexOf('-hans') > -1) {
  2910. return LOCALE_ZH_HANS;
  2911. }
  2912. if (locale.indexOf('-hant') > -1) {
  2913. return LOCALE_ZH_HANT;
  2914. }
  2915. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  2916. return LOCALE_ZH_HANT;
  2917. }
  2918. return LOCALE_ZH_HANS;
  2919. }
  2920. var locales = [LOCALE_EN, LOCALE_FR, LOCALE_ES];
  2921. if (messages && Object.keys(messages).length > 0) {
  2922. locales = Object.keys(messages);
  2923. }
  2924. var lang = startsWith(locale, locales);
  2925. if (lang) {
  2926. return lang;
  2927. }
  2928. }
  2929. var I18n = /*#__PURE__*/function () {
  2930. function I18n(_ref3) {
  2931. var locale = _ref3.locale,
  2932. fallbackLocale = _ref3.fallbackLocale,
  2933. messages = _ref3.messages,
  2934. watcher = _ref3.watcher,
  2935. formater = _ref3.formater;
  2936. (0, _classCallCheck2.default)(this, I18n);
  2937. this.locale = LOCALE_EN;
  2938. this.fallbackLocale = LOCALE_EN;
  2939. this.message = {};
  2940. this.messages = {};
  2941. this.watchers = [];
  2942. if (fallbackLocale) {
  2943. this.fallbackLocale = fallbackLocale;
  2944. }
  2945. this.formater = formater || defaultFormatter;
  2946. this.messages = messages || {};
  2947. this.setLocale(locale || LOCALE_EN);
  2948. if (watcher) {
  2949. this.watchLocale(watcher);
  2950. }
  2951. }
  2952. (0, _createClass2.default)(I18n, [{
  2953. key: "setLocale",
  2954. value: function setLocale(locale) {
  2955. var _this = this;
  2956. var oldLocale = this.locale;
  2957. this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale;
  2958. if (!this.messages[this.locale]) {
  2959. // 可能初始化时不存在
  2960. this.messages[this.locale] = {};
  2961. }
  2962. this.message = this.messages[this.locale];
  2963. // 仅发生变化时,通知
  2964. if (oldLocale !== this.locale) {
  2965. this.watchers.forEach(function (watcher) {
  2966. watcher(_this.locale, oldLocale);
  2967. });
  2968. }
  2969. }
  2970. }, {
  2971. key: "getLocale",
  2972. value: function getLocale() {
  2973. return this.locale;
  2974. }
  2975. }, {
  2976. key: "watchLocale",
  2977. value: function watchLocale(fn) {
  2978. var _this2 = this;
  2979. var index = this.watchers.push(fn) - 1;
  2980. return function () {
  2981. _this2.watchers.splice(index, 1);
  2982. };
  2983. }
  2984. }, {
  2985. key: "add",
  2986. value: function add(locale, message) {
  2987. var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  2988. var curMessages = this.messages[locale];
  2989. if (curMessages) {
  2990. if (override) {
  2991. Object.assign(curMessages, message);
  2992. } else {
  2993. Object.keys(message).forEach(function (key) {
  2994. if (!hasOwn(curMessages, key)) {
  2995. curMessages[key] = message[key];
  2996. }
  2997. });
  2998. }
  2999. } else {
  3000. this.messages[locale] = message;
  3001. }
  3002. }
  3003. }, {
  3004. key: "f",
  3005. value: function f(message, values, delimiters) {
  3006. return this.formater.interpolate(message, values, delimiters).join('');
  3007. }
  3008. }, {
  3009. key: "t",
  3010. value: function t(key, locale, values) {
  3011. var message = this.message;
  3012. if (typeof locale === 'string') {
  3013. locale = normalizeLocale(locale, this.messages);
  3014. locale && (message = this.messages[locale]);
  3015. } else {
  3016. values = locale;
  3017. }
  3018. if (!hasOwn(message, key)) {
  3019. console.warn("Cannot translate the value of keypath ".concat(key, ". Use the value of keypath as default."));
  3020. return key;
  3021. }
  3022. return this.formater.interpolate(message[key], values).join('');
  3023. }
  3024. }]);
  3025. return I18n;
  3026. }();
  3027. exports.I18n = I18n;
  3028. function watchAppLocale(appVm, i18n) {
  3029. // 需要保证 watch 的触发在组件渲染之前
  3030. if (appVm.$watchLocale) {
  3031. // vue2
  3032. appVm.$watchLocale(function (newLocale) {
  3033. i18n.setLocale(newLocale);
  3034. });
  3035. } else {
  3036. appVm.$watch(function () {
  3037. return appVm.$locale;
  3038. }, function (newLocale) {
  3039. i18n.setLocale(newLocale);
  3040. });
  3041. }
  3042. }
  3043. function getDefaultLocale() {
  3044. if (typeof uni !== 'undefined' && uni.getLocale) {
  3045. return uni.getLocale();
  3046. }
  3047. // 小程序平台,uni 和 uni-i18n 互相引用,导致访问不到 uni,故在 global 上挂了 getLocale
  3048. if (typeof global !== 'undefined' && global.getLocale) {
  3049. return global.getLocale();
  3050. }
  3051. return LOCALE_EN;
  3052. }
  3053. function initVueI18n(locale) {
  3054. var messages = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  3055. var fallbackLocale = arguments.length > 2 ? arguments[2] : undefined;
  3056. var watcher = arguments.length > 3 ? arguments[3] : undefined;
  3057. // 兼容旧版本入参
  3058. if (typeof locale !== 'string') {
  3059. var _ref4 = [messages, locale];
  3060. locale = _ref4[0];
  3061. messages = _ref4[1];
  3062. }
  3063. if (typeof locale !== 'string') {
  3064. // 因为小程序平台,uni-i18n 和 uni 互相引用,导致此时访问 uni 时,为 undefined
  3065. locale = getDefaultLocale();
  3066. }
  3067. if (typeof fallbackLocale !== 'string') {
  3068. fallbackLocale = typeof __uniConfig !== 'undefined' && __uniConfig.fallbackLocale || LOCALE_EN;
  3069. }
  3070. var i18n = new I18n({
  3071. locale: locale,
  3072. fallbackLocale: fallbackLocale,
  3073. messages: messages,
  3074. watcher: watcher
  3075. });
  3076. var _t = function t(key, values) {
  3077. if (typeof getApp !== 'function') {
  3078. // app view
  3079. /* eslint-disable no-func-assign */
  3080. _t = function t(key, values) {
  3081. return i18n.t(key, values);
  3082. };
  3083. } else {
  3084. var isWatchedAppLocale = false;
  3085. _t = function t(key, values) {
  3086. var appVm = getApp().$vm;
  3087. // 可能$vm还不存在,比如在支付宝小程序中,组件定义较早,在props的default里使用了t()函数(如uni-goods-nav),此时app还未初始化
  3088. // options: {
  3089. // type: Array,
  3090. // default () {
  3091. // return [{
  3092. // icon: 'shop',
  3093. // text: t("uni-goods-nav.options.shop"),
  3094. // }, {
  3095. // icon: 'cart',
  3096. // text: t("uni-goods-nav.options.cart")
  3097. // }]
  3098. // }
  3099. // },
  3100. if (appVm) {
  3101. // 触发响应式
  3102. appVm.$locale;
  3103. if (!isWatchedAppLocale) {
  3104. isWatchedAppLocale = true;
  3105. watchAppLocale(appVm, i18n);
  3106. }
  3107. }
  3108. return i18n.t(key, values);
  3109. };
  3110. }
  3111. return _t(key, values);
  3112. };
  3113. return {
  3114. i18n: i18n,
  3115. f: function f(message, values, delimiters) {
  3116. return i18n.f(message, values, delimiters);
  3117. },
  3118. t: function t(key, values) {
  3119. return _t(key, values);
  3120. },
  3121. add: function add(locale, message) {
  3122. var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  3123. return i18n.add(locale, message, override);
  3124. },
  3125. watch: function watch(fn) {
  3126. return i18n.watchLocale(fn);
  3127. },
  3128. getLocale: function getLocale() {
  3129. return i18n.getLocale();
  3130. },
  3131. setLocale: function setLocale(newLocale) {
  3132. return i18n.setLocale(newLocale);
  3133. }
  3134. };
  3135. }
  3136. var isString = function isString(val) {
  3137. return typeof val === 'string';
  3138. };
  3139. exports.isString = isString;
  3140. var formater;
  3141. function hasI18nJson(jsonObj, delimiters) {
  3142. if (!formater) {
  3143. formater = new BaseFormatter();
  3144. }
  3145. return walkJsonObj(jsonObj, function (jsonObj, key) {
  3146. var value = jsonObj[key];
  3147. if (isString(value)) {
  3148. if (isI18nStr(value, delimiters)) {
  3149. return true;
  3150. }
  3151. } else {
  3152. return hasI18nJson(value, delimiters);
  3153. }
  3154. });
  3155. }
  3156. function parseI18nJson(jsonObj, values, delimiters) {
  3157. if (!formater) {
  3158. formater = new BaseFormatter();
  3159. }
  3160. walkJsonObj(jsonObj, function (jsonObj, key) {
  3161. var value = jsonObj[key];
  3162. if (isString(value)) {
  3163. if (isI18nStr(value, delimiters)) {
  3164. jsonObj[key] = compileStr(value, values, delimiters);
  3165. }
  3166. } else {
  3167. parseI18nJson(value, values, delimiters);
  3168. }
  3169. });
  3170. return jsonObj;
  3171. }
  3172. function compileI18nJsonStr(jsonStr, _ref5) {
  3173. var locale = _ref5.locale,
  3174. locales = _ref5.locales,
  3175. delimiters = _ref5.delimiters;
  3176. if (!isI18nStr(jsonStr, delimiters)) {
  3177. return jsonStr;
  3178. }
  3179. if (!formater) {
  3180. formater = new BaseFormatter();
  3181. }
  3182. var localeValues = [];
  3183. Object.keys(locales).forEach(function (name) {
  3184. if (name !== locale) {
  3185. localeValues.push({
  3186. locale: name,
  3187. values: locales[name]
  3188. });
  3189. }
  3190. });
  3191. localeValues.unshift({
  3192. locale: locale,
  3193. values: locales[locale]
  3194. });
  3195. try {
  3196. return JSON.stringify(compileJsonObj(JSON.parse(jsonStr), localeValues, delimiters), null, 2);
  3197. } catch (e) {}
  3198. return jsonStr;
  3199. }
  3200. function isI18nStr(value, delimiters) {
  3201. return value.indexOf(delimiters[0]) > -1;
  3202. }
  3203. function compileStr(value, values, delimiters) {
  3204. return formater.interpolate(value, values, delimiters).join('');
  3205. }
  3206. function compileValue(jsonObj, key, localeValues, delimiters) {
  3207. var value = jsonObj[key];
  3208. if (isString(value)) {
  3209. // 存在国际化
  3210. if (isI18nStr(value, delimiters)) {
  3211. jsonObj[key] = compileStr(value, localeValues[0].values, delimiters);
  3212. if (localeValues.length > 1) {
  3213. // 格式化国际化语言
  3214. var valueLocales = jsonObj[key + 'Locales'] = {};
  3215. localeValues.forEach(function (localValue) {
  3216. valueLocales[localValue.locale] = compileStr(value, localValue.values, delimiters);
  3217. });
  3218. }
  3219. }
  3220. } else {
  3221. compileJsonObj(value, localeValues, delimiters);
  3222. }
  3223. }
  3224. function compileJsonObj(jsonObj, localeValues, delimiters) {
  3225. walkJsonObj(jsonObj, function (jsonObj, key) {
  3226. compileValue(jsonObj, key, localeValues, delimiters);
  3227. });
  3228. return jsonObj;
  3229. }
  3230. function walkJsonObj(jsonObj, walk) {
  3231. if (Array.isArray(jsonObj)) {
  3232. for (var i = 0; i < jsonObj.length; i++) {
  3233. if (walk(jsonObj, i)) {
  3234. return true;
  3235. }
  3236. }
  3237. } else if (isObject(jsonObj)) {
  3238. for (var key in jsonObj) {
  3239. if (walk(jsonObj, key)) {
  3240. return true;
  3241. }
  3242. }
  3243. }
  3244. return false;
  3245. }
  3246. function resolveLocale(locales) {
  3247. return function (locale) {
  3248. if (!locale) {
  3249. return locale;
  3250. }
  3251. locale = normalizeLocale(locale) || locale;
  3252. return resolveLocaleChain(locale).find(function (locale) {
  3253. return locales.indexOf(locale) > -1;
  3254. });
  3255. };
  3256. }
  3257. function resolveLocaleChain(locale) {
  3258. var chain = [];
  3259. var tokens = locale.split('-');
  3260. while (tokens.length) {
  3261. chain.push(tokens.join('-'));
  3262. tokens.pop();
  3263. }
  3264. return chain;
  3265. }
  3266. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"], __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 3)))
  3267. /***/ }),
  3268. /* 23 */
  3269. /*!***************************************************************!*\
  3270. !*** ./node_modules/@babel/runtime/helpers/classCallCheck.js ***!
  3271. \***************************************************************/
  3272. /*! no static exports found */
  3273. /***/ (function(module, exports) {
  3274. function _classCallCheck(instance, Constructor) {
  3275. if (!(instance instanceof Constructor)) {
  3276. throw new TypeError("Cannot call a class as a function");
  3277. }
  3278. }
  3279. module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3280. /***/ }),
  3281. /* 24 */
  3282. /*!************************************************************!*\
  3283. !*** ./node_modules/@babel/runtime/helpers/createClass.js ***!
  3284. \************************************************************/
  3285. /*! no static exports found */
  3286. /***/ (function(module, exports, __webpack_require__) {
  3287. var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ 12);
  3288. function _defineProperties(target, props) {
  3289. for (var i = 0; i < props.length; i++) {
  3290. var descriptor = props[i];
  3291. descriptor.enumerable = descriptor.enumerable || false;
  3292. descriptor.configurable = true;
  3293. if ("value" in descriptor) descriptor.writable = true;
  3294. Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
  3295. }
  3296. }
  3297. function _createClass(Constructor, protoProps, staticProps) {
  3298. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  3299. if (staticProps) _defineProperties(Constructor, staticProps);
  3300. Object.defineProperty(Constructor, "prototype", {
  3301. writable: false
  3302. });
  3303. return Constructor;
  3304. }
  3305. module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3306. /***/ }),
  3307. /* 25 */
  3308. /*!******************************************************************************************!*\
  3309. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js ***!
  3310. \******************************************************************************************/
  3311. /*! exports provided: default */
  3312. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3313. "use strict";
  3314. __webpack_require__.r(__webpack_exports__);
  3315. /* WEBPACK VAR INJECTION */(function(global) {/*!
  3316. * Vue.js v2.6.11
  3317. * (c) 2014-2023 Evan You
  3318. * Released under the MIT License.
  3319. */
  3320. /* */
  3321. var emptyObject = Object.freeze({});
  3322. // These helpers produce better VM code in JS engines due to their
  3323. // explicitness and function inlining.
  3324. function isUndef (v) {
  3325. return v === undefined || v === null
  3326. }
  3327. function isDef (v) {
  3328. return v !== undefined && v !== null
  3329. }
  3330. function isTrue (v) {
  3331. return v === true
  3332. }
  3333. function isFalse (v) {
  3334. return v === false
  3335. }
  3336. /**
  3337. * Check if value is primitive.
  3338. */
  3339. function isPrimitive (value) {
  3340. return (
  3341. typeof value === 'string' ||
  3342. typeof value === 'number' ||
  3343. // $flow-disable-line
  3344. typeof value === 'symbol' ||
  3345. typeof value === 'boolean'
  3346. )
  3347. }
  3348. /**
  3349. * Quick object check - this is primarily used to tell
  3350. * Objects from primitive values when we know the value
  3351. * is a JSON-compliant type.
  3352. */
  3353. function isObject (obj) {
  3354. return obj !== null && typeof obj === 'object'
  3355. }
  3356. /**
  3357. * Get the raw type string of a value, e.g., [object Object].
  3358. */
  3359. var _toString = Object.prototype.toString;
  3360. function toRawType (value) {
  3361. return _toString.call(value).slice(8, -1)
  3362. }
  3363. /**
  3364. * Strict object type check. Only returns true
  3365. * for plain JavaScript objects.
  3366. */
  3367. function isPlainObject (obj) {
  3368. return _toString.call(obj) === '[object Object]'
  3369. }
  3370. function isRegExp (v) {
  3371. return _toString.call(v) === '[object RegExp]'
  3372. }
  3373. /**
  3374. * Check if val is a valid array index.
  3375. */
  3376. function isValidArrayIndex (val) {
  3377. var n = parseFloat(String(val));
  3378. return n >= 0 && Math.floor(n) === n && isFinite(val)
  3379. }
  3380. function isPromise (val) {
  3381. return (
  3382. isDef(val) &&
  3383. typeof val.then === 'function' &&
  3384. typeof val.catch === 'function'
  3385. )
  3386. }
  3387. /**
  3388. * Convert a value to a string that is actually rendered.
  3389. */
  3390. function toString (val) {
  3391. return val == null
  3392. ? ''
  3393. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  3394. ? JSON.stringify(val, null, 2)
  3395. : String(val)
  3396. }
  3397. /**
  3398. * Convert an input value to a number for persistence.
  3399. * If the conversion fails, return original string.
  3400. */
  3401. function toNumber (val) {
  3402. var n = parseFloat(val);
  3403. return isNaN(n) ? val : n
  3404. }
  3405. /**
  3406. * Make a map and return a function for checking if a key
  3407. * is in that map.
  3408. */
  3409. function makeMap (
  3410. str,
  3411. expectsLowerCase
  3412. ) {
  3413. var map = Object.create(null);
  3414. var list = str.split(',');
  3415. for (var i = 0; i < list.length; i++) {
  3416. map[list[i]] = true;
  3417. }
  3418. return expectsLowerCase
  3419. ? function (val) { return map[val.toLowerCase()]; }
  3420. : function (val) { return map[val]; }
  3421. }
  3422. /**
  3423. * Check if a tag is a built-in tag.
  3424. */
  3425. var isBuiltInTag = makeMap('slot,component', true);
  3426. /**
  3427. * Check if an attribute is a reserved attribute.
  3428. */
  3429. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  3430. /**
  3431. * Remove an item from an array.
  3432. */
  3433. function remove (arr, item) {
  3434. if (arr.length) {
  3435. var index = arr.indexOf(item);
  3436. if (index > -1) {
  3437. return arr.splice(index, 1)
  3438. }
  3439. }
  3440. }
  3441. /**
  3442. * Check whether an object has the property.
  3443. */
  3444. var hasOwnProperty = Object.prototype.hasOwnProperty;
  3445. function hasOwn (obj, key) {
  3446. return hasOwnProperty.call(obj, key)
  3447. }
  3448. /**
  3449. * Create a cached version of a pure function.
  3450. */
  3451. function cached (fn) {
  3452. var cache = Object.create(null);
  3453. return (function cachedFn (str) {
  3454. var hit = cache[str];
  3455. return hit || (cache[str] = fn(str))
  3456. })
  3457. }
  3458. /**
  3459. * Camelize a hyphen-delimited string.
  3460. */
  3461. var camelizeRE = /-(\w)/g;
  3462. var camelize = cached(function (str) {
  3463. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  3464. });
  3465. /**
  3466. * Capitalize a string.
  3467. */
  3468. var capitalize = cached(function (str) {
  3469. return str.charAt(0).toUpperCase() + str.slice(1)
  3470. });
  3471. /**
  3472. * Hyphenate a camelCase string.
  3473. */
  3474. var hyphenateRE = /\B([A-Z])/g;
  3475. var hyphenate = cached(function (str) {
  3476. return str.replace(hyphenateRE, '-$1').toLowerCase()
  3477. });
  3478. /**
  3479. * Simple bind polyfill for environments that do not support it,
  3480. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  3481. * since native bind is now performant enough in most browsers.
  3482. * But removing it would mean breaking code that was able to run in
  3483. * PhantomJS 1.x, so this must be kept for backward compatibility.
  3484. */
  3485. /* istanbul ignore next */
  3486. function polyfillBind (fn, ctx) {
  3487. function boundFn (a) {
  3488. var l = arguments.length;
  3489. return l
  3490. ? l > 1
  3491. ? fn.apply(ctx, arguments)
  3492. : fn.call(ctx, a)
  3493. : fn.call(ctx)
  3494. }
  3495. boundFn._length = fn.length;
  3496. return boundFn
  3497. }
  3498. function nativeBind (fn, ctx) {
  3499. return fn.bind(ctx)
  3500. }
  3501. var bind = Function.prototype.bind
  3502. ? nativeBind
  3503. : polyfillBind;
  3504. /**
  3505. * Convert an Array-like object to a real Array.
  3506. */
  3507. function toArray (list, start) {
  3508. start = start || 0;
  3509. var i = list.length - start;
  3510. var ret = new Array(i);
  3511. while (i--) {
  3512. ret[i] = list[i + start];
  3513. }
  3514. return ret
  3515. }
  3516. /**
  3517. * Mix properties into target object.
  3518. */
  3519. function extend (to, _from) {
  3520. for (var key in _from) {
  3521. to[key] = _from[key];
  3522. }
  3523. return to
  3524. }
  3525. /**
  3526. * Merge an Array of Objects into a single Object.
  3527. */
  3528. function toObject (arr) {
  3529. var res = {};
  3530. for (var i = 0; i < arr.length; i++) {
  3531. if (arr[i]) {
  3532. extend(res, arr[i]);
  3533. }
  3534. }
  3535. return res
  3536. }
  3537. /* eslint-disable no-unused-vars */
  3538. /**
  3539. * Perform no operation.
  3540. * Stubbing args to make Flow happy without leaving useless transpiled code
  3541. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  3542. */
  3543. function noop (a, b, c) {}
  3544. /**
  3545. * Always return false.
  3546. */
  3547. var no = function (a, b, c) { return false; };
  3548. /* eslint-enable no-unused-vars */
  3549. /**
  3550. * Return the same value.
  3551. */
  3552. var identity = function (_) { return _; };
  3553. /**
  3554. * Check if two values are loosely equal - that is,
  3555. * if they are plain objects, do they have the same shape?
  3556. */
  3557. function looseEqual (a, b) {
  3558. if (a === b) { return true }
  3559. var isObjectA = isObject(a);
  3560. var isObjectB = isObject(b);
  3561. if (isObjectA && isObjectB) {
  3562. try {
  3563. var isArrayA = Array.isArray(a);
  3564. var isArrayB = Array.isArray(b);
  3565. if (isArrayA && isArrayB) {
  3566. return a.length === b.length && a.every(function (e, i) {
  3567. return looseEqual(e, b[i])
  3568. })
  3569. } else if (a instanceof Date && b instanceof Date) {
  3570. return a.getTime() === b.getTime()
  3571. } else if (!isArrayA && !isArrayB) {
  3572. var keysA = Object.keys(a);
  3573. var keysB = Object.keys(b);
  3574. return keysA.length === keysB.length && keysA.every(function (key) {
  3575. return looseEqual(a[key], b[key])
  3576. })
  3577. } else {
  3578. /* istanbul ignore next */
  3579. return false
  3580. }
  3581. } catch (e) {
  3582. /* istanbul ignore next */
  3583. return false
  3584. }
  3585. } else if (!isObjectA && !isObjectB) {
  3586. return String(a) === String(b)
  3587. } else {
  3588. return false
  3589. }
  3590. }
  3591. /**
  3592. * Return the first index at which a loosely equal value can be
  3593. * found in the array (if value is a plain object, the array must
  3594. * contain an object of the same shape), or -1 if it is not present.
  3595. */
  3596. function looseIndexOf (arr, val) {
  3597. for (var i = 0; i < arr.length; i++) {
  3598. if (looseEqual(arr[i], val)) { return i }
  3599. }
  3600. return -1
  3601. }
  3602. /**
  3603. * Ensure a function is called only once.
  3604. */
  3605. function once (fn) {
  3606. var called = false;
  3607. return function () {
  3608. if (!called) {
  3609. called = true;
  3610. fn.apply(this, arguments);
  3611. }
  3612. }
  3613. }
  3614. var ASSET_TYPES = [
  3615. 'component',
  3616. 'directive',
  3617. 'filter'
  3618. ];
  3619. var LIFECYCLE_HOOKS = [
  3620. 'beforeCreate',
  3621. 'created',
  3622. 'beforeMount',
  3623. 'mounted',
  3624. 'beforeUpdate',
  3625. 'updated',
  3626. 'beforeDestroy',
  3627. 'destroyed',
  3628. 'activated',
  3629. 'deactivated',
  3630. 'errorCaptured',
  3631. 'serverPrefetch'
  3632. ];
  3633. /* */
  3634. var config = ({
  3635. /**
  3636. * Option merge strategies (used in core/util/options)
  3637. */
  3638. // $flow-disable-line
  3639. optionMergeStrategies: Object.create(null),
  3640. /**
  3641. * Whether to suppress warnings.
  3642. */
  3643. silent: false,
  3644. /**
  3645. * Show production mode tip message on boot?
  3646. */
  3647. productionTip: "development" !== 'production',
  3648. /**
  3649. * Whether to enable devtools
  3650. */
  3651. devtools: "development" !== 'production',
  3652. /**
  3653. * Whether to record perf
  3654. */
  3655. performance: false,
  3656. /**
  3657. * Error handler for watcher errors
  3658. */
  3659. errorHandler: null,
  3660. /**
  3661. * Warn handler for watcher warns
  3662. */
  3663. warnHandler: null,
  3664. /**
  3665. * Ignore certain custom elements
  3666. */
  3667. ignoredElements: [],
  3668. /**
  3669. * Custom user key aliases for v-on
  3670. */
  3671. // $flow-disable-line
  3672. keyCodes: Object.create(null),
  3673. /**
  3674. * Check if a tag is reserved so that it cannot be registered as a
  3675. * component. This is platform-dependent and may be overwritten.
  3676. */
  3677. isReservedTag: no,
  3678. /**
  3679. * Check if an attribute is reserved so that it cannot be used as a component
  3680. * prop. This is platform-dependent and may be overwritten.
  3681. */
  3682. isReservedAttr: no,
  3683. /**
  3684. * Check if a tag is an unknown element.
  3685. * Platform-dependent.
  3686. */
  3687. isUnknownElement: no,
  3688. /**
  3689. * Get the namespace of an element
  3690. */
  3691. getTagNamespace: noop,
  3692. /**
  3693. * Parse the real tag name for the specific platform.
  3694. */
  3695. parsePlatformTagName: identity,
  3696. /**
  3697. * Check if an attribute must be bound using property, e.g. value
  3698. * Platform-dependent.
  3699. */
  3700. mustUseProp: no,
  3701. /**
  3702. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  3703. * This will significantly reduce performance if set to false.
  3704. */
  3705. async: true,
  3706. /**
  3707. * Exposed for legacy reasons
  3708. */
  3709. _lifecycleHooks: LIFECYCLE_HOOKS
  3710. });
  3711. /* */
  3712. /**
  3713. * unicode letters used for parsing html tags, component names and property paths.
  3714. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  3715. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  3716. */
  3717. 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/;
  3718. /**
  3719. * Check if a string starts with $ or _
  3720. */
  3721. function isReserved (str) {
  3722. var c = (str + '').charCodeAt(0);
  3723. return c === 0x24 || c === 0x5F
  3724. }
  3725. /**
  3726. * Define a property.
  3727. */
  3728. function def (obj, key, val, enumerable) {
  3729. Object.defineProperty(obj, key, {
  3730. value: val,
  3731. enumerable: !!enumerable,
  3732. writable: true,
  3733. configurable: true
  3734. });
  3735. }
  3736. /**
  3737. * Parse simple path.
  3738. */
  3739. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  3740. function parsePath (path) {
  3741. if (bailRE.test(path)) {
  3742. return
  3743. }
  3744. var segments = path.split('.');
  3745. return function (obj) {
  3746. for (var i = 0; i < segments.length; i++) {
  3747. if (!obj) { return }
  3748. obj = obj[segments[i]];
  3749. }
  3750. return obj
  3751. }
  3752. }
  3753. /* */
  3754. // can we use __proto__?
  3755. var hasProto = '__proto__' in {};
  3756. // Browser environment sniffing
  3757. var inBrowser = typeof window !== 'undefined';
  3758. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  3759. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  3760. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  3761. var isIE = UA && /msie|trident/.test(UA);
  3762. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  3763. var isEdge = UA && UA.indexOf('edge/') > 0;
  3764. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  3765. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  3766. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  3767. var isPhantomJS = UA && /phantomjs/.test(UA);
  3768. var isFF = UA && UA.match(/firefox\/(\d+)/);
  3769. // Firefox has a "watch" function on Object.prototype...
  3770. var nativeWatch = ({}).watch;
  3771. if (inBrowser) {
  3772. try {
  3773. var opts = {};
  3774. Object.defineProperty(opts, 'passive', ({
  3775. get: function get () {
  3776. }
  3777. })); // https://github.com/facebook/flow/issues/285
  3778. window.addEventListener('test-passive', null, opts);
  3779. } catch (e) {}
  3780. }
  3781. // this needs to be lazy-evaled because vue may be required before
  3782. // vue-server-renderer can set VUE_ENV
  3783. var _isServer;
  3784. var isServerRendering = function () {
  3785. if (_isServer === undefined) {
  3786. /* istanbul ignore if */
  3787. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  3788. // detect presence of vue-server-renderer and avoid
  3789. // Webpack shimming the process
  3790. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  3791. } else {
  3792. _isServer = false;
  3793. }
  3794. }
  3795. return _isServer
  3796. };
  3797. // detect devtools
  3798. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  3799. /* istanbul ignore next */
  3800. function isNative (Ctor) {
  3801. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  3802. }
  3803. var hasSymbol =
  3804. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  3805. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  3806. var _Set;
  3807. /* istanbul ignore if */ // $flow-disable-line
  3808. if (typeof Set !== 'undefined' && isNative(Set)) {
  3809. // use native Set when available.
  3810. _Set = Set;
  3811. } else {
  3812. // a non-standard Set polyfill that only works with primitive keys.
  3813. _Set = /*@__PURE__*/(function () {
  3814. function Set () {
  3815. this.set = Object.create(null);
  3816. }
  3817. Set.prototype.has = function has (key) {
  3818. return this.set[key] === true
  3819. };
  3820. Set.prototype.add = function add (key) {
  3821. this.set[key] = true;
  3822. };
  3823. Set.prototype.clear = function clear () {
  3824. this.set = Object.create(null);
  3825. };
  3826. return Set;
  3827. }());
  3828. }
  3829. /* */
  3830. var warn = noop;
  3831. var tip = noop;
  3832. var generateComponentTrace = (noop); // work around flow check
  3833. var formatComponentName = (noop);
  3834. if (true) {
  3835. var hasConsole = typeof console !== 'undefined';
  3836. var classifyRE = /(?:^|[-_])(\w)/g;
  3837. var classify = function (str) { return str
  3838. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  3839. .replace(/[-_]/g, ''); };
  3840. warn = function (msg, vm) {
  3841. var trace = vm ? generateComponentTrace(vm) : '';
  3842. if (config.warnHandler) {
  3843. config.warnHandler.call(null, msg, vm, trace);
  3844. } else if (hasConsole && (!config.silent)) {
  3845. console.error(("[Vue warn]: " + msg + trace));
  3846. }
  3847. };
  3848. tip = function (msg, vm) {
  3849. if (hasConsole && (!config.silent)) {
  3850. console.warn("[Vue tip]: " + msg + (
  3851. vm ? generateComponentTrace(vm) : ''
  3852. ));
  3853. }
  3854. };
  3855. formatComponentName = function (vm, includeFile) {
  3856. if (vm.$root === vm) {
  3857. if (vm.$options && vm.$options.__file) { // fixed by xxxxxx
  3858. return ('') + vm.$options.__file
  3859. }
  3860. return '<Root>'
  3861. }
  3862. var options = typeof vm === 'function' && vm.cid != null
  3863. ? vm.options
  3864. : vm._isVue
  3865. ? vm.$options || vm.constructor.options
  3866. : vm;
  3867. var name = options.name || options._componentTag;
  3868. var file = options.__file;
  3869. if (!name && file) {
  3870. var match = file.match(/([^/\\]+)\.vue$/);
  3871. name = match && match[1];
  3872. }
  3873. return (
  3874. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  3875. (file && includeFile !== false ? (" at " + file) : '')
  3876. )
  3877. };
  3878. var repeat = function (str, n) {
  3879. var res = '';
  3880. while (n) {
  3881. if (n % 2 === 1) { res += str; }
  3882. if (n > 1) { str += str; }
  3883. n >>= 1;
  3884. }
  3885. return res
  3886. };
  3887. generateComponentTrace = function (vm) {
  3888. if (vm._isVue && vm.$parent) {
  3889. var tree = [];
  3890. var currentRecursiveSequence = 0;
  3891. while (vm && vm.$options.name !== 'PageBody') {
  3892. if (tree.length > 0) {
  3893. var last = tree[tree.length - 1];
  3894. if (last.constructor === vm.constructor) {
  3895. currentRecursiveSequence++;
  3896. vm = vm.$parent;
  3897. continue
  3898. } else if (currentRecursiveSequence > 0) {
  3899. tree[tree.length - 1] = [last, currentRecursiveSequence];
  3900. currentRecursiveSequence = 0;
  3901. }
  3902. }
  3903. !vm.$options.isReserved && tree.push(vm);
  3904. vm = vm.$parent;
  3905. }
  3906. return '\n\nfound in\n\n' + tree
  3907. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  3908. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  3909. : formatComponentName(vm))); })
  3910. .join('\n')
  3911. } else {
  3912. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  3913. }
  3914. };
  3915. }
  3916. /* */
  3917. var uid = 0;
  3918. /**
  3919. * A dep is an observable that can have multiple
  3920. * directives subscribing to it.
  3921. */
  3922. var Dep = function Dep () {
  3923. this.id = uid++;
  3924. this.subs = [];
  3925. };
  3926. Dep.prototype.addSub = function addSub (sub) {
  3927. this.subs.push(sub);
  3928. };
  3929. Dep.prototype.removeSub = function removeSub (sub) {
  3930. remove(this.subs, sub);
  3931. };
  3932. Dep.prototype.depend = function depend () {
  3933. if (Dep.SharedObject.target) {
  3934. Dep.SharedObject.target.addDep(this);
  3935. }
  3936. };
  3937. Dep.prototype.notify = function notify () {
  3938. // stabilize the subscriber list first
  3939. var subs = this.subs.slice();
  3940. if ( true && !config.async) {
  3941. // subs aren't sorted in scheduler if not running async
  3942. // we need to sort them now to make sure they fire in correct
  3943. // order
  3944. subs.sort(function (a, b) { return a.id - b.id; });
  3945. }
  3946. for (var i = 0, l = subs.length; i < l; i++) {
  3947. subs[i].update();
  3948. }
  3949. };
  3950. // The current target watcher being evaluated.
  3951. // This is globally unique because only one watcher
  3952. // can be evaluated at a time.
  3953. // fixed by xxxxxx (nvue shared vuex)
  3954. /* eslint-disable no-undef */
  3955. Dep.SharedObject = {};
  3956. Dep.SharedObject.target = null;
  3957. Dep.SharedObject.targetStack = [];
  3958. function pushTarget (target) {
  3959. Dep.SharedObject.targetStack.push(target);
  3960. Dep.SharedObject.target = target;
  3961. Dep.target = target;
  3962. }
  3963. function popTarget () {
  3964. Dep.SharedObject.targetStack.pop();
  3965. Dep.SharedObject.target = Dep.SharedObject.targetStack[Dep.SharedObject.targetStack.length - 1];
  3966. Dep.target = Dep.SharedObject.target;
  3967. }
  3968. /* */
  3969. var VNode = function VNode (
  3970. tag,
  3971. data,
  3972. children,
  3973. text,
  3974. elm,
  3975. context,
  3976. componentOptions,
  3977. asyncFactory
  3978. ) {
  3979. this.tag = tag;
  3980. this.data = data;
  3981. this.children = children;
  3982. this.text = text;
  3983. this.elm = elm;
  3984. this.ns = undefined;
  3985. this.context = context;
  3986. this.fnContext = undefined;
  3987. this.fnOptions = undefined;
  3988. this.fnScopeId = undefined;
  3989. this.key = data && data.key;
  3990. this.componentOptions = componentOptions;
  3991. this.componentInstance = undefined;
  3992. this.parent = undefined;
  3993. this.raw = false;
  3994. this.isStatic = false;
  3995. this.isRootInsert = true;
  3996. this.isComment = false;
  3997. this.isCloned = false;
  3998. this.isOnce = false;
  3999. this.asyncFactory = asyncFactory;
  4000. this.asyncMeta = undefined;
  4001. this.isAsyncPlaceholder = false;
  4002. };
  4003. var prototypeAccessors = { child: { configurable: true } };
  4004. // DEPRECATED: alias for componentInstance for backwards compat.
  4005. /* istanbul ignore next */
  4006. prototypeAccessors.child.get = function () {
  4007. return this.componentInstance
  4008. };
  4009. Object.defineProperties( VNode.prototype, prototypeAccessors );
  4010. var createEmptyVNode = function (text) {
  4011. if ( text === void 0 ) text = '';
  4012. var node = new VNode();
  4013. node.text = text;
  4014. node.isComment = true;
  4015. return node
  4016. };
  4017. function createTextVNode (val) {
  4018. return new VNode(undefined, undefined, undefined, String(val))
  4019. }
  4020. // optimized shallow clone
  4021. // used for static nodes and slot nodes because they may be reused across
  4022. // multiple renders, cloning them avoids errors when DOM manipulations rely
  4023. // on their elm reference.
  4024. function cloneVNode (vnode) {
  4025. var cloned = new VNode(
  4026. vnode.tag,
  4027. vnode.data,
  4028. // #7975
  4029. // clone children array to avoid mutating original in case of cloning
  4030. // a child.
  4031. vnode.children && vnode.children.slice(),
  4032. vnode.text,
  4033. vnode.elm,
  4034. vnode.context,
  4035. vnode.componentOptions,
  4036. vnode.asyncFactory
  4037. );
  4038. cloned.ns = vnode.ns;
  4039. cloned.isStatic = vnode.isStatic;
  4040. cloned.key = vnode.key;
  4041. cloned.isComment = vnode.isComment;
  4042. cloned.fnContext = vnode.fnContext;
  4043. cloned.fnOptions = vnode.fnOptions;
  4044. cloned.fnScopeId = vnode.fnScopeId;
  4045. cloned.asyncMeta = vnode.asyncMeta;
  4046. cloned.isCloned = true;
  4047. return cloned
  4048. }
  4049. /*
  4050. * not type checking this file because flow doesn't play well with
  4051. * dynamically accessing methods on Array prototype
  4052. */
  4053. var arrayProto = Array.prototype;
  4054. var arrayMethods = Object.create(arrayProto);
  4055. var methodsToPatch = [
  4056. 'push',
  4057. 'pop',
  4058. 'shift',
  4059. 'unshift',
  4060. 'splice',
  4061. 'sort',
  4062. 'reverse'
  4063. ];
  4064. /**
  4065. * Intercept mutating methods and emit events
  4066. */
  4067. methodsToPatch.forEach(function (method) {
  4068. // cache original method
  4069. var original = arrayProto[method];
  4070. def(arrayMethods, method, function mutator () {
  4071. var args = [], len = arguments.length;
  4072. while ( len-- ) args[ len ] = arguments[ len ];
  4073. var result = original.apply(this, args);
  4074. var ob = this.__ob__;
  4075. var inserted;
  4076. switch (method) {
  4077. case 'push':
  4078. case 'unshift':
  4079. inserted = args;
  4080. break
  4081. case 'splice':
  4082. inserted = args.slice(2);
  4083. break
  4084. }
  4085. if (inserted) { ob.observeArray(inserted); }
  4086. // notify change
  4087. ob.dep.notify();
  4088. return result
  4089. });
  4090. });
  4091. /* */
  4092. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  4093. /**
  4094. * In some cases we may want to disable observation inside a component's
  4095. * update computation.
  4096. */
  4097. var shouldObserve = true;
  4098. function toggleObserving (value) {
  4099. shouldObserve = value;
  4100. }
  4101. /**
  4102. * Observer class that is attached to each observed
  4103. * object. Once attached, the observer converts the target
  4104. * object's property keys into getter/setters that
  4105. * collect dependencies and dispatch updates.
  4106. */
  4107. var Observer = function Observer (value) {
  4108. this.value = value;
  4109. this.dep = new Dep();
  4110. this.vmCount = 0;
  4111. def(value, '__ob__', this);
  4112. if (Array.isArray(value)) {
  4113. if (hasProto) {
  4114. {// fixed by xxxxxx 微信小程序使用 plugins 之后,数组方法被直接挂载到了数组对象上,需要执行 copyAugment 逻辑
  4115. if(value.push !== value.__proto__.push){
  4116. copyAugment(value, arrayMethods, arrayKeys);
  4117. } else {
  4118. protoAugment(value, arrayMethods);
  4119. }
  4120. }
  4121. } else {
  4122. copyAugment(value, arrayMethods, arrayKeys);
  4123. }
  4124. this.observeArray(value);
  4125. } else {
  4126. this.walk(value);
  4127. }
  4128. };
  4129. /**
  4130. * Walk through all properties and convert them into
  4131. * getter/setters. This method should only be called when
  4132. * value type is Object.
  4133. */
  4134. Observer.prototype.walk = function walk (obj) {
  4135. var keys = Object.keys(obj);
  4136. for (var i = 0; i < keys.length; i++) {
  4137. defineReactive$$1(obj, keys[i]);
  4138. }
  4139. };
  4140. /**
  4141. * Observe a list of Array items.
  4142. */
  4143. Observer.prototype.observeArray = function observeArray (items) {
  4144. for (var i = 0, l = items.length; i < l; i++) {
  4145. observe(items[i]);
  4146. }
  4147. };
  4148. // helpers
  4149. /**
  4150. * Augment a target Object or Array by intercepting
  4151. * the prototype chain using __proto__
  4152. */
  4153. function protoAugment (target, src) {
  4154. /* eslint-disable no-proto */
  4155. target.__proto__ = src;
  4156. /* eslint-enable no-proto */
  4157. }
  4158. /**
  4159. * Augment a target Object or Array by defining
  4160. * hidden properties.
  4161. */
  4162. /* istanbul ignore next */
  4163. function copyAugment (target, src, keys) {
  4164. for (var i = 0, l = keys.length; i < l; i++) {
  4165. var key = keys[i];
  4166. def(target, key, src[key]);
  4167. }
  4168. }
  4169. /**
  4170. * Attempt to create an observer instance for a value,
  4171. * returns the new observer if successfully observed,
  4172. * or the existing observer if the value already has one.
  4173. */
  4174. function observe (value, asRootData) {
  4175. if (!isObject(value) || value instanceof VNode) {
  4176. return
  4177. }
  4178. var ob;
  4179. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  4180. ob = value.__ob__;
  4181. } else if (
  4182. shouldObserve &&
  4183. !isServerRendering() &&
  4184. (Array.isArray(value) || isPlainObject(value)) &&
  4185. Object.isExtensible(value) &&
  4186. !value._isVue &&
  4187. !value.__v_isMPComponent
  4188. ) {
  4189. ob = new Observer(value);
  4190. }
  4191. if (asRootData && ob) {
  4192. ob.vmCount++;
  4193. }
  4194. return ob
  4195. }
  4196. /**
  4197. * Define a reactive property on an Object.
  4198. */
  4199. function defineReactive$$1 (
  4200. obj,
  4201. key,
  4202. val,
  4203. customSetter,
  4204. shallow
  4205. ) {
  4206. var dep = new Dep();
  4207. var property = Object.getOwnPropertyDescriptor(obj, key);
  4208. if (property && property.configurable === false) {
  4209. return
  4210. }
  4211. // cater for pre-defined getter/setters
  4212. var getter = property && property.get;
  4213. var setter = property && property.set;
  4214. if ((!getter || setter) && arguments.length === 2) {
  4215. val = obj[key];
  4216. }
  4217. var childOb = !shallow && observe(val);
  4218. Object.defineProperty(obj, key, {
  4219. enumerable: true,
  4220. configurable: true,
  4221. get: function reactiveGetter () {
  4222. var value = getter ? getter.call(obj) : val;
  4223. if (Dep.SharedObject.target) { // fixed by xxxxxx
  4224. dep.depend();
  4225. if (childOb) {
  4226. childOb.dep.depend();
  4227. if (Array.isArray(value)) {
  4228. dependArray(value);
  4229. }
  4230. }
  4231. }
  4232. return value
  4233. },
  4234. set: function reactiveSetter (newVal) {
  4235. var value = getter ? getter.call(obj) : val;
  4236. /* eslint-disable no-self-compare */
  4237. if (newVal === value || (newVal !== newVal && value !== value)) {
  4238. return
  4239. }
  4240. /* eslint-enable no-self-compare */
  4241. if ( true && customSetter) {
  4242. customSetter();
  4243. }
  4244. // #7981: for accessor properties without setter
  4245. if (getter && !setter) { return }
  4246. if (setter) {
  4247. setter.call(obj, newVal);
  4248. } else {
  4249. val = newVal;
  4250. }
  4251. childOb = !shallow && observe(newVal);
  4252. dep.notify();
  4253. }
  4254. });
  4255. }
  4256. /**
  4257. * Set a property on an object. Adds the new property and
  4258. * triggers change notification if the property doesn't
  4259. * already exist.
  4260. */
  4261. function set (target, key, val) {
  4262. if ( true &&
  4263. (isUndef(target) || isPrimitive(target))
  4264. ) {
  4265. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  4266. }
  4267. if (Array.isArray(target) && isValidArrayIndex(key)) {
  4268. target.length = Math.max(target.length, key);
  4269. target.splice(key, 1, val);
  4270. return val
  4271. }
  4272. if (key in target && !(key in Object.prototype)) {
  4273. target[key] = val;
  4274. return val
  4275. }
  4276. var ob = (target).__ob__;
  4277. if (target._isVue || (ob && ob.vmCount)) {
  4278. true && warn(
  4279. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  4280. 'at runtime - declare it upfront in the data option.'
  4281. );
  4282. return val
  4283. }
  4284. if (!ob) {
  4285. target[key] = val;
  4286. return val
  4287. }
  4288. defineReactive$$1(ob.value, key, val);
  4289. ob.dep.notify();
  4290. return val
  4291. }
  4292. /**
  4293. * Delete a property and trigger change if necessary.
  4294. */
  4295. function del (target, key) {
  4296. if ( true &&
  4297. (isUndef(target) || isPrimitive(target))
  4298. ) {
  4299. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  4300. }
  4301. if (Array.isArray(target) && isValidArrayIndex(key)) {
  4302. target.splice(key, 1);
  4303. return
  4304. }
  4305. var ob = (target).__ob__;
  4306. if (target._isVue || (ob && ob.vmCount)) {
  4307. true && warn(
  4308. 'Avoid deleting properties on a Vue instance or its root $data ' +
  4309. '- just set it to null.'
  4310. );
  4311. return
  4312. }
  4313. if (!hasOwn(target, key)) {
  4314. return
  4315. }
  4316. delete target[key];
  4317. if (!ob) {
  4318. return
  4319. }
  4320. ob.dep.notify();
  4321. }
  4322. /**
  4323. * Collect dependencies on array elements when the array is touched, since
  4324. * we cannot intercept array element access like property getters.
  4325. */
  4326. function dependArray (value) {
  4327. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  4328. e = value[i];
  4329. e && e.__ob__ && e.__ob__.dep.depend();
  4330. if (Array.isArray(e)) {
  4331. dependArray(e);
  4332. }
  4333. }
  4334. }
  4335. /* */
  4336. /**
  4337. * Option overwriting strategies are functions that handle
  4338. * how to merge a parent option value and a child option
  4339. * value into the final value.
  4340. */
  4341. var strats = config.optionMergeStrategies;
  4342. /**
  4343. * Options with restrictions
  4344. */
  4345. if (true) {
  4346. strats.el = strats.propsData = function (parent, child, vm, key) {
  4347. if (!vm) {
  4348. warn(
  4349. "option \"" + key + "\" can only be used during instance " +
  4350. 'creation with the `new` keyword.'
  4351. );
  4352. }
  4353. return defaultStrat(parent, child)
  4354. };
  4355. }
  4356. /**
  4357. * Helper that recursively merges two data objects together.
  4358. */
  4359. function mergeData (to, from) {
  4360. if (!from) { return to }
  4361. var key, toVal, fromVal;
  4362. var keys = hasSymbol
  4363. ? Reflect.ownKeys(from)
  4364. : Object.keys(from);
  4365. for (var i = 0; i < keys.length; i++) {
  4366. key = keys[i];
  4367. // in case the object is already observed...
  4368. if (key === '__ob__') { continue }
  4369. toVal = to[key];
  4370. fromVal = from[key];
  4371. if (!hasOwn(to, key)) {
  4372. set(to, key, fromVal);
  4373. } else if (
  4374. toVal !== fromVal &&
  4375. isPlainObject(toVal) &&
  4376. isPlainObject(fromVal)
  4377. ) {
  4378. mergeData(toVal, fromVal);
  4379. }
  4380. }
  4381. return to
  4382. }
  4383. /**
  4384. * Data
  4385. */
  4386. function mergeDataOrFn (
  4387. parentVal,
  4388. childVal,
  4389. vm
  4390. ) {
  4391. if (!vm) {
  4392. // in a Vue.extend merge, both should be functions
  4393. if (!childVal) {
  4394. return parentVal
  4395. }
  4396. if (!parentVal) {
  4397. return childVal
  4398. }
  4399. // when parentVal & childVal are both present,
  4400. // we need to return a function that returns the
  4401. // merged result of both functions... no need to
  4402. // check if parentVal is a function here because
  4403. // it has to be a function to pass previous merges.
  4404. return function mergedDataFn () {
  4405. return mergeData(
  4406. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  4407. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  4408. )
  4409. }
  4410. } else {
  4411. return function mergedInstanceDataFn () {
  4412. // instance merge
  4413. var instanceData = typeof childVal === 'function'
  4414. ? childVal.call(vm, vm)
  4415. : childVal;
  4416. var defaultData = typeof parentVal === 'function'
  4417. ? parentVal.call(vm, vm)
  4418. : parentVal;
  4419. if (instanceData) {
  4420. return mergeData(instanceData, defaultData)
  4421. } else {
  4422. return defaultData
  4423. }
  4424. }
  4425. }
  4426. }
  4427. strats.data = function (
  4428. parentVal,
  4429. childVal,
  4430. vm
  4431. ) {
  4432. if (!vm) {
  4433. if (childVal && typeof childVal !== 'function') {
  4434. true && warn(
  4435. 'The "data" option should be a function ' +
  4436. 'that returns a per-instance value in component ' +
  4437. 'definitions.',
  4438. vm
  4439. );
  4440. return parentVal
  4441. }
  4442. return mergeDataOrFn(parentVal, childVal)
  4443. }
  4444. return mergeDataOrFn(parentVal, childVal, vm)
  4445. };
  4446. /**
  4447. * Hooks and props are merged as arrays.
  4448. */
  4449. function mergeHook (
  4450. parentVal,
  4451. childVal
  4452. ) {
  4453. var res = childVal
  4454. ? parentVal
  4455. ? parentVal.concat(childVal)
  4456. : Array.isArray(childVal)
  4457. ? childVal
  4458. : [childVal]
  4459. : parentVal;
  4460. return res
  4461. ? dedupeHooks(res)
  4462. : res
  4463. }
  4464. function dedupeHooks (hooks) {
  4465. var res = [];
  4466. for (var i = 0; i < hooks.length; i++) {
  4467. if (res.indexOf(hooks[i]) === -1) {
  4468. res.push(hooks[i]);
  4469. }
  4470. }
  4471. return res
  4472. }
  4473. LIFECYCLE_HOOKS.forEach(function (hook) {
  4474. strats[hook] = mergeHook;
  4475. });
  4476. /**
  4477. * Assets
  4478. *
  4479. * When a vm is present (instance creation), we need to do
  4480. * a three-way merge between constructor options, instance
  4481. * options and parent options.
  4482. */
  4483. function mergeAssets (
  4484. parentVal,
  4485. childVal,
  4486. vm,
  4487. key
  4488. ) {
  4489. var res = Object.create(parentVal || null);
  4490. if (childVal) {
  4491. true && assertObjectType(key, childVal, vm);
  4492. return extend(res, childVal)
  4493. } else {
  4494. return res
  4495. }
  4496. }
  4497. ASSET_TYPES.forEach(function (type) {
  4498. strats[type + 's'] = mergeAssets;
  4499. });
  4500. /**
  4501. * Watchers.
  4502. *
  4503. * Watchers hashes should not overwrite one
  4504. * another, so we merge them as arrays.
  4505. */
  4506. strats.watch = function (
  4507. parentVal,
  4508. childVal,
  4509. vm,
  4510. key
  4511. ) {
  4512. // work around Firefox's Object.prototype.watch...
  4513. if (parentVal === nativeWatch) { parentVal = undefined; }
  4514. if (childVal === nativeWatch) { childVal = undefined; }
  4515. /* istanbul ignore if */
  4516. if (!childVal) { return Object.create(parentVal || null) }
  4517. if (true) {
  4518. assertObjectType(key, childVal, vm);
  4519. }
  4520. if (!parentVal) { return childVal }
  4521. var ret = {};
  4522. extend(ret, parentVal);
  4523. for (var key$1 in childVal) {
  4524. var parent = ret[key$1];
  4525. var child = childVal[key$1];
  4526. if (parent && !Array.isArray(parent)) {
  4527. parent = [parent];
  4528. }
  4529. ret[key$1] = parent
  4530. ? parent.concat(child)
  4531. : Array.isArray(child) ? child : [child];
  4532. }
  4533. return ret
  4534. };
  4535. /**
  4536. * Other object hashes.
  4537. */
  4538. strats.props =
  4539. strats.methods =
  4540. strats.inject =
  4541. strats.computed = function (
  4542. parentVal,
  4543. childVal,
  4544. vm,
  4545. key
  4546. ) {
  4547. if (childVal && "development" !== 'production') {
  4548. assertObjectType(key, childVal, vm);
  4549. }
  4550. if (!parentVal) { return childVal }
  4551. var ret = Object.create(null);
  4552. extend(ret, parentVal);
  4553. if (childVal) { extend(ret, childVal); }
  4554. return ret
  4555. };
  4556. strats.provide = mergeDataOrFn;
  4557. /**
  4558. * Default strategy.
  4559. */
  4560. var defaultStrat = function (parentVal, childVal) {
  4561. return childVal === undefined
  4562. ? parentVal
  4563. : childVal
  4564. };
  4565. /**
  4566. * Validate component names
  4567. */
  4568. function checkComponents (options) {
  4569. for (var key in options.components) {
  4570. validateComponentName(key);
  4571. }
  4572. }
  4573. function validateComponentName (name) {
  4574. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  4575. warn(
  4576. 'Invalid component name: "' + name + '". Component names ' +
  4577. 'should conform to valid custom element name in html5 specification.'
  4578. );
  4579. }
  4580. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  4581. warn(
  4582. 'Do not use built-in or reserved HTML elements as component ' +
  4583. 'id: ' + name
  4584. );
  4585. }
  4586. }
  4587. /**
  4588. * Ensure all props option syntax are normalized into the
  4589. * Object-based format.
  4590. */
  4591. function normalizeProps (options, vm) {
  4592. var props = options.props;
  4593. if (!props) { return }
  4594. var res = {};
  4595. var i, val, name;
  4596. if (Array.isArray(props)) {
  4597. i = props.length;
  4598. while (i--) {
  4599. val = props[i];
  4600. if (typeof val === 'string') {
  4601. name = camelize(val);
  4602. res[name] = { type: null };
  4603. } else if (true) {
  4604. warn('props must be strings when using array syntax.');
  4605. }
  4606. }
  4607. } else if (isPlainObject(props)) {
  4608. for (var key in props) {
  4609. val = props[key];
  4610. name = camelize(key);
  4611. res[name] = isPlainObject(val)
  4612. ? val
  4613. : { type: val };
  4614. }
  4615. } else if (true) {
  4616. warn(
  4617. "Invalid value for option \"props\": expected an Array or an Object, " +
  4618. "but got " + (toRawType(props)) + ".",
  4619. vm
  4620. );
  4621. }
  4622. options.props = res;
  4623. }
  4624. /**
  4625. * Normalize all injections into Object-based format
  4626. */
  4627. function normalizeInject (options, vm) {
  4628. var inject = options.inject;
  4629. if (!inject) { return }
  4630. var normalized = options.inject = {};
  4631. if (Array.isArray(inject)) {
  4632. for (var i = 0; i < inject.length; i++) {
  4633. normalized[inject[i]] = { from: inject[i] };
  4634. }
  4635. } else if (isPlainObject(inject)) {
  4636. for (var key in inject) {
  4637. var val = inject[key];
  4638. normalized[key] = isPlainObject(val)
  4639. ? extend({ from: key }, val)
  4640. : { from: val };
  4641. }
  4642. } else if (true) {
  4643. warn(
  4644. "Invalid value for option \"inject\": expected an Array or an Object, " +
  4645. "but got " + (toRawType(inject)) + ".",
  4646. vm
  4647. );
  4648. }
  4649. }
  4650. /**
  4651. * Normalize raw function directives into object format.
  4652. */
  4653. function normalizeDirectives (options) {
  4654. var dirs = options.directives;
  4655. if (dirs) {
  4656. for (var key in dirs) {
  4657. var def$$1 = dirs[key];
  4658. if (typeof def$$1 === 'function') {
  4659. dirs[key] = { bind: def$$1, update: def$$1 };
  4660. }
  4661. }
  4662. }
  4663. }
  4664. function assertObjectType (name, value, vm) {
  4665. if (!isPlainObject(value)) {
  4666. warn(
  4667. "Invalid value for option \"" + name + "\": expected an Object, " +
  4668. "but got " + (toRawType(value)) + ".",
  4669. vm
  4670. );
  4671. }
  4672. }
  4673. /**
  4674. * Merge two option objects into a new one.
  4675. * Core utility used in both instantiation and inheritance.
  4676. */
  4677. function mergeOptions (
  4678. parent,
  4679. child,
  4680. vm
  4681. ) {
  4682. if (true) {
  4683. checkComponents(child);
  4684. }
  4685. if (typeof child === 'function') {
  4686. child = child.options;
  4687. }
  4688. normalizeProps(child, vm);
  4689. normalizeInject(child, vm);
  4690. normalizeDirectives(child);
  4691. // Apply extends and mixins on the child options,
  4692. // but only if it is a raw options object that isn't
  4693. // the result of another mergeOptions call.
  4694. // Only merged options has the _base property.
  4695. if (!child._base) {
  4696. if (child.extends) {
  4697. parent = mergeOptions(parent, child.extends, vm);
  4698. }
  4699. if (child.mixins) {
  4700. for (var i = 0, l = child.mixins.length; i < l; i++) {
  4701. parent = mergeOptions(parent, child.mixins[i], vm);
  4702. }
  4703. }
  4704. }
  4705. var options = {};
  4706. var key;
  4707. for (key in parent) {
  4708. mergeField(key);
  4709. }
  4710. for (key in child) {
  4711. if (!hasOwn(parent, key)) {
  4712. mergeField(key);
  4713. }
  4714. }
  4715. function mergeField (key) {
  4716. var strat = strats[key] || defaultStrat;
  4717. options[key] = strat(parent[key], child[key], vm, key);
  4718. }
  4719. return options
  4720. }
  4721. /**
  4722. * Resolve an asset.
  4723. * This function is used because child instances need access
  4724. * to assets defined in its ancestor chain.
  4725. */
  4726. function resolveAsset (
  4727. options,
  4728. type,
  4729. id,
  4730. warnMissing
  4731. ) {
  4732. /* istanbul ignore if */
  4733. if (typeof id !== 'string') {
  4734. return
  4735. }
  4736. var assets = options[type];
  4737. // check local registration variations first
  4738. if (hasOwn(assets, id)) { return assets[id] }
  4739. var camelizedId = camelize(id);
  4740. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  4741. var PascalCaseId = capitalize(camelizedId);
  4742. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  4743. // fallback to prototype chain
  4744. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  4745. if ( true && warnMissing && !res) {
  4746. warn(
  4747. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  4748. options
  4749. );
  4750. }
  4751. return res
  4752. }
  4753. /* */
  4754. function validateProp (
  4755. key,
  4756. propOptions,
  4757. propsData,
  4758. vm
  4759. ) {
  4760. var prop = propOptions[key];
  4761. var absent = !hasOwn(propsData, key);
  4762. var value = propsData[key];
  4763. // boolean casting
  4764. var booleanIndex = getTypeIndex(Boolean, prop.type);
  4765. if (booleanIndex > -1) {
  4766. if (absent && !hasOwn(prop, 'default')) {
  4767. value = false;
  4768. } else if (value === '' || value === hyphenate(key)) {
  4769. // only cast empty string / same name to boolean if
  4770. // boolean has higher priority
  4771. var stringIndex = getTypeIndex(String, prop.type);
  4772. if (stringIndex < 0 || booleanIndex < stringIndex) {
  4773. value = true;
  4774. }
  4775. }
  4776. }
  4777. // check default value
  4778. if (value === undefined) {
  4779. value = getPropDefaultValue(vm, prop, key);
  4780. // since the default value is a fresh copy,
  4781. // make sure to observe it.
  4782. var prevShouldObserve = shouldObserve;
  4783. toggleObserving(true);
  4784. observe(value);
  4785. toggleObserving(prevShouldObserve);
  4786. }
  4787. if (
  4788. true
  4789. ) {
  4790. assertProp(prop, key, value, vm, absent);
  4791. }
  4792. return value
  4793. }
  4794. /**
  4795. * Get the default value of a prop.
  4796. */
  4797. function getPropDefaultValue (vm, prop, key) {
  4798. // no default, return undefined
  4799. if (!hasOwn(prop, 'default')) {
  4800. return undefined
  4801. }
  4802. var def = prop.default;
  4803. // warn against non-factory defaults for Object & Array
  4804. if ( true && isObject(def)) {
  4805. warn(
  4806. 'Invalid default value for prop "' + key + '": ' +
  4807. 'Props with type Object/Array must use a factory function ' +
  4808. 'to return the default value.',
  4809. vm
  4810. );
  4811. }
  4812. // the raw prop value was also undefined from previous render,
  4813. // return previous default value to avoid unnecessary watcher trigger
  4814. if (vm && vm.$options.propsData &&
  4815. vm.$options.propsData[key] === undefined &&
  4816. vm._props[key] !== undefined
  4817. ) {
  4818. return vm._props[key]
  4819. }
  4820. // call factory function for non-Function types
  4821. // a value is Function if its prototype is function even across different execution context
  4822. return typeof def === 'function' && getType(prop.type) !== 'Function'
  4823. ? def.call(vm)
  4824. : def
  4825. }
  4826. /**
  4827. * Assert whether a prop is valid.
  4828. */
  4829. function assertProp (
  4830. prop,
  4831. name,
  4832. value,
  4833. vm,
  4834. absent
  4835. ) {
  4836. if (prop.required && absent) {
  4837. warn(
  4838. 'Missing required prop: "' + name + '"',
  4839. vm
  4840. );
  4841. return
  4842. }
  4843. if (value == null && !prop.required) {
  4844. return
  4845. }
  4846. var type = prop.type;
  4847. var valid = !type || type === true;
  4848. var expectedTypes = [];
  4849. if (type) {
  4850. if (!Array.isArray(type)) {
  4851. type = [type];
  4852. }
  4853. for (var i = 0; i < type.length && !valid; i++) {
  4854. var assertedType = assertType(value, type[i]);
  4855. expectedTypes.push(assertedType.expectedType || '');
  4856. valid = assertedType.valid;
  4857. }
  4858. }
  4859. if (!valid) {
  4860. warn(
  4861. getInvalidTypeMessage(name, value, expectedTypes),
  4862. vm
  4863. );
  4864. return
  4865. }
  4866. var validator = prop.validator;
  4867. if (validator) {
  4868. if (!validator(value)) {
  4869. warn(
  4870. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  4871. vm
  4872. );
  4873. }
  4874. }
  4875. }
  4876. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  4877. function assertType (value, type) {
  4878. var valid;
  4879. var expectedType = getType(type);
  4880. if (simpleCheckRE.test(expectedType)) {
  4881. var t = typeof value;
  4882. valid = t === expectedType.toLowerCase();
  4883. // for primitive wrapper objects
  4884. if (!valid && t === 'object') {
  4885. valid = value instanceof type;
  4886. }
  4887. } else if (expectedType === 'Object') {
  4888. valid = isPlainObject(value);
  4889. } else if (expectedType === 'Array') {
  4890. valid = Array.isArray(value);
  4891. } else {
  4892. valid = value instanceof type;
  4893. }
  4894. return {
  4895. valid: valid,
  4896. expectedType: expectedType
  4897. }
  4898. }
  4899. /**
  4900. * Use function string name to check built-in types,
  4901. * because a simple equality check will fail when running
  4902. * across different vms / iframes.
  4903. */
  4904. function getType (fn) {
  4905. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  4906. return match ? match[1] : ''
  4907. }
  4908. function isSameType (a, b) {
  4909. return getType(a) === getType(b)
  4910. }
  4911. function getTypeIndex (type, expectedTypes) {
  4912. if (!Array.isArray(expectedTypes)) {
  4913. return isSameType(expectedTypes, type) ? 0 : -1
  4914. }
  4915. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  4916. if (isSameType(expectedTypes[i], type)) {
  4917. return i
  4918. }
  4919. }
  4920. return -1
  4921. }
  4922. function getInvalidTypeMessage (name, value, expectedTypes) {
  4923. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  4924. " Expected " + (expectedTypes.map(capitalize).join(', '));
  4925. var expectedType = expectedTypes[0];
  4926. var receivedType = toRawType(value);
  4927. var expectedValue = styleValue(value, expectedType);
  4928. var receivedValue = styleValue(value, receivedType);
  4929. // check if we need to specify expected value
  4930. if (expectedTypes.length === 1 &&
  4931. isExplicable(expectedType) &&
  4932. !isBoolean(expectedType, receivedType)) {
  4933. message += " with value " + expectedValue;
  4934. }
  4935. message += ", got " + receivedType + " ";
  4936. // check if we need to specify received value
  4937. if (isExplicable(receivedType)) {
  4938. message += "with value " + receivedValue + ".";
  4939. }
  4940. return message
  4941. }
  4942. function styleValue (value, type) {
  4943. if (type === 'String') {
  4944. return ("\"" + value + "\"")
  4945. } else if (type === 'Number') {
  4946. return ("" + (Number(value)))
  4947. } else {
  4948. return ("" + value)
  4949. }
  4950. }
  4951. function isExplicable (value) {
  4952. var explicitTypes = ['string', 'number', 'boolean'];
  4953. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  4954. }
  4955. function isBoolean () {
  4956. var args = [], len = arguments.length;
  4957. while ( len-- ) args[ len ] = arguments[ len ];
  4958. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  4959. }
  4960. /* */
  4961. function handleError (err, vm, info) {
  4962. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  4963. // See: https://github.com/vuejs/vuex/issues/1505
  4964. pushTarget();
  4965. try {
  4966. if (vm) {
  4967. var cur = vm;
  4968. while ((cur = cur.$parent)) {
  4969. var hooks = cur.$options.errorCaptured;
  4970. if (hooks) {
  4971. for (var i = 0; i < hooks.length; i++) {
  4972. try {
  4973. var capture = hooks[i].call(cur, err, vm, info) === false;
  4974. if (capture) { return }
  4975. } catch (e) {
  4976. globalHandleError(e, cur, 'errorCaptured hook');
  4977. }
  4978. }
  4979. }
  4980. }
  4981. }
  4982. globalHandleError(err, vm, info);
  4983. } finally {
  4984. popTarget();
  4985. }
  4986. }
  4987. function invokeWithErrorHandling (
  4988. handler,
  4989. context,
  4990. args,
  4991. vm,
  4992. info
  4993. ) {
  4994. var res;
  4995. try {
  4996. res = args ? handler.apply(context, args) : handler.call(context);
  4997. if (res && !res._isVue && isPromise(res) && !res._handled) {
  4998. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  4999. // issue #9511
  5000. // avoid catch triggering multiple times when nested calls
  5001. res._handled = true;
  5002. }
  5003. } catch (e) {
  5004. handleError(e, vm, info);
  5005. }
  5006. return res
  5007. }
  5008. function globalHandleError (err, vm, info) {
  5009. if (config.errorHandler) {
  5010. try {
  5011. return config.errorHandler.call(null, err, vm, info)
  5012. } catch (e) {
  5013. // if the user intentionally throws the original error in the handler,
  5014. // do not log it twice
  5015. if (e !== err) {
  5016. logError(e, null, 'config.errorHandler');
  5017. }
  5018. }
  5019. }
  5020. logError(err, vm, info);
  5021. }
  5022. function logError (err, vm, info) {
  5023. if (true) {
  5024. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  5025. }
  5026. /* istanbul ignore else */
  5027. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  5028. console.error(err);
  5029. } else {
  5030. throw err
  5031. }
  5032. }
  5033. /* */
  5034. var callbacks = [];
  5035. var pending = false;
  5036. function flushCallbacks () {
  5037. pending = false;
  5038. var copies = callbacks.slice(0);
  5039. callbacks.length = 0;
  5040. for (var i = 0; i < copies.length; i++) {
  5041. copies[i]();
  5042. }
  5043. }
  5044. // Here we have async deferring wrappers using microtasks.
  5045. // In 2.5 we used (macro) tasks (in combination with microtasks).
  5046. // However, it has subtle problems when state is changed right before repaint
  5047. // (e.g. #6813, out-in transitions).
  5048. // Also, using (macro) tasks in event handler would cause some weird behaviors
  5049. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  5050. // So we now use microtasks everywhere, again.
  5051. // A major drawback of this tradeoff is that there are some scenarios
  5052. // where microtasks have too high a priority and fire in between supposedly
  5053. // sequential events (e.g. #4521, #6690, which have workarounds)
  5054. // or even between bubbling of the same event (#6566).
  5055. var timerFunc;
  5056. // The nextTick behavior leverages the microtask queue, which can be accessed
  5057. // via either native Promise.then or MutationObserver.
  5058. // MutationObserver has wider support, however it is seriously bugged in
  5059. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  5060. // completely stops working after triggering a few times... so, if native
  5061. // Promise is available, we will use it:
  5062. /* istanbul ignore next, $flow-disable-line */
  5063. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  5064. var p = Promise.resolve();
  5065. timerFunc = function () {
  5066. p.then(flushCallbacks);
  5067. // In problematic UIWebViews, Promise.then doesn't completely break, but
  5068. // it can get stuck in a weird state where callbacks are pushed into the
  5069. // microtask queue but the queue isn't being flushed, until the browser
  5070. // needs to do some other work, e.g. handle a timer. Therefore we can
  5071. // "force" the microtask queue to be flushed by adding an empty timer.
  5072. if (isIOS) { setTimeout(noop); }
  5073. };
  5074. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  5075. isNative(MutationObserver) ||
  5076. // PhantomJS and iOS 7.x
  5077. MutationObserver.toString() === '[object MutationObserverConstructor]'
  5078. )) {
  5079. // Use MutationObserver where native Promise is not available,
  5080. // e.g. PhantomJS, iOS7, Android 4.4
  5081. // (#6466 MutationObserver is unreliable in IE11)
  5082. var counter = 1;
  5083. var observer = new MutationObserver(flushCallbacks);
  5084. var textNode = document.createTextNode(String(counter));
  5085. observer.observe(textNode, {
  5086. characterData: true
  5087. });
  5088. timerFunc = function () {
  5089. counter = (counter + 1) % 2;
  5090. textNode.data = String(counter);
  5091. };
  5092. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  5093. // Fallback to setImmediate.
  5094. // Technically it leverages the (macro) task queue,
  5095. // but it is still a better choice than setTimeout.
  5096. timerFunc = function () {
  5097. setImmediate(flushCallbacks);
  5098. };
  5099. } else {
  5100. // Fallback to setTimeout.
  5101. timerFunc = function () {
  5102. setTimeout(flushCallbacks, 0);
  5103. };
  5104. }
  5105. function nextTick (cb, ctx) {
  5106. var _resolve;
  5107. callbacks.push(function () {
  5108. if (cb) {
  5109. try {
  5110. cb.call(ctx);
  5111. } catch (e) {
  5112. handleError(e, ctx, 'nextTick');
  5113. }
  5114. } else if (_resolve) {
  5115. _resolve(ctx);
  5116. }
  5117. });
  5118. if (!pending) {
  5119. pending = true;
  5120. timerFunc();
  5121. }
  5122. // $flow-disable-line
  5123. if (!cb && typeof Promise !== 'undefined') {
  5124. return new Promise(function (resolve) {
  5125. _resolve = resolve;
  5126. })
  5127. }
  5128. }
  5129. /* */
  5130. /* not type checking this file because flow doesn't play well with Proxy */
  5131. var initProxy;
  5132. if (true) {
  5133. var allowedGlobals = makeMap(
  5134. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  5135. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  5136. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  5137. 'require' // for Webpack/Browserify
  5138. );
  5139. var warnNonPresent = function (target, key) {
  5140. warn(
  5141. "Property or method \"" + key + "\" is not defined on the instance but " +
  5142. 'referenced during render. Make sure that this property is reactive, ' +
  5143. 'either in the data option, or for class-based components, by ' +
  5144. 'initializing the property. ' +
  5145. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  5146. target
  5147. );
  5148. };
  5149. var warnReservedPrefix = function (target, key) {
  5150. warn(
  5151. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  5152. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  5153. 'prevent conflicts with Vue internals. ' +
  5154. 'See: https://vuejs.org/v2/api/#data',
  5155. target
  5156. );
  5157. };
  5158. var hasProxy =
  5159. typeof Proxy !== 'undefined' && isNative(Proxy);
  5160. if (hasProxy) {
  5161. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  5162. config.keyCodes = new Proxy(config.keyCodes, {
  5163. set: function set (target, key, value) {
  5164. if (isBuiltInModifier(key)) {
  5165. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  5166. return false
  5167. } else {
  5168. target[key] = value;
  5169. return true
  5170. }
  5171. }
  5172. });
  5173. }
  5174. var hasHandler = {
  5175. has: function has (target, key) {
  5176. var has = key in target;
  5177. var isAllowed = allowedGlobals(key) ||
  5178. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  5179. if (!has && !isAllowed) {
  5180. if (key in target.$data) { warnReservedPrefix(target, key); }
  5181. else { warnNonPresent(target, key); }
  5182. }
  5183. return has || !isAllowed
  5184. }
  5185. };
  5186. var getHandler = {
  5187. get: function get (target, key) {
  5188. if (typeof key === 'string' && !(key in target)) {
  5189. if (key in target.$data) { warnReservedPrefix(target, key); }
  5190. else { warnNonPresent(target, key); }
  5191. }
  5192. return target[key]
  5193. }
  5194. };
  5195. initProxy = function initProxy (vm) {
  5196. if (hasProxy) {
  5197. // determine which proxy handler to use
  5198. var options = vm.$options;
  5199. var handlers = options.render && options.render._withStripped
  5200. ? getHandler
  5201. : hasHandler;
  5202. vm._renderProxy = new Proxy(vm, handlers);
  5203. } else {
  5204. vm._renderProxy = vm;
  5205. }
  5206. };
  5207. }
  5208. /* */
  5209. var seenObjects = new _Set();
  5210. /**
  5211. * Recursively traverse an object to evoke all converted
  5212. * getters, so that every nested property inside the object
  5213. * is collected as a "deep" dependency.
  5214. */
  5215. function traverse (val) {
  5216. _traverse(val, seenObjects);
  5217. seenObjects.clear();
  5218. }
  5219. function _traverse (val, seen) {
  5220. var i, keys;
  5221. var isA = Array.isArray(val);
  5222. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  5223. return
  5224. }
  5225. if (val.__ob__) {
  5226. var depId = val.__ob__.dep.id;
  5227. if (seen.has(depId)) {
  5228. return
  5229. }
  5230. seen.add(depId);
  5231. }
  5232. if (isA) {
  5233. i = val.length;
  5234. while (i--) { _traverse(val[i], seen); }
  5235. } else {
  5236. keys = Object.keys(val);
  5237. i = keys.length;
  5238. while (i--) { _traverse(val[keys[i]], seen); }
  5239. }
  5240. }
  5241. var mark;
  5242. var measure;
  5243. if (true) {
  5244. var perf = inBrowser && window.performance;
  5245. /* istanbul ignore if */
  5246. if (
  5247. perf &&
  5248. perf.mark &&
  5249. perf.measure &&
  5250. perf.clearMarks &&
  5251. perf.clearMeasures
  5252. ) {
  5253. mark = function (tag) { return perf.mark(tag); };
  5254. measure = function (name, startTag, endTag) {
  5255. perf.measure(name, startTag, endTag);
  5256. perf.clearMarks(startTag);
  5257. perf.clearMarks(endTag);
  5258. // perf.clearMeasures(name)
  5259. };
  5260. }
  5261. }
  5262. /* */
  5263. var normalizeEvent = cached(function (name) {
  5264. var passive = name.charAt(0) === '&';
  5265. name = passive ? name.slice(1) : name;
  5266. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  5267. name = once$$1 ? name.slice(1) : name;
  5268. var capture = name.charAt(0) === '!';
  5269. name = capture ? name.slice(1) : name;
  5270. return {
  5271. name: name,
  5272. once: once$$1,
  5273. capture: capture,
  5274. passive: passive
  5275. }
  5276. });
  5277. function createFnInvoker (fns, vm) {
  5278. function invoker () {
  5279. var arguments$1 = arguments;
  5280. var fns = invoker.fns;
  5281. if (Array.isArray(fns)) {
  5282. var cloned = fns.slice();
  5283. for (var i = 0; i < cloned.length; i++) {
  5284. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  5285. }
  5286. } else {
  5287. // return handler return value for single handlers
  5288. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  5289. }
  5290. }
  5291. invoker.fns = fns;
  5292. return invoker
  5293. }
  5294. function updateListeners (
  5295. on,
  5296. oldOn,
  5297. add,
  5298. remove$$1,
  5299. createOnceHandler,
  5300. vm
  5301. ) {
  5302. var name, def$$1, cur, old, event;
  5303. for (name in on) {
  5304. def$$1 = cur = on[name];
  5305. old = oldOn[name];
  5306. event = normalizeEvent(name);
  5307. if (isUndef(cur)) {
  5308. true && warn(
  5309. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  5310. vm
  5311. );
  5312. } else if (isUndef(old)) {
  5313. if (isUndef(cur.fns)) {
  5314. cur = on[name] = createFnInvoker(cur, vm);
  5315. }
  5316. if (isTrue(event.once)) {
  5317. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  5318. }
  5319. add(event.name, cur, event.capture, event.passive, event.params);
  5320. } else if (cur !== old) {
  5321. old.fns = cur;
  5322. on[name] = old;
  5323. }
  5324. }
  5325. for (name in oldOn) {
  5326. if (isUndef(on[name])) {
  5327. event = normalizeEvent(name);
  5328. remove$$1(event.name, oldOn[name], event.capture);
  5329. }
  5330. }
  5331. }
  5332. /* */
  5333. /* */
  5334. // fixed by xxxxxx (mp properties)
  5335. function extractPropertiesFromVNodeData(data, Ctor, res, context) {
  5336. var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties;
  5337. if (isUndef(propOptions)) {
  5338. return res
  5339. }
  5340. var externalClasses = Ctor.options.mpOptions.externalClasses || [];
  5341. var attrs = data.attrs;
  5342. var props = data.props;
  5343. if (isDef(attrs) || isDef(props)) {
  5344. for (var key in propOptions) {
  5345. var altKey = hyphenate(key);
  5346. var result = checkProp(res, props, key, altKey, true) ||
  5347. checkProp(res, attrs, key, altKey, false);
  5348. // externalClass
  5349. if (
  5350. result &&
  5351. res[key] &&
  5352. externalClasses.indexOf(altKey) !== -1 &&
  5353. context[camelize(res[key])]
  5354. ) {
  5355. // 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串)
  5356. res[key] = context[camelize(res[key])];
  5357. }
  5358. }
  5359. }
  5360. return res
  5361. }
  5362. function extractPropsFromVNodeData (
  5363. data,
  5364. Ctor,
  5365. tag,
  5366. context// fixed by xxxxxx
  5367. ) {
  5368. // we are only extracting raw values here.
  5369. // validation and default values are handled in the child
  5370. // component itself.
  5371. var propOptions = Ctor.options.props;
  5372. if (isUndef(propOptions)) {
  5373. // fixed by xxxxxx
  5374. return extractPropertiesFromVNodeData(data, Ctor, {}, context)
  5375. }
  5376. var res = {};
  5377. var attrs = data.attrs;
  5378. var props = data.props;
  5379. if (isDef(attrs) || isDef(props)) {
  5380. for (var key in propOptions) {
  5381. var altKey = hyphenate(key);
  5382. if (true) {
  5383. var keyInLowerCase = key.toLowerCase();
  5384. if (
  5385. key !== keyInLowerCase &&
  5386. attrs && hasOwn(attrs, keyInLowerCase)
  5387. ) {
  5388. tip(
  5389. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  5390. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  5391. " \"" + key + "\". " +
  5392. "Note that HTML attributes are case-insensitive and camelCased " +
  5393. "props need to use their kebab-case equivalents when using in-DOM " +
  5394. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  5395. );
  5396. }
  5397. }
  5398. checkProp(res, props, key, altKey, true) ||
  5399. checkProp(res, attrs, key, altKey, false);
  5400. }
  5401. }
  5402. // fixed by xxxxxx
  5403. return extractPropertiesFromVNodeData(data, Ctor, res, context)
  5404. }
  5405. function checkProp (
  5406. res,
  5407. hash,
  5408. key,
  5409. altKey,
  5410. preserve
  5411. ) {
  5412. if (isDef(hash)) {
  5413. if (hasOwn(hash, key)) {
  5414. res[key] = hash[key];
  5415. if (!preserve) {
  5416. delete hash[key];
  5417. }
  5418. return true
  5419. } else if (hasOwn(hash, altKey)) {
  5420. res[key] = hash[altKey];
  5421. if (!preserve) {
  5422. delete hash[altKey];
  5423. }
  5424. return true
  5425. }
  5426. }
  5427. return false
  5428. }
  5429. /* */
  5430. // The template compiler attempts to minimize the need for normalization by
  5431. // statically analyzing the template at compile time.
  5432. //
  5433. // For plain HTML markup, normalization can be completely skipped because the
  5434. // generated render function is guaranteed to return Array<VNode>. There are
  5435. // two cases where extra normalization is needed:
  5436. // 1. When the children contains components - because a functional component
  5437. // may return an Array instead of a single root. In this case, just a simple
  5438. // normalization is needed - if any child is an Array, we flatten the whole
  5439. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  5440. // because functional components already normalize their own children.
  5441. function simpleNormalizeChildren (children) {
  5442. for (var i = 0; i < children.length; i++) {
  5443. if (Array.isArray(children[i])) {
  5444. return Array.prototype.concat.apply([], children)
  5445. }
  5446. }
  5447. return children
  5448. }
  5449. // 2. When the children contains constructs that always generated nested Arrays,
  5450. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  5451. // with hand-written render functions / JSX. In such cases a full normalization
  5452. // is needed to cater to all possible types of children values.
  5453. function normalizeChildren (children) {
  5454. return isPrimitive(children)
  5455. ? [createTextVNode(children)]
  5456. : Array.isArray(children)
  5457. ? normalizeArrayChildren(children)
  5458. : undefined
  5459. }
  5460. function isTextNode (node) {
  5461. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  5462. }
  5463. function normalizeArrayChildren (children, nestedIndex) {
  5464. var res = [];
  5465. var i, c, lastIndex, last;
  5466. for (i = 0; i < children.length; i++) {
  5467. c = children[i];
  5468. if (isUndef(c) || typeof c === 'boolean') { continue }
  5469. lastIndex = res.length - 1;
  5470. last = res[lastIndex];
  5471. // nested
  5472. if (Array.isArray(c)) {
  5473. if (c.length > 0) {
  5474. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  5475. // merge adjacent text nodes
  5476. if (isTextNode(c[0]) && isTextNode(last)) {
  5477. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  5478. c.shift();
  5479. }
  5480. res.push.apply(res, c);
  5481. }
  5482. } else if (isPrimitive(c)) {
  5483. if (isTextNode(last)) {
  5484. // merge adjacent text nodes
  5485. // this is necessary for SSR hydration because text nodes are
  5486. // essentially merged when rendered to HTML strings
  5487. res[lastIndex] = createTextVNode(last.text + c);
  5488. } else if (c !== '') {
  5489. // convert primitive to vnode
  5490. res.push(createTextVNode(c));
  5491. }
  5492. } else {
  5493. if (isTextNode(c) && isTextNode(last)) {
  5494. // merge adjacent text nodes
  5495. res[lastIndex] = createTextVNode(last.text + c.text);
  5496. } else {
  5497. // default key for nested array children (likely generated by v-for)
  5498. if (isTrue(children._isVList) &&
  5499. isDef(c.tag) &&
  5500. isUndef(c.key) &&
  5501. isDef(nestedIndex)) {
  5502. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  5503. }
  5504. res.push(c);
  5505. }
  5506. }
  5507. }
  5508. return res
  5509. }
  5510. /* */
  5511. function initProvide (vm) {
  5512. var provide = vm.$options.provide;
  5513. if (provide) {
  5514. vm._provided = typeof provide === 'function'
  5515. ? provide.call(vm)
  5516. : provide;
  5517. }
  5518. }
  5519. function initInjections (vm) {
  5520. var result = resolveInject(vm.$options.inject, vm);
  5521. if (result) {
  5522. toggleObserving(false);
  5523. Object.keys(result).forEach(function (key) {
  5524. /* istanbul ignore else */
  5525. if (true) {
  5526. defineReactive$$1(vm, key, result[key], function () {
  5527. warn(
  5528. "Avoid mutating an injected value directly since the changes will be " +
  5529. "overwritten whenever the provided component re-renders. " +
  5530. "injection being mutated: \"" + key + "\"",
  5531. vm
  5532. );
  5533. });
  5534. } else {}
  5535. });
  5536. toggleObserving(true);
  5537. }
  5538. }
  5539. function resolveInject (inject, vm) {
  5540. if (inject) {
  5541. // inject is :any because flow is not smart enough to figure out cached
  5542. var result = Object.create(null);
  5543. var keys = hasSymbol
  5544. ? Reflect.ownKeys(inject)
  5545. : Object.keys(inject);
  5546. for (var i = 0; i < keys.length; i++) {
  5547. var key = keys[i];
  5548. // #6574 in case the inject object is observed...
  5549. if (key === '__ob__') { continue }
  5550. var provideKey = inject[key].from;
  5551. var source = vm;
  5552. while (source) {
  5553. if (source._provided && hasOwn(source._provided, provideKey)) {
  5554. result[key] = source._provided[provideKey];
  5555. break
  5556. }
  5557. source = source.$parent;
  5558. }
  5559. if (!source) {
  5560. if ('default' in inject[key]) {
  5561. var provideDefault = inject[key].default;
  5562. result[key] = typeof provideDefault === 'function'
  5563. ? provideDefault.call(vm)
  5564. : provideDefault;
  5565. } else if (true) {
  5566. warn(("Injection \"" + key + "\" not found"), vm);
  5567. }
  5568. }
  5569. }
  5570. return result
  5571. }
  5572. }
  5573. /* */
  5574. /**
  5575. * Runtime helper for resolving raw children VNodes into a slot object.
  5576. */
  5577. function resolveSlots (
  5578. children,
  5579. context
  5580. ) {
  5581. if (!children || !children.length) {
  5582. return {}
  5583. }
  5584. var slots = {};
  5585. for (var i = 0, l = children.length; i < l; i++) {
  5586. var child = children[i];
  5587. var data = child.data;
  5588. // remove slot attribute if the node is resolved as a Vue slot node
  5589. if (data && data.attrs && data.attrs.slot) {
  5590. delete data.attrs.slot;
  5591. }
  5592. // named slots should only be respected if the vnode was rendered in the
  5593. // same context.
  5594. if ((child.context === context || child.fnContext === context) &&
  5595. data && data.slot != null
  5596. ) {
  5597. var name = data.slot;
  5598. var slot = (slots[name] || (slots[name] = []));
  5599. if (child.tag === 'template') {
  5600. slot.push.apply(slot, child.children || []);
  5601. } else {
  5602. slot.push(child);
  5603. }
  5604. } else {
  5605. // fixed by xxxxxx 临时 hack 掉 uni-app 中的异步 name slot page
  5606. if(child.asyncMeta && child.asyncMeta.data && child.asyncMeta.data.slot === 'page'){
  5607. (slots['page'] || (slots['page'] = [])).push(child);
  5608. }else{
  5609. (slots.default || (slots.default = [])).push(child);
  5610. }
  5611. }
  5612. }
  5613. // ignore slots that contains only whitespace
  5614. for (var name$1 in slots) {
  5615. if (slots[name$1].every(isWhitespace)) {
  5616. delete slots[name$1];
  5617. }
  5618. }
  5619. return slots
  5620. }
  5621. function isWhitespace (node) {
  5622. return (node.isComment && !node.asyncFactory) || node.text === ' '
  5623. }
  5624. /* */
  5625. function normalizeScopedSlots (
  5626. slots,
  5627. normalSlots,
  5628. prevSlots
  5629. ) {
  5630. var res;
  5631. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  5632. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  5633. var key = slots && slots.$key;
  5634. if (!slots) {
  5635. res = {};
  5636. } else if (slots._normalized) {
  5637. // fast path 1: child component re-render only, parent did not change
  5638. return slots._normalized
  5639. } else if (
  5640. isStable &&
  5641. prevSlots &&
  5642. prevSlots !== emptyObject &&
  5643. key === prevSlots.$key &&
  5644. !hasNormalSlots &&
  5645. !prevSlots.$hasNormal
  5646. ) {
  5647. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  5648. // only need to normalize once
  5649. return prevSlots
  5650. } else {
  5651. res = {};
  5652. for (var key$1 in slots) {
  5653. if (slots[key$1] && key$1[0] !== '$') {
  5654. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  5655. }
  5656. }
  5657. }
  5658. // expose normal slots on scopedSlots
  5659. for (var key$2 in normalSlots) {
  5660. if (!(key$2 in res)) {
  5661. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  5662. }
  5663. }
  5664. // avoriaz seems to mock a non-extensible $scopedSlots object
  5665. // and when that is passed down this would cause an error
  5666. if (slots && Object.isExtensible(slots)) {
  5667. (slots)._normalized = res;
  5668. }
  5669. def(res, '$stable', isStable);
  5670. def(res, '$key', key);
  5671. def(res, '$hasNormal', hasNormalSlots);
  5672. return res
  5673. }
  5674. function normalizeScopedSlot(normalSlots, key, fn) {
  5675. var normalized = function () {
  5676. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  5677. res = res && typeof res === 'object' && !Array.isArray(res)
  5678. ? [res] // single vnode
  5679. : normalizeChildren(res);
  5680. return res && (
  5681. res.length === 0 ||
  5682. (res.length === 1 && res[0].isComment) // #9658
  5683. ) ? undefined
  5684. : res
  5685. };
  5686. // this is a slot using the new v-slot syntax without scope. although it is
  5687. // compiled as a scoped slot, render fn users would expect it to be present
  5688. // on this.$slots because the usage is semantically a normal slot.
  5689. if (fn.proxy) {
  5690. Object.defineProperty(normalSlots, key, {
  5691. get: normalized,
  5692. enumerable: true,
  5693. configurable: true
  5694. });
  5695. }
  5696. return normalized
  5697. }
  5698. function proxyNormalSlot(slots, key) {
  5699. return function () { return slots[key]; }
  5700. }
  5701. /* */
  5702. /**
  5703. * Runtime helper for rendering v-for lists.
  5704. */
  5705. function renderList (
  5706. val,
  5707. render
  5708. ) {
  5709. var ret, i, l, keys, key;
  5710. if (Array.isArray(val) || typeof val === 'string') {
  5711. ret = new Array(val.length);
  5712. for (i = 0, l = val.length; i < l; i++) {
  5713. ret[i] = render(val[i], i, i, i); // fixed by xxxxxx
  5714. }
  5715. } else if (typeof val === 'number') {
  5716. ret = new Array(val);
  5717. for (i = 0; i < val; i++) {
  5718. ret[i] = render(i + 1, i, i, i); // fixed by xxxxxx
  5719. }
  5720. } else if (isObject(val)) {
  5721. if (hasSymbol && val[Symbol.iterator]) {
  5722. ret = [];
  5723. var iterator = val[Symbol.iterator]();
  5724. var result = iterator.next();
  5725. while (!result.done) {
  5726. ret.push(render(result.value, ret.length, i, i++)); // fixed by xxxxxx
  5727. result = iterator.next();
  5728. }
  5729. } else {
  5730. keys = Object.keys(val);
  5731. ret = new Array(keys.length);
  5732. for (i = 0, l = keys.length; i < l; i++) {
  5733. key = keys[i];
  5734. ret[i] = render(val[key], key, i, i); // fixed by xxxxxx
  5735. }
  5736. }
  5737. }
  5738. if (!isDef(ret)) {
  5739. ret = [];
  5740. }
  5741. (ret)._isVList = true;
  5742. return ret
  5743. }
  5744. /* */
  5745. /**
  5746. * Runtime helper for rendering <slot>
  5747. */
  5748. function renderSlot (
  5749. name,
  5750. fallback,
  5751. props,
  5752. bindObject
  5753. ) {
  5754. var scopedSlotFn = this.$scopedSlots[name];
  5755. var nodes;
  5756. if (scopedSlotFn) { // scoped slot
  5757. props = props || {};
  5758. if (bindObject) {
  5759. if ( true && !isObject(bindObject)) {
  5760. warn(
  5761. 'slot v-bind without argument expects an Object',
  5762. this
  5763. );
  5764. }
  5765. props = extend(extend({}, bindObject), props);
  5766. }
  5767. // fixed by xxxxxx app-plus scopedSlot
  5768. nodes = scopedSlotFn(props, this, props._i) || fallback;
  5769. } else {
  5770. nodes = this.$slots[name] || fallback;
  5771. }
  5772. var target = props && props.slot;
  5773. if (target) {
  5774. return this.$createElement('template', { slot: target }, nodes)
  5775. } else {
  5776. return nodes
  5777. }
  5778. }
  5779. /* */
  5780. /**
  5781. * Runtime helper for resolving filters
  5782. */
  5783. function resolveFilter (id) {
  5784. return resolveAsset(this.$options, 'filters', id, true) || identity
  5785. }
  5786. /* */
  5787. function isKeyNotMatch (expect, actual) {
  5788. if (Array.isArray(expect)) {
  5789. return expect.indexOf(actual) === -1
  5790. } else {
  5791. return expect !== actual
  5792. }
  5793. }
  5794. /**
  5795. * Runtime helper for checking keyCodes from config.
  5796. * exposed as Vue.prototype._k
  5797. * passing in eventKeyName as last argument separately for backwards compat
  5798. */
  5799. function checkKeyCodes (
  5800. eventKeyCode,
  5801. key,
  5802. builtInKeyCode,
  5803. eventKeyName,
  5804. builtInKeyName
  5805. ) {
  5806. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  5807. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  5808. return isKeyNotMatch(builtInKeyName, eventKeyName)
  5809. } else if (mappedKeyCode) {
  5810. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  5811. } else if (eventKeyName) {
  5812. return hyphenate(eventKeyName) !== key
  5813. }
  5814. }
  5815. /* */
  5816. /**
  5817. * Runtime helper for merging v-bind="object" into a VNode's data.
  5818. */
  5819. function bindObjectProps (
  5820. data,
  5821. tag,
  5822. value,
  5823. asProp,
  5824. isSync
  5825. ) {
  5826. if (value) {
  5827. if (!isObject(value)) {
  5828. true && warn(
  5829. 'v-bind without argument expects an Object or Array value',
  5830. this
  5831. );
  5832. } else {
  5833. if (Array.isArray(value)) {
  5834. value = toObject(value);
  5835. }
  5836. var hash;
  5837. var loop = function ( key ) {
  5838. if (
  5839. key === 'class' ||
  5840. key === 'style' ||
  5841. isReservedAttribute(key)
  5842. ) {
  5843. hash = data;
  5844. } else {
  5845. var type = data.attrs && data.attrs.type;
  5846. hash = asProp || config.mustUseProp(tag, type, key)
  5847. ? data.domProps || (data.domProps = {})
  5848. : data.attrs || (data.attrs = {});
  5849. }
  5850. var camelizedKey = camelize(key);
  5851. var hyphenatedKey = hyphenate(key);
  5852. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  5853. hash[key] = value[key];
  5854. if (isSync) {
  5855. var on = data.on || (data.on = {});
  5856. on[("update:" + key)] = function ($event) {
  5857. value[key] = $event;
  5858. };
  5859. }
  5860. }
  5861. };
  5862. for (var key in value) loop( key );
  5863. }
  5864. }
  5865. return data
  5866. }
  5867. /* */
  5868. /**
  5869. * Runtime helper for rendering static trees.
  5870. */
  5871. function renderStatic (
  5872. index,
  5873. isInFor
  5874. ) {
  5875. var cached = this._staticTrees || (this._staticTrees = []);
  5876. var tree = cached[index];
  5877. // if has already-rendered static tree and not inside v-for,
  5878. // we can reuse the same tree.
  5879. if (tree && !isInFor) {
  5880. return tree
  5881. }
  5882. // otherwise, render a fresh tree.
  5883. tree = cached[index] = this.$options.staticRenderFns[index].call(
  5884. this._renderProxy,
  5885. null,
  5886. this // for render fns generated for functional component templates
  5887. );
  5888. markStatic(tree, ("__static__" + index), false);
  5889. return tree
  5890. }
  5891. /**
  5892. * Runtime helper for v-once.
  5893. * Effectively it means marking the node as static with a unique key.
  5894. */
  5895. function markOnce (
  5896. tree,
  5897. index,
  5898. key
  5899. ) {
  5900. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  5901. return tree
  5902. }
  5903. function markStatic (
  5904. tree,
  5905. key,
  5906. isOnce
  5907. ) {
  5908. if (Array.isArray(tree)) {
  5909. for (var i = 0; i < tree.length; i++) {
  5910. if (tree[i] && typeof tree[i] !== 'string') {
  5911. markStaticNode(tree[i], (key + "_" + i), isOnce);
  5912. }
  5913. }
  5914. } else {
  5915. markStaticNode(tree, key, isOnce);
  5916. }
  5917. }
  5918. function markStaticNode (node, key, isOnce) {
  5919. node.isStatic = true;
  5920. node.key = key;
  5921. node.isOnce = isOnce;
  5922. }
  5923. /* */
  5924. function bindObjectListeners (data, value) {
  5925. if (value) {
  5926. if (!isPlainObject(value)) {
  5927. true && warn(
  5928. 'v-on without argument expects an Object value',
  5929. this
  5930. );
  5931. } else {
  5932. var on = data.on = data.on ? extend({}, data.on) : {};
  5933. for (var key in value) {
  5934. var existing = on[key];
  5935. var ours = value[key];
  5936. on[key] = existing ? [].concat(existing, ours) : ours;
  5937. }
  5938. }
  5939. }
  5940. return data
  5941. }
  5942. /* */
  5943. function resolveScopedSlots (
  5944. fns, // see flow/vnode
  5945. res,
  5946. // the following are added in 2.6
  5947. hasDynamicKeys,
  5948. contentHashKey
  5949. ) {
  5950. res = res || { $stable: !hasDynamicKeys };
  5951. for (var i = 0; i < fns.length; i++) {
  5952. var slot = fns[i];
  5953. if (Array.isArray(slot)) {
  5954. resolveScopedSlots(slot, res, hasDynamicKeys);
  5955. } else if (slot) {
  5956. // marker for reverse proxying v-slot without scope on this.$slots
  5957. if (slot.proxy) {
  5958. slot.fn.proxy = true;
  5959. }
  5960. res[slot.key] = slot.fn;
  5961. }
  5962. }
  5963. if (contentHashKey) {
  5964. (res).$key = contentHashKey;
  5965. }
  5966. return res
  5967. }
  5968. /* */
  5969. function bindDynamicKeys (baseObj, values) {
  5970. for (var i = 0; i < values.length; i += 2) {
  5971. var key = values[i];
  5972. if (typeof key === 'string' && key) {
  5973. baseObj[values[i]] = values[i + 1];
  5974. } else if ( true && key !== '' && key !== null) {
  5975. // null is a special value for explicitly removing a binding
  5976. warn(
  5977. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  5978. this
  5979. );
  5980. }
  5981. }
  5982. return baseObj
  5983. }
  5984. // helper to dynamically append modifier runtime markers to event names.
  5985. // ensure only append when value is already string, otherwise it will be cast
  5986. // to string and cause the type check to miss.
  5987. function prependModifier (value, symbol) {
  5988. return typeof value === 'string' ? symbol + value : value
  5989. }
  5990. /* */
  5991. function installRenderHelpers (target) {
  5992. target._o = markOnce;
  5993. target._n = toNumber;
  5994. target._s = toString;
  5995. target._l = renderList;
  5996. target._t = renderSlot;
  5997. target._q = looseEqual;
  5998. target._i = looseIndexOf;
  5999. target._m = renderStatic;
  6000. target._f = resolveFilter;
  6001. target._k = checkKeyCodes;
  6002. target._b = bindObjectProps;
  6003. target._v = createTextVNode;
  6004. target._e = createEmptyVNode;
  6005. target._u = resolveScopedSlots;
  6006. target._g = bindObjectListeners;
  6007. target._d = bindDynamicKeys;
  6008. target._p = prependModifier;
  6009. }
  6010. /* */
  6011. function FunctionalRenderContext (
  6012. data,
  6013. props,
  6014. children,
  6015. parent,
  6016. Ctor
  6017. ) {
  6018. var this$1 = this;
  6019. var options = Ctor.options;
  6020. // ensure the createElement function in functional components
  6021. // gets a unique context - this is necessary for correct named slot check
  6022. var contextVm;
  6023. if (hasOwn(parent, '_uid')) {
  6024. contextVm = Object.create(parent);
  6025. // $flow-disable-line
  6026. contextVm._original = parent;
  6027. } else {
  6028. // the context vm passed in is a functional context as well.
  6029. // in this case we want to make sure we are able to get a hold to the
  6030. // real context instance.
  6031. contextVm = parent;
  6032. // $flow-disable-line
  6033. parent = parent._original;
  6034. }
  6035. var isCompiled = isTrue(options._compiled);
  6036. var needNormalization = !isCompiled;
  6037. this.data = data;
  6038. this.props = props;
  6039. this.children = children;
  6040. this.parent = parent;
  6041. this.listeners = data.on || emptyObject;
  6042. this.injections = resolveInject(options.inject, parent);
  6043. this.slots = function () {
  6044. if (!this$1.$slots) {
  6045. normalizeScopedSlots(
  6046. data.scopedSlots,
  6047. this$1.$slots = resolveSlots(children, parent)
  6048. );
  6049. }
  6050. return this$1.$slots
  6051. };
  6052. Object.defineProperty(this, 'scopedSlots', ({
  6053. enumerable: true,
  6054. get: function get () {
  6055. return normalizeScopedSlots(data.scopedSlots, this.slots())
  6056. }
  6057. }));
  6058. // support for compiled functional template
  6059. if (isCompiled) {
  6060. // exposing $options for renderStatic()
  6061. this.$options = options;
  6062. // pre-resolve slots for renderSlot()
  6063. this.$slots = this.slots();
  6064. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  6065. }
  6066. if (options._scopeId) {
  6067. this._c = function (a, b, c, d) {
  6068. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  6069. if (vnode && !Array.isArray(vnode)) {
  6070. vnode.fnScopeId = options._scopeId;
  6071. vnode.fnContext = parent;
  6072. }
  6073. return vnode
  6074. };
  6075. } else {
  6076. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  6077. }
  6078. }
  6079. installRenderHelpers(FunctionalRenderContext.prototype);
  6080. function createFunctionalComponent (
  6081. Ctor,
  6082. propsData,
  6083. data,
  6084. contextVm,
  6085. children
  6086. ) {
  6087. var options = Ctor.options;
  6088. var props = {};
  6089. var propOptions = options.props;
  6090. if (isDef(propOptions)) {
  6091. for (var key in propOptions) {
  6092. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  6093. }
  6094. } else {
  6095. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  6096. if (isDef(data.props)) { mergeProps(props, data.props); }
  6097. }
  6098. var renderContext = new FunctionalRenderContext(
  6099. data,
  6100. props,
  6101. children,
  6102. contextVm,
  6103. Ctor
  6104. );
  6105. var vnode = options.render.call(null, renderContext._c, renderContext);
  6106. if (vnode instanceof VNode) {
  6107. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  6108. } else if (Array.isArray(vnode)) {
  6109. var vnodes = normalizeChildren(vnode) || [];
  6110. var res = new Array(vnodes.length);
  6111. for (var i = 0; i < vnodes.length; i++) {
  6112. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  6113. }
  6114. return res
  6115. }
  6116. }
  6117. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  6118. // #7817 clone node before setting fnContext, otherwise if the node is reused
  6119. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  6120. // that should not be matched to match.
  6121. var clone = cloneVNode(vnode);
  6122. clone.fnContext = contextVm;
  6123. clone.fnOptions = options;
  6124. if (true) {
  6125. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  6126. }
  6127. if (data.slot) {
  6128. (clone.data || (clone.data = {})).slot = data.slot;
  6129. }
  6130. return clone
  6131. }
  6132. function mergeProps (to, from) {
  6133. for (var key in from) {
  6134. to[camelize(key)] = from[key];
  6135. }
  6136. }
  6137. /* */
  6138. /* */
  6139. /* */
  6140. /* */
  6141. // inline hooks to be invoked on component VNodes during patch
  6142. var componentVNodeHooks = {
  6143. init: function init (vnode, hydrating) {
  6144. if (
  6145. vnode.componentInstance &&
  6146. !vnode.componentInstance._isDestroyed &&
  6147. vnode.data.keepAlive
  6148. ) {
  6149. // kept-alive components, treat as a patch
  6150. var mountedNode = vnode; // work around flow
  6151. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  6152. } else {
  6153. var child = vnode.componentInstance = createComponentInstanceForVnode(
  6154. vnode,
  6155. activeInstance
  6156. );
  6157. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  6158. }
  6159. },
  6160. prepatch: function prepatch (oldVnode, vnode) {
  6161. var options = vnode.componentOptions;
  6162. var child = vnode.componentInstance = oldVnode.componentInstance;
  6163. updateChildComponent(
  6164. child,
  6165. options.propsData, // updated props
  6166. options.listeners, // updated listeners
  6167. vnode, // new parent vnode
  6168. options.children // new children
  6169. );
  6170. },
  6171. insert: function insert (vnode) {
  6172. var context = vnode.context;
  6173. var componentInstance = vnode.componentInstance;
  6174. if (!componentInstance._isMounted) {
  6175. callHook(componentInstance, 'onServiceCreated');
  6176. callHook(componentInstance, 'onServiceAttached');
  6177. componentInstance._isMounted = true;
  6178. callHook(componentInstance, 'mounted');
  6179. }
  6180. if (vnode.data.keepAlive) {
  6181. if (context._isMounted) {
  6182. // vue-router#1212
  6183. // During updates, a kept-alive component's child components may
  6184. // change, so directly walking the tree here may call activated hooks
  6185. // on incorrect children. Instead we push them into a queue which will
  6186. // be processed after the whole patch process ended.
  6187. queueActivatedComponent(componentInstance);
  6188. } else {
  6189. activateChildComponent(componentInstance, true /* direct */);
  6190. }
  6191. }
  6192. },
  6193. destroy: function destroy (vnode) {
  6194. var componentInstance = vnode.componentInstance;
  6195. if (!componentInstance._isDestroyed) {
  6196. if (!vnode.data.keepAlive) {
  6197. componentInstance.$destroy();
  6198. } else {
  6199. deactivateChildComponent(componentInstance, true /* direct */);
  6200. }
  6201. }
  6202. }
  6203. };
  6204. var hooksToMerge = Object.keys(componentVNodeHooks);
  6205. function createComponent (
  6206. Ctor,
  6207. data,
  6208. context,
  6209. children,
  6210. tag
  6211. ) {
  6212. if (isUndef(Ctor)) {
  6213. return
  6214. }
  6215. var baseCtor = context.$options._base;
  6216. // plain options object: turn it into a constructor
  6217. if (isObject(Ctor)) {
  6218. Ctor = baseCtor.extend(Ctor);
  6219. }
  6220. // if at this stage it's not a constructor or an async component factory,
  6221. // reject.
  6222. if (typeof Ctor !== 'function') {
  6223. if (true) {
  6224. warn(("Invalid Component definition: " + (String(Ctor))), context);
  6225. }
  6226. return
  6227. }
  6228. // async component
  6229. var asyncFactory;
  6230. if (isUndef(Ctor.cid)) {
  6231. asyncFactory = Ctor;
  6232. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  6233. if (Ctor === undefined) {
  6234. // return a placeholder node for async component, which is rendered
  6235. // as a comment node but preserves all the raw information for the node.
  6236. // the information will be used for async server-rendering and hydration.
  6237. return createAsyncPlaceholder(
  6238. asyncFactory,
  6239. data,
  6240. context,
  6241. children,
  6242. tag
  6243. )
  6244. }
  6245. }
  6246. data = data || {};
  6247. // resolve constructor options in case global mixins are applied after
  6248. // component constructor creation
  6249. resolveConstructorOptions(Ctor);
  6250. // transform component v-model data into props & events
  6251. if (isDef(data.model)) {
  6252. transformModel(Ctor.options, data);
  6253. }
  6254. // extract props
  6255. var propsData = extractPropsFromVNodeData(data, Ctor, tag, context); // fixed by xxxxxx
  6256. // functional component
  6257. if (isTrue(Ctor.options.functional)) {
  6258. return createFunctionalComponent(Ctor, propsData, data, context, children)
  6259. }
  6260. // extract listeners, since these needs to be treated as
  6261. // child component listeners instead of DOM listeners
  6262. var listeners = data.on;
  6263. // replace with listeners with .native modifier
  6264. // so it gets processed during parent component patch.
  6265. data.on = data.nativeOn;
  6266. if (isTrue(Ctor.options.abstract)) {
  6267. // abstract components do not keep anything
  6268. // other than props & listeners & slot
  6269. // work around flow
  6270. var slot = data.slot;
  6271. data = {};
  6272. if (slot) {
  6273. data.slot = slot;
  6274. }
  6275. }
  6276. // install component management hooks onto the placeholder node
  6277. installComponentHooks(data);
  6278. // return a placeholder vnode
  6279. var name = Ctor.options.name || tag;
  6280. var vnode = new VNode(
  6281. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  6282. data, undefined, undefined, undefined, context,
  6283. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  6284. asyncFactory
  6285. );
  6286. return vnode
  6287. }
  6288. function createComponentInstanceForVnode (
  6289. vnode, // we know it's MountedComponentVNode but flow doesn't
  6290. parent // activeInstance in lifecycle state
  6291. ) {
  6292. var options = {
  6293. _isComponent: true,
  6294. _parentVnode: vnode,
  6295. parent: parent
  6296. };
  6297. // check inline-template render functions
  6298. var inlineTemplate = vnode.data.inlineTemplate;
  6299. if (isDef(inlineTemplate)) {
  6300. options.render = inlineTemplate.render;
  6301. options.staticRenderFns = inlineTemplate.staticRenderFns;
  6302. }
  6303. return new vnode.componentOptions.Ctor(options)
  6304. }
  6305. function installComponentHooks (data) {
  6306. var hooks = data.hook || (data.hook = {});
  6307. for (var i = 0; i < hooksToMerge.length; i++) {
  6308. var key = hooksToMerge[i];
  6309. var existing = hooks[key];
  6310. var toMerge = componentVNodeHooks[key];
  6311. if (existing !== toMerge && !(existing && existing._merged)) {
  6312. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  6313. }
  6314. }
  6315. }
  6316. function mergeHook$1 (f1, f2) {
  6317. var merged = function (a, b) {
  6318. // flow complains about extra args which is why we use any
  6319. f1(a, b);
  6320. f2(a, b);
  6321. };
  6322. merged._merged = true;
  6323. return merged
  6324. }
  6325. // transform component v-model info (value and callback) into
  6326. // prop and event handler respectively.
  6327. function transformModel (options, data) {
  6328. var prop = (options.model && options.model.prop) || 'value';
  6329. var event = (options.model && options.model.event) || 'input'
  6330. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  6331. var on = data.on || (data.on = {});
  6332. var existing = on[event];
  6333. var callback = data.model.callback;
  6334. if (isDef(existing)) {
  6335. if (
  6336. Array.isArray(existing)
  6337. ? existing.indexOf(callback) === -1
  6338. : existing !== callback
  6339. ) {
  6340. on[event] = [callback].concat(existing);
  6341. }
  6342. } else {
  6343. on[event] = callback;
  6344. }
  6345. }
  6346. /* */
  6347. var SIMPLE_NORMALIZE = 1;
  6348. var ALWAYS_NORMALIZE = 2;
  6349. // wrapper function for providing a more flexible interface
  6350. // without getting yelled at by flow
  6351. function createElement (
  6352. context,
  6353. tag,
  6354. data,
  6355. children,
  6356. normalizationType,
  6357. alwaysNormalize
  6358. ) {
  6359. if (Array.isArray(data) || isPrimitive(data)) {
  6360. normalizationType = children;
  6361. children = data;
  6362. data = undefined;
  6363. }
  6364. if (isTrue(alwaysNormalize)) {
  6365. normalizationType = ALWAYS_NORMALIZE;
  6366. }
  6367. return _createElement(context, tag, data, children, normalizationType)
  6368. }
  6369. function _createElement (
  6370. context,
  6371. tag,
  6372. data,
  6373. children,
  6374. normalizationType
  6375. ) {
  6376. if (isDef(data) && isDef((data).__ob__)) {
  6377. true && warn(
  6378. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  6379. 'Always create fresh vnode data objects in each render!',
  6380. context
  6381. );
  6382. return createEmptyVNode()
  6383. }
  6384. // object syntax in v-bind
  6385. if (isDef(data) && isDef(data.is)) {
  6386. tag = data.is;
  6387. }
  6388. if (!tag) {
  6389. // in case of component :is set to falsy value
  6390. return createEmptyVNode()
  6391. }
  6392. // warn against non-primitive key
  6393. if ( true &&
  6394. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  6395. ) {
  6396. {
  6397. warn(
  6398. 'Avoid using non-primitive value as key, ' +
  6399. 'use string/number value instead.',
  6400. context
  6401. );
  6402. }
  6403. }
  6404. // support single function children as default scoped slot
  6405. if (Array.isArray(children) &&
  6406. typeof children[0] === 'function'
  6407. ) {
  6408. data = data || {};
  6409. data.scopedSlots = { default: children[0] };
  6410. children.length = 0;
  6411. }
  6412. if (normalizationType === ALWAYS_NORMALIZE) {
  6413. children = normalizeChildren(children);
  6414. } else if (normalizationType === SIMPLE_NORMALIZE) {
  6415. children = simpleNormalizeChildren(children);
  6416. }
  6417. var vnode, ns;
  6418. if (typeof tag === 'string') {
  6419. var Ctor;
  6420. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  6421. if (config.isReservedTag(tag)) {
  6422. // platform built-in elements
  6423. if ( true && isDef(data) && isDef(data.nativeOn)) {
  6424. warn(
  6425. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  6426. context
  6427. );
  6428. }
  6429. vnode = new VNode(
  6430. config.parsePlatformTagName(tag), data, children,
  6431. undefined, undefined, context
  6432. );
  6433. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  6434. // component
  6435. vnode = createComponent(Ctor, data, context, children, tag);
  6436. } else {
  6437. // unknown or unlisted namespaced elements
  6438. // check at runtime because it may get assigned a namespace when its
  6439. // parent normalizes children
  6440. vnode = new VNode(
  6441. tag, data, children,
  6442. undefined, undefined, context
  6443. );
  6444. }
  6445. } else {
  6446. // direct component options / constructor
  6447. vnode = createComponent(tag, data, context, children);
  6448. }
  6449. if (Array.isArray(vnode)) {
  6450. return vnode
  6451. } else if (isDef(vnode)) {
  6452. if (isDef(ns)) { applyNS(vnode, ns); }
  6453. if (isDef(data)) { registerDeepBindings(data); }
  6454. return vnode
  6455. } else {
  6456. return createEmptyVNode()
  6457. }
  6458. }
  6459. function applyNS (vnode, ns, force) {
  6460. vnode.ns = ns;
  6461. if (vnode.tag === 'foreignObject') {
  6462. // use default namespace inside foreignObject
  6463. ns = undefined;
  6464. force = true;
  6465. }
  6466. if (isDef(vnode.children)) {
  6467. for (var i = 0, l = vnode.children.length; i < l; i++) {
  6468. var child = vnode.children[i];
  6469. if (isDef(child.tag) && (
  6470. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  6471. applyNS(child, ns, force);
  6472. }
  6473. }
  6474. }
  6475. }
  6476. // ref #5318
  6477. // necessary to ensure parent re-render when deep bindings like :style and
  6478. // :class are used on slot nodes
  6479. function registerDeepBindings (data) {
  6480. if (isObject(data.style)) {
  6481. traverse(data.style);
  6482. }
  6483. if (isObject(data.class)) {
  6484. traverse(data.class);
  6485. }
  6486. }
  6487. /* */
  6488. function initRender (vm) {
  6489. vm._vnode = null; // the root of the child tree
  6490. vm._staticTrees = null; // v-once cached trees
  6491. var options = vm.$options;
  6492. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  6493. var renderContext = parentVnode && parentVnode.context;
  6494. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  6495. vm.$scopedSlots = emptyObject;
  6496. // bind the createElement fn to this instance
  6497. // so that we get proper render context inside it.
  6498. // args order: tag, data, children, normalizationType, alwaysNormalize
  6499. // internal version is used by render functions compiled from templates
  6500. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  6501. // normalization is always applied for the public version, used in
  6502. // user-written render functions.
  6503. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  6504. // $attrs & $listeners are exposed for easier HOC creation.
  6505. // they need to be reactive so that HOCs using them are always updated
  6506. var parentData = parentVnode && parentVnode.data;
  6507. /* istanbul ignore else */
  6508. if (true) {
  6509. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  6510. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  6511. }, true);
  6512. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  6513. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  6514. }, true);
  6515. } else {}
  6516. }
  6517. var currentRenderingInstance = null;
  6518. function renderMixin (Vue) {
  6519. // install runtime convenience helpers
  6520. installRenderHelpers(Vue.prototype);
  6521. Vue.prototype.$nextTick = function (fn) {
  6522. return nextTick(fn, this)
  6523. };
  6524. Vue.prototype._render = function () {
  6525. var vm = this;
  6526. var ref = vm.$options;
  6527. var render = ref.render;
  6528. var _parentVnode = ref._parentVnode;
  6529. if (_parentVnode) {
  6530. vm.$scopedSlots = normalizeScopedSlots(
  6531. _parentVnode.data.scopedSlots,
  6532. vm.$slots,
  6533. vm.$scopedSlots
  6534. );
  6535. }
  6536. // set parent vnode. this allows render functions to have access
  6537. // to the data on the placeholder node.
  6538. vm.$vnode = _parentVnode;
  6539. // render self
  6540. var vnode;
  6541. try {
  6542. // There's no need to maintain a stack because all render fns are called
  6543. // separately from one another. Nested component's render fns are called
  6544. // when parent component is patched.
  6545. currentRenderingInstance = vm;
  6546. vnode = render.call(vm._renderProxy, vm.$createElement);
  6547. } catch (e) {
  6548. handleError(e, vm, "render");
  6549. // return error render result,
  6550. // or previous vnode to prevent render error causing blank component
  6551. /* istanbul ignore else */
  6552. if ( true && vm.$options.renderError) {
  6553. try {
  6554. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  6555. } catch (e) {
  6556. handleError(e, vm, "renderError");
  6557. vnode = vm._vnode;
  6558. }
  6559. } else {
  6560. vnode = vm._vnode;
  6561. }
  6562. } finally {
  6563. currentRenderingInstance = null;
  6564. }
  6565. // if the returned array contains only a single node, allow it
  6566. if (Array.isArray(vnode) && vnode.length === 1) {
  6567. vnode = vnode[0];
  6568. }
  6569. // return empty vnode in case the render function errored out
  6570. if (!(vnode instanceof VNode)) {
  6571. if ( true && Array.isArray(vnode)) {
  6572. warn(
  6573. 'Multiple root nodes returned from render function. Render function ' +
  6574. 'should return a single root node.',
  6575. vm
  6576. );
  6577. }
  6578. vnode = createEmptyVNode();
  6579. }
  6580. // set parent
  6581. vnode.parent = _parentVnode;
  6582. return vnode
  6583. };
  6584. }
  6585. /* */
  6586. function ensureCtor (comp, base) {
  6587. if (
  6588. comp.__esModule ||
  6589. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  6590. ) {
  6591. comp = comp.default;
  6592. }
  6593. return isObject(comp)
  6594. ? base.extend(comp)
  6595. : comp
  6596. }
  6597. function createAsyncPlaceholder (
  6598. factory,
  6599. data,
  6600. context,
  6601. children,
  6602. tag
  6603. ) {
  6604. var node = createEmptyVNode();
  6605. node.asyncFactory = factory;
  6606. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  6607. return node
  6608. }
  6609. function resolveAsyncComponent (
  6610. factory,
  6611. baseCtor
  6612. ) {
  6613. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  6614. return factory.errorComp
  6615. }
  6616. if (isDef(factory.resolved)) {
  6617. return factory.resolved
  6618. }
  6619. var owner = currentRenderingInstance;
  6620. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  6621. // already pending
  6622. factory.owners.push(owner);
  6623. }
  6624. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  6625. return factory.loadingComp
  6626. }
  6627. if (owner && !isDef(factory.owners)) {
  6628. var owners = factory.owners = [owner];
  6629. var sync = true;
  6630. var timerLoading = null;
  6631. var timerTimeout = null
  6632. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  6633. var forceRender = function (renderCompleted) {
  6634. for (var i = 0, l = owners.length; i < l; i++) {
  6635. (owners[i]).$forceUpdate();
  6636. }
  6637. if (renderCompleted) {
  6638. owners.length = 0;
  6639. if (timerLoading !== null) {
  6640. clearTimeout(timerLoading);
  6641. timerLoading = null;
  6642. }
  6643. if (timerTimeout !== null) {
  6644. clearTimeout(timerTimeout);
  6645. timerTimeout = null;
  6646. }
  6647. }
  6648. };
  6649. var resolve = once(function (res) {
  6650. // cache resolved
  6651. factory.resolved = ensureCtor(res, baseCtor);
  6652. // invoke callbacks only if this is not a synchronous resolve
  6653. // (async resolves are shimmed as synchronous during SSR)
  6654. if (!sync) {
  6655. forceRender(true);
  6656. } else {
  6657. owners.length = 0;
  6658. }
  6659. });
  6660. var reject = once(function (reason) {
  6661. true && warn(
  6662. "Failed to resolve async component: " + (String(factory)) +
  6663. (reason ? ("\nReason: " + reason) : '')
  6664. );
  6665. if (isDef(factory.errorComp)) {
  6666. factory.error = true;
  6667. forceRender(true);
  6668. }
  6669. });
  6670. var res = factory(resolve, reject);
  6671. if (isObject(res)) {
  6672. if (isPromise(res)) {
  6673. // () => Promise
  6674. if (isUndef(factory.resolved)) {
  6675. res.then(resolve, reject);
  6676. }
  6677. } else if (isPromise(res.component)) {
  6678. res.component.then(resolve, reject);
  6679. if (isDef(res.error)) {
  6680. factory.errorComp = ensureCtor(res.error, baseCtor);
  6681. }
  6682. if (isDef(res.loading)) {
  6683. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  6684. if (res.delay === 0) {
  6685. factory.loading = true;
  6686. } else {
  6687. timerLoading = setTimeout(function () {
  6688. timerLoading = null;
  6689. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  6690. factory.loading = true;
  6691. forceRender(false);
  6692. }
  6693. }, res.delay || 200);
  6694. }
  6695. }
  6696. if (isDef(res.timeout)) {
  6697. timerTimeout = setTimeout(function () {
  6698. timerTimeout = null;
  6699. if (isUndef(factory.resolved)) {
  6700. reject(
  6701. true
  6702. ? ("timeout (" + (res.timeout) + "ms)")
  6703. : undefined
  6704. );
  6705. }
  6706. }, res.timeout);
  6707. }
  6708. }
  6709. }
  6710. sync = false;
  6711. // return in case resolved synchronously
  6712. return factory.loading
  6713. ? factory.loadingComp
  6714. : factory.resolved
  6715. }
  6716. }
  6717. /* */
  6718. function isAsyncPlaceholder (node) {
  6719. return node.isComment && node.asyncFactory
  6720. }
  6721. /* */
  6722. function getFirstComponentChild (children) {
  6723. if (Array.isArray(children)) {
  6724. for (var i = 0; i < children.length; i++) {
  6725. var c = children[i];
  6726. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  6727. return c
  6728. }
  6729. }
  6730. }
  6731. }
  6732. /* */
  6733. /* */
  6734. function initEvents (vm) {
  6735. vm._events = Object.create(null);
  6736. vm._hasHookEvent = false;
  6737. // init parent attached events
  6738. var listeners = vm.$options._parentListeners;
  6739. if (listeners) {
  6740. updateComponentListeners(vm, listeners);
  6741. }
  6742. }
  6743. var target;
  6744. function add (event, fn) {
  6745. target.$on(event, fn);
  6746. }
  6747. function remove$1 (event, fn) {
  6748. target.$off(event, fn);
  6749. }
  6750. function createOnceHandler (event, fn) {
  6751. var _target = target;
  6752. return function onceHandler () {
  6753. var res = fn.apply(null, arguments);
  6754. if (res !== null) {
  6755. _target.$off(event, onceHandler);
  6756. }
  6757. }
  6758. }
  6759. function updateComponentListeners (
  6760. vm,
  6761. listeners,
  6762. oldListeners
  6763. ) {
  6764. target = vm;
  6765. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  6766. target = undefined;
  6767. }
  6768. function eventsMixin (Vue) {
  6769. var hookRE = /^hook:/;
  6770. Vue.prototype.$on = function (event, fn) {
  6771. var vm = this;
  6772. if (Array.isArray(event)) {
  6773. for (var i = 0, l = event.length; i < l; i++) {
  6774. vm.$on(event[i], fn);
  6775. }
  6776. } else {
  6777. (vm._events[event] || (vm._events[event] = [])).push(fn);
  6778. // optimize hook:event cost by using a boolean flag marked at registration
  6779. // instead of a hash lookup
  6780. if (hookRE.test(event)) {
  6781. vm._hasHookEvent = true;
  6782. }
  6783. }
  6784. return vm
  6785. };
  6786. Vue.prototype.$once = function (event, fn) {
  6787. var vm = this;
  6788. function on () {
  6789. vm.$off(event, on);
  6790. fn.apply(vm, arguments);
  6791. }
  6792. on.fn = fn;
  6793. vm.$on(event, on);
  6794. return vm
  6795. };
  6796. Vue.prototype.$off = function (event, fn) {
  6797. var vm = this;
  6798. // all
  6799. if (!arguments.length) {
  6800. vm._events = Object.create(null);
  6801. return vm
  6802. }
  6803. // array of events
  6804. if (Array.isArray(event)) {
  6805. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  6806. vm.$off(event[i$1], fn);
  6807. }
  6808. return vm
  6809. }
  6810. // specific event
  6811. var cbs = vm._events[event];
  6812. if (!cbs) {
  6813. return vm
  6814. }
  6815. if (!fn) {
  6816. vm._events[event] = null;
  6817. return vm
  6818. }
  6819. // specific handler
  6820. var cb;
  6821. var i = cbs.length;
  6822. while (i--) {
  6823. cb = cbs[i];
  6824. if (cb === fn || cb.fn === fn) {
  6825. cbs.splice(i, 1);
  6826. break
  6827. }
  6828. }
  6829. return vm
  6830. };
  6831. Vue.prototype.$emit = function (event) {
  6832. var vm = this;
  6833. if (true) {
  6834. var lowerCaseEvent = event.toLowerCase();
  6835. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  6836. tip(
  6837. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  6838. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  6839. "Note that HTML attributes are case-insensitive and you cannot use " +
  6840. "v-on to listen to camelCase events when using in-DOM templates. " +
  6841. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  6842. );
  6843. }
  6844. }
  6845. var cbs = vm._events[event];
  6846. if (cbs) {
  6847. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  6848. var args = toArray(arguments, 1);
  6849. var info = "event handler for \"" + event + "\"";
  6850. for (var i = 0, l = cbs.length; i < l; i++) {
  6851. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  6852. }
  6853. }
  6854. return vm
  6855. };
  6856. }
  6857. /* */
  6858. var activeInstance = null;
  6859. var isUpdatingChildComponent = false;
  6860. function setActiveInstance(vm) {
  6861. var prevActiveInstance = activeInstance;
  6862. activeInstance = vm;
  6863. return function () {
  6864. activeInstance = prevActiveInstance;
  6865. }
  6866. }
  6867. function initLifecycle (vm) {
  6868. var options = vm.$options;
  6869. // locate first non-abstract parent
  6870. var parent = options.parent;
  6871. if (parent && !options.abstract) {
  6872. while (parent.$options.abstract && parent.$parent) {
  6873. parent = parent.$parent;
  6874. }
  6875. parent.$children.push(vm);
  6876. }
  6877. vm.$parent = parent;
  6878. vm.$root = parent ? parent.$root : vm;
  6879. vm.$children = [];
  6880. vm.$refs = {};
  6881. vm._watcher = null;
  6882. vm._inactive = null;
  6883. vm._directInactive = false;
  6884. vm._isMounted = false;
  6885. vm._isDestroyed = false;
  6886. vm._isBeingDestroyed = false;
  6887. }
  6888. function lifecycleMixin (Vue) {
  6889. Vue.prototype._update = function (vnode, hydrating) {
  6890. var vm = this;
  6891. var prevEl = vm.$el;
  6892. var prevVnode = vm._vnode;
  6893. var restoreActiveInstance = setActiveInstance(vm);
  6894. vm._vnode = vnode;
  6895. // Vue.prototype.__patch__ is injected in entry points
  6896. // based on the rendering backend used.
  6897. if (!prevVnode) {
  6898. // initial render
  6899. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  6900. } else {
  6901. // updates
  6902. vm.$el = vm.__patch__(prevVnode, vnode);
  6903. }
  6904. restoreActiveInstance();
  6905. // update __vue__ reference
  6906. if (prevEl) {
  6907. prevEl.__vue__ = null;
  6908. }
  6909. if (vm.$el) {
  6910. vm.$el.__vue__ = vm;
  6911. }
  6912. // if parent is an HOC, update its $el as well
  6913. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  6914. vm.$parent.$el = vm.$el;
  6915. }
  6916. // updated hook is called by the scheduler to ensure that children are
  6917. // updated in a parent's updated hook.
  6918. };
  6919. Vue.prototype.$forceUpdate = function () {
  6920. var vm = this;
  6921. if (vm._watcher) {
  6922. vm._watcher.update();
  6923. }
  6924. };
  6925. Vue.prototype.$destroy = function () {
  6926. var vm = this;
  6927. if (vm._isBeingDestroyed) {
  6928. return
  6929. }
  6930. callHook(vm, 'beforeDestroy');
  6931. vm._isBeingDestroyed = true;
  6932. // remove self from parent
  6933. var parent = vm.$parent;
  6934. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  6935. remove(parent.$children, vm);
  6936. }
  6937. // teardown watchers
  6938. if (vm._watcher) {
  6939. vm._watcher.teardown();
  6940. }
  6941. var i = vm._watchers.length;
  6942. while (i--) {
  6943. vm._watchers[i].teardown();
  6944. }
  6945. // remove reference from data ob
  6946. // frozen object may not have observer.
  6947. if (vm._data.__ob__) {
  6948. vm._data.__ob__.vmCount--;
  6949. }
  6950. // call the last hook...
  6951. vm._isDestroyed = true;
  6952. // invoke destroy hooks on current rendered tree
  6953. vm.__patch__(vm._vnode, null);
  6954. // fire destroyed hook
  6955. callHook(vm, 'destroyed');
  6956. // turn off all instance listeners.
  6957. vm.$off();
  6958. // remove __vue__ reference
  6959. if (vm.$el) {
  6960. vm.$el.__vue__ = null;
  6961. }
  6962. // release circular reference (#6759)
  6963. if (vm.$vnode) {
  6964. vm.$vnode.parent = null;
  6965. }
  6966. };
  6967. }
  6968. function updateChildComponent (
  6969. vm,
  6970. propsData,
  6971. listeners,
  6972. parentVnode,
  6973. renderChildren
  6974. ) {
  6975. if (true) {
  6976. isUpdatingChildComponent = true;
  6977. }
  6978. // determine whether component has slot children
  6979. // we need to do this before overwriting $options._renderChildren.
  6980. // check if there are dynamic scopedSlots (hand-written or compiled but with
  6981. // dynamic slot names). Static scoped slots compiled from template has the
  6982. // "$stable" marker.
  6983. var newScopedSlots = parentVnode.data.scopedSlots;
  6984. var oldScopedSlots = vm.$scopedSlots;
  6985. var hasDynamicScopedSlot = !!(
  6986. (newScopedSlots && !newScopedSlots.$stable) ||
  6987. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  6988. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  6989. );
  6990. // Any static slot children from the parent may have changed during parent's
  6991. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  6992. // update is necessary to ensure correctness.
  6993. var needsForceUpdate = !!(
  6994. renderChildren || // has new static slots
  6995. vm.$options._renderChildren || // has old static slots
  6996. hasDynamicScopedSlot
  6997. );
  6998. vm.$options._parentVnode = parentVnode;
  6999. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  7000. if (vm._vnode) { // update child tree's parent
  7001. vm._vnode.parent = parentVnode;
  7002. }
  7003. vm.$options._renderChildren = renderChildren;
  7004. // update $attrs and $listeners hash
  7005. // these are also reactive so they may trigger child update if the child
  7006. // used them during render
  7007. vm.$attrs = parentVnode.data.attrs || emptyObject;
  7008. vm.$listeners = listeners || emptyObject;
  7009. // update props
  7010. if (propsData && vm.$options.props) {
  7011. toggleObserving(false);
  7012. var props = vm._props;
  7013. var propKeys = vm.$options._propKeys || [];
  7014. for (var i = 0; i < propKeys.length; i++) {
  7015. var key = propKeys[i];
  7016. var propOptions = vm.$options.props; // wtf flow?
  7017. props[key] = validateProp(key, propOptions, propsData, vm);
  7018. }
  7019. toggleObserving(true);
  7020. // keep a copy of raw propsData
  7021. vm.$options.propsData = propsData;
  7022. }
  7023. // fixed by xxxxxx update properties(mp runtime)
  7024. vm._$updateProperties && vm._$updateProperties(vm);
  7025. // update listeners
  7026. listeners = listeners || emptyObject;
  7027. var oldListeners = vm.$options._parentListeners;
  7028. vm.$options._parentListeners = listeners;
  7029. updateComponentListeners(vm, listeners, oldListeners);
  7030. // resolve slots + force update if has children
  7031. if (needsForceUpdate) {
  7032. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  7033. vm.$forceUpdate();
  7034. }
  7035. if (true) {
  7036. isUpdatingChildComponent = false;
  7037. }
  7038. }
  7039. function isInInactiveTree (vm) {
  7040. while (vm && (vm = vm.$parent)) {
  7041. if (vm._inactive) { return true }
  7042. }
  7043. return false
  7044. }
  7045. function activateChildComponent (vm, direct) {
  7046. if (direct) {
  7047. vm._directInactive = false;
  7048. if (isInInactiveTree(vm)) {
  7049. return
  7050. }
  7051. } else if (vm._directInactive) {
  7052. return
  7053. }
  7054. if (vm._inactive || vm._inactive === null) {
  7055. vm._inactive = false;
  7056. for (var i = 0; i < vm.$children.length; i++) {
  7057. activateChildComponent(vm.$children[i]);
  7058. }
  7059. callHook(vm, 'activated');
  7060. }
  7061. }
  7062. function deactivateChildComponent (vm, direct) {
  7063. if (direct) {
  7064. vm._directInactive = true;
  7065. if (isInInactiveTree(vm)) {
  7066. return
  7067. }
  7068. }
  7069. if (!vm._inactive) {
  7070. vm._inactive = true;
  7071. for (var i = 0; i < vm.$children.length; i++) {
  7072. deactivateChildComponent(vm.$children[i]);
  7073. }
  7074. callHook(vm, 'deactivated');
  7075. }
  7076. }
  7077. function callHook (vm, hook) {
  7078. // #7573 disable dep collection when invoking lifecycle hooks
  7079. pushTarget();
  7080. var handlers = vm.$options[hook];
  7081. var info = hook + " hook";
  7082. if (handlers) {
  7083. for (var i = 0, j = handlers.length; i < j; i++) {
  7084. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  7085. }
  7086. }
  7087. if (vm._hasHookEvent) {
  7088. vm.$emit('hook:' + hook);
  7089. }
  7090. popTarget();
  7091. }
  7092. /* */
  7093. var MAX_UPDATE_COUNT = 100;
  7094. var queue = [];
  7095. var activatedChildren = [];
  7096. var has = {};
  7097. var circular = {};
  7098. var waiting = false;
  7099. var flushing = false;
  7100. var index = 0;
  7101. /**
  7102. * Reset the scheduler's state.
  7103. */
  7104. function resetSchedulerState () {
  7105. index = queue.length = activatedChildren.length = 0;
  7106. has = {};
  7107. if (true) {
  7108. circular = {};
  7109. }
  7110. waiting = flushing = false;
  7111. }
  7112. // Async edge case #6566 requires saving the timestamp when event listeners are
  7113. // attached. However, calling performance.now() has a perf overhead especially
  7114. // if the page has thousands of event listeners. Instead, we take a timestamp
  7115. // every time the scheduler flushes and use that for all event listeners
  7116. // attached during that flush.
  7117. var currentFlushTimestamp = 0;
  7118. // Async edge case fix requires storing an event listener's attach timestamp.
  7119. var getNow = Date.now;
  7120. // Determine what event timestamp the browser is using. Annoyingly, the
  7121. // timestamp can either be hi-res (relative to page load) or low-res
  7122. // (relative to UNIX epoch), so in order to compare time we have to use the
  7123. // same timestamp type when saving the flush timestamp.
  7124. // All IE versions use low-res event timestamps, and have problematic clock
  7125. // implementations (#9632)
  7126. if (inBrowser && !isIE) {
  7127. var performance = window.performance;
  7128. if (
  7129. performance &&
  7130. typeof performance.now === 'function' &&
  7131. getNow() > document.createEvent('Event').timeStamp
  7132. ) {
  7133. // if the event timestamp, although evaluated AFTER the Date.now(), is
  7134. // smaller than it, it means the event is using a hi-res timestamp,
  7135. // and we need to use the hi-res version for event listener timestamps as
  7136. // well.
  7137. getNow = function () { return performance.now(); };
  7138. }
  7139. }
  7140. /**
  7141. * Flush both queues and run the watchers.
  7142. */
  7143. function flushSchedulerQueue () {
  7144. currentFlushTimestamp = getNow();
  7145. flushing = true;
  7146. var watcher, id;
  7147. // Sort queue before flush.
  7148. // This ensures that:
  7149. // 1. Components are updated from parent to child. (because parent is always
  7150. // created before the child)
  7151. // 2. A component's user watchers are run before its render watcher (because
  7152. // user watchers are created before the render watcher)
  7153. // 3. If a component is destroyed during a parent component's watcher run,
  7154. // its watchers can be skipped.
  7155. queue.sort(function (a, b) { return a.id - b.id; });
  7156. // do not cache length because more watchers might be pushed
  7157. // as we run existing watchers
  7158. for (index = 0; index < queue.length; index++) {
  7159. watcher = queue[index];
  7160. if (watcher.before) {
  7161. watcher.before();
  7162. }
  7163. id = watcher.id;
  7164. has[id] = null;
  7165. watcher.run();
  7166. // in dev build, check and stop circular updates.
  7167. if ( true && has[id] != null) {
  7168. circular[id] = (circular[id] || 0) + 1;
  7169. if (circular[id] > MAX_UPDATE_COUNT) {
  7170. warn(
  7171. 'You may have an infinite update loop ' + (
  7172. watcher.user
  7173. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  7174. : "in a component render function."
  7175. ),
  7176. watcher.vm
  7177. );
  7178. break
  7179. }
  7180. }
  7181. }
  7182. // keep copies of post queues before resetting state
  7183. var activatedQueue = activatedChildren.slice();
  7184. var updatedQueue = queue.slice();
  7185. resetSchedulerState();
  7186. // call component updated and activated hooks
  7187. callActivatedHooks(activatedQueue);
  7188. callUpdatedHooks(updatedQueue);
  7189. // devtool hook
  7190. /* istanbul ignore if */
  7191. if (devtools && config.devtools) {
  7192. devtools.emit('flush');
  7193. }
  7194. }
  7195. function callUpdatedHooks (queue) {
  7196. var i = queue.length;
  7197. while (i--) {
  7198. var watcher = queue[i];
  7199. var vm = watcher.vm;
  7200. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  7201. callHook(vm, 'updated');
  7202. }
  7203. }
  7204. }
  7205. /**
  7206. * Queue a kept-alive component that was activated during patch.
  7207. * The queue will be processed after the entire tree has been patched.
  7208. */
  7209. function queueActivatedComponent (vm) {
  7210. // setting _inactive to false here so that a render function can
  7211. // rely on checking whether it's in an inactive tree (e.g. router-view)
  7212. vm._inactive = false;
  7213. activatedChildren.push(vm);
  7214. }
  7215. function callActivatedHooks (queue) {
  7216. for (var i = 0; i < queue.length; i++) {
  7217. queue[i]._inactive = true;
  7218. activateChildComponent(queue[i], true /* true */);
  7219. }
  7220. }
  7221. /**
  7222. * Push a watcher into the watcher queue.
  7223. * Jobs with duplicate IDs will be skipped unless it's
  7224. * pushed when the queue is being flushed.
  7225. */
  7226. function queueWatcher (watcher) {
  7227. var id = watcher.id;
  7228. if (has[id] == null) {
  7229. has[id] = true;
  7230. if (!flushing) {
  7231. queue.push(watcher);
  7232. } else {
  7233. // if already flushing, splice the watcher based on its id
  7234. // if already past its id, it will be run next immediately.
  7235. var i = queue.length - 1;
  7236. while (i > index && queue[i].id > watcher.id) {
  7237. i--;
  7238. }
  7239. queue.splice(i + 1, 0, watcher);
  7240. }
  7241. // queue the flush
  7242. if (!waiting) {
  7243. waiting = true;
  7244. if ( true && !config.async) {
  7245. flushSchedulerQueue();
  7246. return
  7247. }
  7248. nextTick(flushSchedulerQueue);
  7249. }
  7250. }
  7251. }
  7252. /* */
  7253. var uid$2 = 0;
  7254. /**
  7255. * A watcher parses an expression, collects dependencies,
  7256. * and fires callback when the expression value changes.
  7257. * This is used for both the $watch() api and directives.
  7258. */
  7259. var Watcher = function Watcher (
  7260. vm,
  7261. expOrFn,
  7262. cb,
  7263. options,
  7264. isRenderWatcher
  7265. ) {
  7266. this.vm = vm;
  7267. if (isRenderWatcher) {
  7268. vm._watcher = this;
  7269. }
  7270. vm._watchers.push(this);
  7271. // options
  7272. if (options) {
  7273. this.deep = !!options.deep;
  7274. this.user = !!options.user;
  7275. this.lazy = !!options.lazy;
  7276. this.sync = !!options.sync;
  7277. this.before = options.before;
  7278. } else {
  7279. this.deep = this.user = this.lazy = this.sync = false;
  7280. }
  7281. this.cb = cb;
  7282. this.id = ++uid$2; // uid for batching
  7283. this.active = true;
  7284. this.dirty = this.lazy; // for lazy watchers
  7285. this.deps = [];
  7286. this.newDeps = [];
  7287. this.depIds = new _Set();
  7288. this.newDepIds = new _Set();
  7289. this.expression = true
  7290. ? expOrFn.toString()
  7291. : undefined;
  7292. // parse expression for getter
  7293. if (typeof expOrFn === 'function') {
  7294. this.getter = expOrFn;
  7295. } else {
  7296. this.getter = parsePath(expOrFn);
  7297. if (!this.getter) {
  7298. this.getter = noop;
  7299. true && warn(
  7300. "Failed watching path: \"" + expOrFn + "\" " +
  7301. 'Watcher only accepts simple dot-delimited paths. ' +
  7302. 'For full control, use a function instead.',
  7303. vm
  7304. );
  7305. }
  7306. }
  7307. this.value = this.lazy
  7308. ? undefined
  7309. : this.get();
  7310. };
  7311. /**
  7312. * Evaluate the getter, and re-collect dependencies.
  7313. */
  7314. Watcher.prototype.get = function get () {
  7315. pushTarget(this);
  7316. var value;
  7317. var vm = this.vm;
  7318. try {
  7319. value = this.getter.call(vm, vm);
  7320. } catch (e) {
  7321. if (this.user) {
  7322. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  7323. } else {
  7324. throw e
  7325. }
  7326. } finally {
  7327. // "touch" every property so they are all tracked as
  7328. // dependencies for deep watching
  7329. if (this.deep) {
  7330. traverse(value);
  7331. }
  7332. popTarget();
  7333. this.cleanupDeps();
  7334. }
  7335. return value
  7336. };
  7337. /**
  7338. * Add a dependency to this directive.
  7339. */
  7340. Watcher.prototype.addDep = function addDep (dep) {
  7341. var id = dep.id;
  7342. if (!this.newDepIds.has(id)) {
  7343. this.newDepIds.add(id);
  7344. this.newDeps.push(dep);
  7345. if (!this.depIds.has(id)) {
  7346. dep.addSub(this);
  7347. }
  7348. }
  7349. };
  7350. /**
  7351. * Clean up for dependency collection.
  7352. */
  7353. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  7354. var i = this.deps.length;
  7355. while (i--) {
  7356. var dep = this.deps[i];
  7357. if (!this.newDepIds.has(dep.id)) {
  7358. dep.removeSub(this);
  7359. }
  7360. }
  7361. var tmp = this.depIds;
  7362. this.depIds = this.newDepIds;
  7363. this.newDepIds = tmp;
  7364. this.newDepIds.clear();
  7365. tmp = this.deps;
  7366. this.deps = this.newDeps;
  7367. this.newDeps = tmp;
  7368. this.newDeps.length = 0;
  7369. };
  7370. /**
  7371. * Subscriber interface.
  7372. * Will be called when a dependency changes.
  7373. */
  7374. Watcher.prototype.update = function update () {
  7375. /* istanbul ignore else */
  7376. if (this.lazy) {
  7377. this.dirty = true;
  7378. } else if (this.sync) {
  7379. this.run();
  7380. } else {
  7381. queueWatcher(this);
  7382. }
  7383. };
  7384. /**
  7385. * Scheduler job interface.
  7386. * Will be called by the scheduler.
  7387. */
  7388. Watcher.prototype.run = function run () {
  7389. if (this.active) {
  7390. var value = this.get();
  7391. if (
  7392. value !== this.value ||
  7393. // Deep watchers and watchers on Object/Arrays should fire even
  7394. // when the value is the same, because the value may
  7395. // have mutated.
  7396. isObject(value) ||
  7397. this.deep
  7398. ) {
  7399. // set new value
  7400. var oldValue = this.value;
  7401. this.value = value;
  7402. if (this.user) {
  7403. try {
  7404. this.cb.call(this.vm, value, oldValue);
  7405. } catch (e) {
  7406. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  7407. }
  7408. } else {
  7409. this.cb.call(this.vm, value, oldValue);
  7410. }
  7411. }
  7412. }
  7413. };
  7414. /**
  7415. * Evaluate the value of the watcher.
  7416. * This only gets called for lazy watchers.
  7417. */
  7418. Watcher.prototype.evaluate = function evaluate () {
  7419. this.value = this.get();
  7420. this.dirty = false;
  7421. };
  7422. /**
  7423. * Depend on all deps collected by this watcher.
  7424. */
  7425. Watcher.prototype.depend = function depend () {
  7426. var i = this.deps.length;
  7427. while (i--) {
  7428. this.deps[i].depend();
  7429. }
  7430. };
  7431. /**
  7432. * Remove self from all dependencies' subscriber list.
  7433. */
  7434. Watcher.prototype.teardown = function teardown () {
  7435. if (this.active) {
  7436. // remove self from vm's watcher list
  7437. // this is a somewhat expensive operation so we skip it
  7438. // if the vm is being destroyed.
  7439. if (!this.vm._isBeingDestroyed) {
  7440. remove(this.vm._watchers, this);
  7441. }
  7442. var i = this.deps.length;
  7443. while (i--) {
  7444. this.deps[i].removeSub(this);
  7445. }
  7446. this.active = false;
  7447. }
  7448. };
  7449. /* */
  7450. var sharedPropertyDefinition = {
  7451. enumerable: true,
  7452. configurable: true,
  7453. get: noop,
  7454. set: noop
  7455. };
  7456. function proxy (target, sourceKey, key) {
  7457. sharedPropertyDefinition.get = function proxyGetter () {
  7458. return this[sourceKey][key]
  7459. };
  7460. sharedPropertyDefinition.set = function proxySetter (val) {
  7461. this[sourceKey][key] = val;
  7462. };
  7463. Object.defineProperty(target, key, sharedPropertyDefinition);
  7464. }
  7465. function initState (vm) {
  7466. vm._watchers = [];
  7467. var opts = vm.$options;
  7468. if (opts.props) { initProps(vm, opts.props); }
  7469. if (opts.methods) { initMethods(vm, opts.methods); }
  7470. if (opts.data) {
  7471. initData(vm);
  7472. } else {
  7473. observe(vm._data = {}, true /* asRootData */);
  7474. }
  7475. if (opts.computed) { initComputed(vm, opts.computed); }
  7476. if (opts.watch && opts.watch !== nativeWatch) {
  7477. initWatch(vm, opts.watch);
  7478. }
  7479. }
  7480. function initProps (vm, propsOptions) {
  7481. var propsData = vm.$options.propsData || {};
  7482. var props = vm._props = {};
  7483. // cache prop keys so that future props updates can iterate using Array
  7484. // instead of dynamic object key enumeration.
  7485. var keys = vm.$options._propKeys = [];
  7486. var isRoot = !vm.$parent;
  7487. // root instance props should be converted
  7488. if (!isRoot) {
  7489. toggleObserving(false);
  7490. }
  7491. var loop = function ( key ) {
  7492. keys.push(key);
  7493. var value = validateProp(key, propsOptions, propsData, vm);
  7494. /* istanbul ignore else */
  7495. if (true) {
  7496. var hyphenatedKey = hyphenate(key);
  7497. if (isReservedAttribute(hyphenatedKey) ||
  7498. config.isReservedAttr(hyphenatedKey)) {
  7499. warn(
  7500. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  7501. vm
  7502. );
  7503. }
  7504. defineReactive$$1(props, key, value, function () {
  7505. if (!isRoot && !isUpdatingChildComponent) {
  7506. {
  7507. if(vm.mpHost === 'mp-baidu' || vm.mpHost === 'mp-kuaishou' || vm.mpHost === 'mp-xhs'){//百度、快手、小红书 observer 在 setData callback 之后触发,直接忽略该 warn
  7508. return
  7509. }
  7510. //fixed by xxxxxx __next_tick_pending,uni://form-field 时不告警
  7511. if(
  7512. key === 'value' &&
  7513. Array.isArray(vm.$options.behaviors) &&
  7514. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  7515. ){
  7516. return
  7517. }
  7518. if(vm._getFormData){
  7519. return
  7520. }
  7521. var $parent = vm.$parent;
  7522. while($parent){
  7523. if($parent.__next_tick_pending){
  7524. return
  7525. }
  7526. $parent = $parent.$parent;
  7527. }
  7528. }
  7529. warn(
  7530. "Avoid mutating a prop directly since the value will be " +
  7531. "overwritten whenever the parent component re-renders. " +
  7532. "Instead, use a data or computed property based on the prop's " +
  7533. "value. Prop being mutated: \"" + key + "\"",
  7534. vm
  7535. );
  7536. }
  7537. });
  7538. } else {}
  7539. // static props are already proxied on the component's prototype
  7540. // during Vue.extend(). We only need to proxy props defined at
  7541. // instantiation here.
  7542. if (!(key in vm)) {
  7543. proxy(vm, "_props", key);
  7544. }
  7545. };
  7546. for (var key in propsOptions) loop( key );
  7547. toggleObserving(true);
  7548. }
  7549. function initData (vm) {
  7550. var data = vm.$options.data;
  7551. data = vm._data = typeof data === 'function'
  7552. ? getData(data, vm)
  7553. : data || {};
  7554. if (!isPlainObject(data)) {
  7555. data = {};
  7556. true && warn(
  7557. 'data functions should return an object:\n' +
  7558. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  7559. vm
  7560. );
  7561. }
  7562. // proxy data on instance
  7563. var keys = Object.keys(data);
  7564. var props = vm.$options.props;
  7565. var methods = vm.$options.methods;
  7566. var i = keys.length;
  7567. while (i--) {
  7568. var key = keys[i];
  7569. if (true) {
  7570. if (methods && hasOwn(methods, key)) {
  7571. warn(
  7572. ("Method \"" + key + "\" has already been defined as a data property."),
  7573. vm
  7574. );
  7575. }
  7576. }
  7577. if (props && hasOwn(props, key)) {
  7578. true && warn(
  7579. "The data property \"" + key + "\" is already declared as a prop. " +
  7580. "Use prop default value instead.",
  7581. vm
  7582. );
  7583. } else if (!isReserved(key)) {
  7584. proxy(vm, "_data", key);
  7585. }
  7586. }
  7587. // observe data
  7588. observe(data, true /* asRootData */);
  7589. }
  7590. function getData (data, vm) {
  7591. // #7573 disable dep collection when invoking data getters
  7592. pushTarget();
  7593. try {
  7594. return data.call(vm, vm)
  7595. } catch (e) {
  7596. handleError(e, vm, "data()");
  7597. return {}
  7598. } finally {
  7599. popTarget();
  7600. }
  7601. }
  7602. var computedWatcherOptions = { lazy: true };
  7603. function initComputed (vm, computed) {
  7604. // $flow-disable-line
  7605. var watchers = vm._computedWatchers = Object.create(null);
  7606. // computed properties are just getters during SSR
  7607. var isSSR = isServerRendering();
  7608. for (var key in computed) {
  7609. var userDef = computed[key];
  7610. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  7611. if ( true && getter == null) {
  7612. warn(
  7613. ("Getter is missing for computed property \"" + key + "\"."),
  7614. vm
  7615. );
  7616. }
  7617. if (!isSSR) {
  7618. // create internal watcher for the computed property.
  7619. watchers[key] = new Watcher(
  7620. vm,
  7621. getter || noop,
  7622. noop,
  7623. computedWatcherOptions
  7624. );
  7625. }
  7626. // component-defined computed properties are already defined on the
  7627. // component prototype. We only need to define computed properties defined
  7628. // at instantiation here.
  7629. if (!(key in vm)) {
  7630. defineComputed(vm, key, userDef);
  7631. } else if (true) {
  7632. if (key in vm.$data) {
  7633. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  7634. } else if (vm.$options.props && key in vm.$options.props) {
  7635. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  7636. }
  7637. }
  7638. }
  7639. }
  7640. function defineComputed (
  7641. target,
  7642. key,
  7643. userDef
  7644. ) {
  7645. var shouldCache = !isServerRendering();
  7646. if (typeof userDef === 'function') {
  7647. sharedPropertyDefinition.get = shouldCache
  7648. ? createComputedGetter(key)
  7649. : createGetterInvoker(userDef);
  7650. sharedPropertyDefinition.set = noop;
  7651. } else {
  7652. sharedPropertyDefinition.get = userDef.get
  7653. ? shouldCache && userDef.cache !== false
  7654. ? createComputedGetter(key)
  7655. : createGetterInvoker(userDef.get)
  7656. : noop;
  7657. sharedPropertyDefinition.set = userDef.set || noop;
  7658. }
  7659. if ( true &&
  7660. sharedPropertyDefinition.set === noop) {
  7661. sharedPropertyDefinition.set = function () {
  7662. warn(
  7663. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  7664. this
  7665. );
  7666. };
  7667. }
  7668. Object.defineProperty(target, key, sharedPropertyDefinition);
  7669. }
  7670. function createComputedGetter (key) {
  7671. return function computedGetter () {
  7672. var watcher = this._computedWatchers && this._computedWatchers[key];
  7673. if (watcher) {
  7674. if (watcher.dirty) {
  7675. watcher.evaluate();
  7676. }
  7677. if (Dep.SharedObject.target) {// fixed by xxxxxx
  7678. watcher.depend();
  7679. }
  7680. return watcher.value
  7681. }
  7682. }
  7683. }
  7684. function createGetterInvoker(fn) {
  7685. return function computedGetter () {
  7686. return fn.call(this, this)
  7687. }
  7688. }
  7689. function initMethods (vm, methods) {
  7690. var props = vm.$options.props;
  7691. for (var key in methods) {
  7692. if (true) {
  7693. if (typeof methods[key] !== 'function') {
  7694. warn(
  7695. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  7696. "Did you reference the function correctly?",
  7697. vm
  7698. );
  7699. }
  7700. if (props && hasOwn(props, key)) {
  7701. warn(
  7702. ("Method \"" + key + "\" has already been defined as a prop."),
  7703. vm
  7704. );
  7705. }
  7706. if ((key in vm) && isReserved(key)) {
  7707. warn(
  7708. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  7709. "Avoid defining component methods that start with _ or $."
  7710. );
  7711. }
  7712. }
  7713. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  7714. }
  7715. }
  7716. function initWatch (vm, watch) {
  7717. for (var key in watch) {
  7718. var handler = watch[key];
  7719. if (Array.isArray(handler)) {
  7720. for (var i = 0; i < handler.length; i++) {
  7721. createWatcher(vm, key, handler[i]);
  7722. }
  7723. } else {
  7724. createWatcher(vm, key, handler);
  7725. }
  7726. }
  7727. }
  7728. function createWatcher (
  7729. vm,
  7730. expOrFn,
  7731. handler,
  7732. options
  7733. ) {
  7734. if (isPlainObject(handler)) {
  7735. options = handler;
  7736. handler = handler.handler;
  7737. }
  7738. if (typeof handler === 'string') {
  7739. handler = vm[handler];
  7740. }
  7741. return vm.$watch(expOrFn, handler, options)
  7742. }
  7743. function stateMixin (Vue) {
  7744. // flow somehow has problems with directly declared definition object
  7745. // when using Object.defineProperty, so we have to procedurally build up
  7746. // the object here.
  7747. var dataDef = {};
  7748. dataDef.get = function () { return this._data };
  7749. var propsDef = {};
  7750. propsDef.get = function () { return this._props };
  7751. if (true) {
  7752. dataDef.set = function () {
  7753. warn(
  7754. 'Avoid replacing instance root $data. ' +
  7755. 'Use nested data properties instead.',
  7756. this
  7757. );
  7758. };
  7759. propsDef.set = function () {
  7760. warn("$props is readonly.", this);
  7761. };
  7762. }
  7763. Object.defineProperty(Vue.prototype, '$data', dataDef);
  7764. Object.defineProperty(Vue.prototype, '$props', propsDef);
  7765. Vue.prototype.$set = set;
  7766. Vue.prototype.$delete = del;
  7767. Vue.prototype.$watch = function (
  7768. expOrFn,
  7769. cb,
  7770. options
  7771. ) {
  7772. var vm = this;
  7773. if (isPlainObject(cb)) {
  7774. return createWatcher(vm, expOrFn, cb, options)
  7775. }
  7776. options = options || {};
  7777. options.user = true;
  7778. var watcher = new Watcher(vm, expOrFn, cb, options);
  7779. if (options.immediate) {
  7780. try {
  7781. cb.call(vm, watcher.value);
  7782. } catch (error) {
  7783. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  7784. }
  7785. }
  7786. return function unwatchFn () {
  7787. watcher.teardown();
  7788. }
  7789. };
  7790. }
  7791. /* */
  7792. var uid$3 = 0;
  7793. function initMixin (Vue) {
  7794. Vue.prototype._init = function (options) {
  7795. var vm = this;
  7796. // a uid
  7797. vm._uid = uid$3++;
  7798. var startTag, endTag;
  7799. /* istanbul ignore if */
  7800. if ( true && config.performance && mark) {
  7801. startTag = "vue-perf-start:" + (vm._uid);
  7802. endTag = "vue-perf-end:" + (vm._uid);
  7803. mark(startTag);
  7804. }
  7805. // a flag to avoid this being observed
  7806. vm._isVue = true;
  7807. // merge options
  7808. if (options && options._isComponent) {
  7809. // optimize internal component instantiation
  7810. // since dynamic options merging is pretty slow, and none of the
  7811. // internal component options needs special treatment.
  7812. initInternalComponent(vm, options);
  7813. } else {
  7814. vm.$options = mergeOptions(
  7815. resolveConstructorOptions(vm.constructor),
  7816. options || {},
  7817. vm
  7818. );
  7819. }
  7820. /* istanbul ignore else */
  7821. if (true) {
  7822. initProxy(vm);
  7823. } else {}
  7824. // expose real self
  7825. vm._self = vm;
  7826. initLifecycle(vm);
  7827. initEvents(vm);
  7828. initRender(vm);
  7829. callHook(vm, 'beforeCreate');
  7830. !vm._$fallback && initInjections(vm); // resolve injections before data/props
  7831. initState(vm);
  7832. !vm._$fallback && initProvide(vm); // resolve provide after data/props
  7833. !vm._$fallback && callHook(vm, 'created');
  7834. /* istanbul ignore if */
  7835. if ( true && config.performance && mark) {
  7836. vm._name = formatComponentName(vm, false);
  7837. mark(endTag);
  7838. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  7839. }
  7840. if (vm.$options.el) {
  7841. vm.$mount(vm.$options.el);
  7842. }
  7843. };
  7844. }
  7845. function initInternalComponent (vm, options) {
  7846. var opts = vm.$options = Object.create(vm.constructor.options);
  7847. // doing this because it's faster than dynamic enumeration.
  7848. var parentVnode = options._parentVnode;
  7849. opts.parent = options.parent;
  7850. opts._parentVnode = parentVnode;
  7851. var vnodeComponentOptions = parentVnode.componentOptions;
  7852. opts.propsData = vnodeComponentOptions.propsData;
  7853. opts._parentListeners = vnodeComponentOptions.listeners;
  7854. opts._renderChildren = vnodeComponentOptions.children;
  7855. opts._componentTag = vnodeComponentOptions.tag;
  7856. if (options.render) {
  7857. opts.render = options.render;
  7858. opts.staticRenderFns = options.staticRenderFns;
  7859. }
  7860. }
  7861. function resolveConstructorOptions (Ctor) {
  7862. var options = Ctor.options;
  7863. if (Ctor.super) {
  7864. var superOptions = resolveConstructorOptions(Ctor.super);
  7865. var cachedSuperOptions = Ctor.superOptions;
  7866. if (superOptions !== cachedSuperOptions) {
  7867. // super option changed,
  7868. // need to resolve new options.
  7869. Ctor.superOptions = superOptions;
  7870. // check if there are any late-modified/attached options (#4976)
  7871. var modifiedOptions = resolveModifiedOptions(Ctor);
  7872. // update base extend options
  7873. if (modifiedOptions) {
  7874. extend(Ctor.extendOptions, modifiedOptions);
  7875. }
  7876. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  7877. if (options.name) {
  7878. options.components[options.name] = Ctor;
  7879. }
  7880. }
  7881. }
  7882. return options
  7883. }
  7884. function resolveModifiedOptions (Ctor) {
  7885. var modified;
  7886. var latest = Ctor.options;
  7887. var sealed = Ctor.sealedOptions;
  7888. for (var key in latest) {
  7889. if (latest[key] !== sealed[key]) {
  7890. if (!modified) { modified = {}; }
  7891. modified[key] = latest[key];
  7892. }
  7893. }
  7894. return modified
  7895. }
  7896. function Vue (options) {
  7897. if ( true &&
  7898. !(this instanceof Vue)
  7899. ) {
  7900. warn('Vue is a constructor and should be called with the `new` keyword');
  7901. }
  7902. this._init(options);
  7903. }
  7904. initMixin(Vue);
  7905. stateMixin(Vue);
  7906. eventsMixin(Vue);
  7907. lifecycleMixin(Vue);
  7908. renderMixin(Vue);
  7909. /* */
  7910. function initUse (Vue) {
  7911. Vue.use = function (plugin) {
  7912. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  7913. if (installedPlugins.indexOf(plugin) > -1) {
  7914. return this
  7915. }
  7916. // additional parameters
  7917. var args = toArray(arguments, 1);
  7918. args.unshift(this);
  7919. if (typeof plugin.install === 'function') {
  7920. plugin.install.apply(plugin, args);
  7921. } else if (typeof plugin === 'function') {
  7922. plugin.apply(null, args);
  7923. }
  7924. installedPlugins.push(plugin);
  7925. return this
  7926. };
  7927. }
  7928. /* */
  7929. function initMixin$1 (Vue) {
  7930. Vue.mixin = function (mixin) {
  7931. this.options = mergeOptions(this.options, mixin);
  7932. return this
  7933. };
  7934. }
  7935. /* */
  7936. function initExtend (Vue) {
  7937. /**
  7938. * Each instance constructor, including Vue, has a unique
  7939. * cid. This enables us to create wrapped "child
  7940. * constructors" for prototypal inheritance and cache them.
  7941. */
  7942. Vue.cid = 0;
  7943. var cid = 1;
  7944. /**
  7945. * Class inheritance
  7946. */
  7947. Vue.extend = function (extendOptions) {
  7948. extendOptions = extendOptions || {};
  7949. var Super = this;
  7950. var SuperId = Super.cid;
  7951. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  7952. if (cachedCtors[SuperId]) {
  7953. return cachedCtors[SuperId]
  7954. }
  7955. var name = extendOptions.name || Super.options.name;
  7956. if ( true && name) {
  7957. validateComponentName(name);
  7958. }
  7959. var Sub = function VueComponent (options) {
  7960. this._init(options);
  7961. };
  7962. Sub.prototype = Object.create(Super.prototype);
  7963. Sub.prototype.constructor = Sub;
  7964. Sub.cid = cid++;
  7965. Sub.options = mergeOptions(
  7966. Super.options,
  7967. extendOptions
  7968. );
  7969. Sub['super'] = Super;
  7970. // For props and computed properties, we define the proxy getters on
  7971. // the Vue instances at extension time, on the extended prototype. This
  7972. // avoids Object.defineProperty calls for each instance created.
  7973. if (Sub.options.props) {
  7974. initProps$1(Sub);
  7975. }
  7976. if (Sub.options.computed) {
  7977. initComputed$1(Sub);
  7978. }
  7979. // allow further extension/mixin/plugin usage
  7980. Sub.extend = Super.extend;
  7981. Sub.mixin = Super.mixin;
  7982. Sub.use = Super.use;
  7983. // create asset registers, so extended classes
  7984. // can have their private assets too.
  7985. ASSET_TYPES.forEach(function (type) {
  7986. Sub[type] = Super[type];
  7987. });
  7988. // enable recursive self-lookup
  7989. if (name) {
  7990. Sub.options.components[name] = Sub;
  7991. }
  7992. // keep a reference to the super options at extension time.
  7993. // later at instantiation we can check if Super's options have
  7994. // been updated.
  7995. Sub.superOptions = Super.options;
  7996. Sub.extendOptions = extendOptions;
  7997. Sub.sealedOptions = extend({}, Sub.options);
  7998. // cache constructor
  7999. cachedCtors[SuperId] = Sub;
  8000. return Sub
  8001. };
  8002. }
  8003. function initProps$1 (Comp) {
  8004. var props = Comp.options.props;
  8005. for (var key in props) {
  8006. proxy(Comp.prototype, "_props", key);
  8007. }
  8008. }
  8009. function initComputed$1 (Comp) {
  8010. var computed = Comp.options.computed;
  8011. for (var key in computed) {
  8012. defineComputed(Comp.prototype, key, computed[key]);
  8013. }
  8014. }
  8015. /* */
  8016. function initAssetRegisters (Vue) {
  8017. /**
  8018. * Create asset registration methods.
  8019. */
  8020. ASSET_TYPES.forEach(function (type) {
  8021. Vue[type] = function (
  8022. id,
  8023. definition
  8024. ) {
  8025. if (!definition) {
  8026. return this.options[type + 's'][id]
  8027. } else {
  8028. /* istanbul ignore if */
  8029. if ( true && type === 'component') {
  8030. validateComponentName(id);
  8031. }
  8032. if (type === 'component' && isPlainObject(definition)) {
  8033. definition.name = definition.name || id;
  8034. definition = this.options._base.extend(definition);
  8035. }
  8036. if (type === 'directive' && typeof definition === 'function') {
  8037. definition = { bind: definition, update: definition };
  8038. }
  8039. this.options[type + 's'][id] = definition;
  8040. return definition
  8041. }
  8042. };
  8043. });
  8044. }
  8045. /* */
  8046. function getComponentName (opts) {
  8047. return opts && (opts.Ctor.options.name || opts.tag)
  8048. }
  8049. function matches (pattern, name) {
  8050. if (Array.isArray(pattern)) {
  8051. return pattern.indexOf(name) > -1
  8052. } else if (typeof pattern === 'string') {
  8053. return pattern.split(',').indexOf(name) > -1
  8054. } else if (isRegExp(pattern)) {
  8055. return pattern.test(name)
  8056. }
  8057. /* istanbul ignore next */
  8058. return false
  8059. }
  8060. function pruneCache (keepAliveInstance, filter) {
  8061. var cache = keepAliveInstance.cache;
  8062. var keys = keepAliveInstance.keys;
  8063. var _vnode = keepAliveInstance._vnode;
  8064. for (var key in cache) {
  8065. var cachedNode = cache[key];
  8066. if (cachedNode) {
  8067. var name = getComponentName(cachedNode.componentOptions);
  8068. if (name && !filter(name)) {
  8069. pruneCacheEntry(cache, key, keys, _vnode);
  8070. }
  8071. }
  8072. }
  8073. }
  8074. function pruneCacheEntry (
  8075. cache,
  8076. key,
  8077. keys,
  8078. current
  8079. ) {
  8080. var cached$$1 = cache[key];
  8081. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  8082. cached$$1.componentInstance.$destroy();
  8083. }
  8084. cache[key] = null;
  8085. remove(keys, key);
  8086. }
  8087. var patternTypes = [String, RegExp, Array];
  8088. var KeepAlive = {
  8089. name: 'keep-alive',
  8090. abstract: true,
  8091. props: {
  8092. include: patternTypes,
  8093. exclude: patternTypes,
  8094. max: [String, Number]
  8095. },
  8096. created: function created () {
  8097. this.cache = Object.create(null);
  8098. this.keys = [];
  8099. },
  8100. destroyed: function destroyed () {
  8101. for (var key in this.cache) {
  8102. pruneCacheEntry(this.cache, key, this.keys);
  8103. }
  8104. },
  8105. mounted: function mounted () {
  8106. var this$1 = this;
  8107. this.$watch('include', function (val) {
  8108. pruneCache(this$1, function (name) { return matches(val, name); });
  8109. });
  8110. this.$watch('exclude', function (val) {
  8111. pruneCache(this$1, function (name) { return !matches(val, name); });
  8112. });
  8113. },
  8114. render: function render () {
  8115. var slot = this.$slots.default;
  8116. var vnode = getFirstComponentChild(slot);
  8117. var componentOptions = vnode && vnode.componentOptions;
  8118. if (componentOptions) {
  8119. // check pattern
  8120. var name = getComponentName(componentOptions);
  8121. var ref = this;
  8122. var include = ref.include;
  8123. var exclude = ref.exclude;
  8124. if (
  8125. // not included
  8126. (include && (!name || !matches(include, name))) ||
  8127. // excluded
  8128. (exclude && name && matches(exclude, name))
  8129. ) {
  8130. return vnode
  8131. }
  8132. var ref$1 = this;
  8133. var cache = ref$1.cache;
  8134. var keys = ref$1.keys;
  8135. var key = vnode.key == null
  8136. // same constructor may get registered as different local components
  8137. // so cid alone is not enough (#3269)
  8138. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  8139. : vnode.key;
  8140. if (cache[key]) {
  8141. vnode.componentInstance = cache[key].componentInstance;
  8142. // make current key freshest
  8143. remove(keys, key);
  8144. keys.push(key);
  8145. } else {
  8146. cache[key] = vnode;
  8147. keys.push(key);
  8148. // prune oldest entry
  8149. if (this.max && keys.length > parseInt(this.max)) {
  8150. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  8151. }
  8152. }
  8153. vnode.data.keepAlive = true;
  8154. }
  8155. return vnode || (slot && slot[0])
  8156. }
  8157. };
  8158. var builtInComponents = {
  8159. KeepAlive: KeepAlive
  8160. };
  8161. /* */
  8162. function initGlobalAPI (Vue) {
  8163. // config
  8164. var configDef = {};
  8165. configDef.get = function () { return config; };
  8166. if (true) {
  8167. configDef.set = function () {
  8168. warn(
  8169. 'Do not replace the Vue.config object, set individual fields instead.'
  8170. );
  8171. };
  8172. }
  8173. Object.defineProperty(Vue, 'config', configDef);
  8174. // exposed util methods.
  8175. // NOTE: these are not considered part of the public API - avoid relying on
  8176. // them unless you are aware of the risk.
  8177. Vue.util = {
  8178. warn: warn,
  8179. extend: extend,
  8180. mergeOptions: mergeOptions,
  8181. defineReactive: defineReactive$$1
  8182. };
  8183. Vue.set = set;
  8184. Vue.delete = del;
  8185. Vue.nextTick = nextTick;
  8186. // 2.6 explicit observable API
  8187. Vue.observable = function (obj) {
  8188. observe(obj);
  8189. return obj
  8190. };
  8191. Vue.options = Object.create(null);
  8192. ASSET_TYPES.forEach(function (type) {
  8193. Vue.options[type + 's'] = Object.create(null);
  8194. });
  8195. // this is used to identify the "base" constructor to extend all plain-object
  8196. // components with in Weex's multi-instance scenarios.
  8197. Vue.options._base = Vue;
  8198. extend(Vue.options.components, builtInComponents);
  8199. initUse(Vue);
  8200. initMixin$1(Vue);
  8201. initExtend(Vue);
  8202. initAssetRegisters(Vue);
  8203. }
  8204. initGlobalAPI(Vue);
  8205. Object.defineProperty(Vue.prototype, '$isServer', {
  8206. get: isServerRendering
  8207. });
  8208. Object.defineProperty(Vue.prototype, '$ssrContext', {
  8209. get: function get () {
  8210. /* istanbul ignore next */
  8211. return this.$vnode && this.$vnode.ssrContext
  8212. }
  8213. });
  8214. // expose FunctionalRenderContext for ssr runtime helper installation
  8215. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  8216. value: FunctionalRenderContext
  8217. });
  8218. Vue.version = '2.6.11';
  8219. /**
  8220. * https://raw.githubusercontent.com/Tencent/westore/master/packages/westore/utils/diff.js
  8221. */
  8222. var ARRAYTYPE = '[object Array]';
  8223. var OBJECTTYPE = '[object Object]';
  8224. var NULLTYPE = '[object Null]';
  8225. var UNDEFINEDTYPE = '[object Undefined]';
  8226. // const FUNCTIONTYPE = '[object Function]'
  8227. function diff(current, pre) {
  8228. var result = {};
  8229. syncKeys(current, pre);
  8230. _diff(current, pre, '', result);
  8231. return result
  8232. }
  8233. function syncKeys(current, pre) {
  8234. if (current === pre) { return }
  8235. var rootCurrentType = type(current);
  8236. var rootPreType = type(pre);
  8237. if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
  8238. if(Object.keys(current).length >= Object.keys(pre).length){
  8239. for (var key in pre) {
  8240. var currentValue = current[key];
  8241. if (currentValue === undefined) {
  8242. current[key] = null;
  8243. } else {
  8244. syncKeys(currentValue, pre[key]);
  8245. }
  8246. }
  8247. }
  8248. } else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
  8249. if (current.length >= pre.length) {
  8250. pre.forEach(function (item, index) {
  8251. syncKeys(current[index], item);
  8252. });
  8253. }
  8254. }
  8255. }
  8256. function nullOrUndefined(currentType, preType) {
  8257. if(
  8258. (currentType === NULLTYPE || currentType === UNDEFINEDTYPE) &&
  8259. (preType === NULLTYPE || preType === UNDEFINEDTYPE)
  8260. ) {
  8261. return false
  8262. }
  8263. return true
  8264. }
  8265. function _diff(current, pre, path, result) {
  8266. if (current === pre) { return }
  8267. var rootCurrentType = type(current);
  8268. var rootPreType = type(pre);
  8269. if (rootCurrentType == OBJECTTYPE) {
  8270. if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
  8271. setResult(result, path, current);
  8272. } else {
  8273. var loop = function ( key ) {
  8274. var currentValue = current[key];
  8275. var preValue = pre[key];
  8276. var currentType = type(currentValue);
  8277. var preType = type(preValue);
  8278. if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
  8279. if (currentValue !== pre[key] && nullOrUndefined(currentType, preType)) {
  8280. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  8281. }
  8282. } else if (currentType == ARRAYTYPE) {
  8283. if (preType != ARRAYTYPE) {
  8284. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  8285. } else {
  8286. if (currentValue.length < preValue.length) {
  8287. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  8288. } else {
  8289. currentValue.forEach(function (item, index) {
  8290. _diff(item, preValue[index], (path == '' ? '' : path + ".") + key + '[' + index + ']', result);
  8291. });
  8292. }
  8293. }
  8294. } else if (currentType == OBJECTTYPE) {
  8295. if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
  8296. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  8297. } else {
  8298. for (var subKey in currentValue) {
  8299. _diff(currentValue[subKey], preValue[subKey], (path == '' ? '' : path + ".") + key + '.' + subKey, result);
  8300. }
  8301. }
  8302. }
  8303. };
  8304. for (var key in current) loop( key );
  8305. }
  8306. } else if (rootCurrentType == ARRAYTYPE) {
  8307. if (rootPreType != ARRAYTYPE) {
  8308. setResult(result, path, current);
  8309. } else {
  8310. if (current.length < pre.length) {
  8311. setResult(result, path, current);
  8312. } else {
  8313. current.forEach(function (item, index) {
  8314. _diff(item, pre[index], path + '[' + index + ']', result);
  8315. });
  8316. }
  8317. }
  8318. } else {
  8319. setResult(result, path, current);
  8320. }
  8321. }
  8322. function setResult(result, k, v) {
  8323. // if (type(v) != FUNCTIONTYPE) {
  8324. result[k] = v;
  8325. // }
  8326. }
  8327. function type(obj) {
  8328. return Object.prototype.toString.call(obj)
  8329. }
  8330. /* */
  8331. function flushCallbacks$1(vm) {
  8332. if (vm.__next_tick_callbacks && vm.__next_tick_callbacks.length) {
  8333. if (Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"tiyu","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  8334. var mpInstance = vm.$scope;
  8335. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  8336. ']:flushCallbacks[' + vm.__next_tick_callbacks.length + ']');
  8337. }
  8338. var copies = vm.__next_tick_callbacks.slice(0);
  8339. vm.__next_tick_callbacks.length = 0;
  8340. for (var i = 0; i < copies.length; i++) {
  8341. copies[i]();
  8342. }
  8343. }
  8344. }
  8345. function hasRenderWatcher(vm) {
  8346. return queue.find(function (watcher) { return vm._watcher === watcher; })
  8347. }
  8348. function nextTick$1(vm, cb) {
  8349. //1.nextTick 之前 已 setData 且 setData 还未回调完成
  8350. //2.nextTick 之前存在 render watcher
  8351. if (!vm.__next_tick_pending && !hasRenderWatcher(vm)) {
  8352. if(Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"tiyu","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG){
  8353. var mpInstance = vm.$scope;
  8354. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  8355. ']:nextVueTick');
  8356. }
  8357. return nextTick(cb, vm)
  8358. }else{
  8359. if(Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"tiyu","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG){
  8360. var mpInstance$1 = vm.$scope;
  8361. console.log('[' + (+new Date) + '][' + (mpInstance$1.is || mpInstance$1.route) + '][' + vm._uid +
  8362. ']:nextMPTick');
  8363. }
  8364. }
  8365. var _resolve;
  8366. if (!vm.__next_tick_callbacks) {
  8367. vm.__next_tick_callbacks = [];
  8368. }
  8369. vm.__next_tick_callbacks.push(function () {
  8370. if (cb) {
  8371. try {
  8372. cb.call(vm);
  8373. } catch (e) {
  8374. handleError(e, vm, 'nextTick');
  8375. }
  8376. } else if (_resolve) {
  8377. _resolve(vm);
  8378. }
  8379. });
  8380. // $flow-disable-line
  8381. if (!cb && typeof Promise !== 'undefined') {
  8382. return new Promise(function (resolve) {
  8383. _resolve = resolve;
  8384. })
  8385. }
  8386. }
  8387. /* */
  8388. function clearInstance(key, value) {
  8389. // 简易去除 Vue 和小程序组件实例
  8390. if (value) {
  8391. if (value._isVue || value.__v_isMPComponent) {
  8392. return {}
  8393. }
  8394. }
  8395. return value
  8396. }
  8397. function cloneWithData(vm) {
  8398. // 确保当前 vm 所有数据被同步
  8399. var ret = Object.create(null);
  8400. var dataKeys = [].concat(
  8401. Object.keys(vm._data || {}),
  8402. Object.keys(vm._computedWatchers || {}));
  8403. dataKeys.reduce(function(ret, key) {
  8404. ret[key] = vm[key];
  8405. return ret
  8406. }, ret);
  8407. // vue-composition-api
  8408. var compositionApiState = vm.__composition_api_state__ || vm.__secret_vfa_state__;
  8409. var rawBindings = compositionApiState && compositionApiState.rawBindings;
  8410. if (rawBindings) {
  8411. Object.keys(rawBindings).forEach(function (key) {
  8412. ret[key] = vm[key];
  8413. });
  8414. }
  8415. //TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
  8416. Object.assign(ret, vm.$mp.data || {});
  8417. if (
  8418. Array.isArray(vm.$options.behaviors) &&
  8419. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  8420. ) { //form-field
  8421. ret['name'] = vm.name;
  8422. ret['value'] = vm.value;
  8423. }
  8424. return JSON.parse(JSON.stringify(ret, clearInstance))
  8425. }
  8426. var patch = function(oldVnode, vnode) {
  8427. var this$1 = this;
  8428. if (vnode === null) { //destroy
  8429. return
  8430. }
  8431. if (this.mpType === 'page' || this.mpType === 'component') {
  8432. var mpInstance = this.$scope;
  8433. var data = Object.create(null);
  8434. try {
  8435. data = cloneWithData(this);
  8436. } catch (err) {
  8437. console.error(err);
  8438. }
  8439. data.__webviewId__ = mpInstance.data.__webviewId__;
  8440. var mpData = Object.create(null);
  8441. Object.keys(data).forEach(function (key) { //仅同步 data 中有的数据
  8442. mpData[key] = mpInstance.data[key];
  8443. });
  8444. var diffData = this.$shouldDiffData === false ? data : diff(data, mpData);
  8445. if (Object.keys(diffData).length) {
  8446. if (Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"tiyu","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  8447. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + this._uid +
  8448. ']差量更新',
  8449. JSON.stringify(diffData));
  8450. }
  8451. this.__next_tick_pending = true;
  8452. mpInstance.setData(diffData, function () {
  8453. this$1.__next_tick_pending = false;
  8454. flushCallbacks$1(this$1);
  8455. });
  8456. } else {
  8457. flushCallbacks$1(this);
  8458. }
  8459. }
  8460. };
  8461. /* */
  8462. function createEmptyRender() {
  8463. }
  8464. function mountComponent$1(
  8465. vm,
  8466. el,
  8467. hydrating
  8468. ) {
  8469. if (!vm.mpType) {//main.js 中的 new Vue
  8470. return vm
  8471. }
  8472. if (vm.mpType === 'app') {
  8473. vm.$options.render = createEmptyRender;
  8474. }
  8475. if (!vm.$options.render) {
  8476. vm.$options.render = createEmptyRender;
  8477. if (true) {
  8478. /* istanbul ignore if */
  8479. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  8480. vm.$options.el || el) {
  8481. warn(
  8482. 'You are using the runtime-only build of Vue where the template ' +
  8483. 'compiler is not available. Either pre-compile the templates into ' +
  8484. 'render functions, or use the compiler-included build.',
  8485. vm
  8486. );
  8487. } else {
  8488. warn(
  8489. 'Failed to mount component: template or render function not defined.',
  8490. vm
  8491. );
  8492. }
  8493. }
  8494. }
  8495. !vm._$fallback && callHook(vm, 'beforeMount');
  8496. var updateComponent = function () {
  8497. vm._update(vm._render(), hydrating);
  8498. };
  8499. // we set this to vm._watcher inside the watcher's constructor
  8500. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  8501. // component's mounted hook), which relies on vm._watcher being already defined
  8502. new Watcher(vm, updateComponent, noop, {
  8503. before: function before() {
  8504. if (vm._isMounted && !vm._isDestroyed) {
  8505. callHook(vm, 'beforeUpdate');
  8506. }
  8507. }
  8508. }, true /* isRenderWatcher */);
  8509. hydrating = false;
  8510. return vm
  8511. }
  8512. /* */
  8513. function renderClass (
  8514. staticClass,
  8515. dynamicClass
  8516. ) {
  8517. if (isDef(staticClass) || isDef(dynamicClass)) {
  8518. return concat(staticClass, stringifyClass(dynamicClass))
  8519. }
  8520. /* istanbul ignore next */
  8521. return ''
  8522. }
  8523. function concat (a, b) {
  8524. return a ? b ? (a + ' ' + b) : a : (b || '')
  8525. }
  8526. function stringifyClass (value) {
  8527. if (Array.isArray(value)) {
  8528. return stringifyArray(value)
  8529. }
  8530. if (isObject(value)) {
  8531. return stringifyObject(value)
  8532. }
  8533. if (typeof value === 'string') {
  8534. return value
  8535. }
  8536. /* istanbul ignore next */
  8537. return ''
  8538. }
  8539. function stringifyArray (value) {
  8540. var res = '';
  8541. var stringified;
  8542. for (var i = 0, l = value.length; i < l; i++) {
  8543. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  8544. if (res) { res += ' '; }
  8545. res += stringified;
  8546. }
  8547. }
  8548. return res
  8549. }
  8550. function stringifyObject (value) {
  8551. var res = '';
  8552. for (var key in value) {
  8553. if (value[key]) {
  8554. if (res) { res += ' '; }
  8555. res += key;
  8556. }
  8557. }
  8558. return res
  8559. }
  8560. /* */
  8561. var parseStyleText = cached(function (cssText) {
  8562. var res = {};
  8563. var listDelimiter = /;(?![^(]*\))/g;
  8564. var propertyDelimiter = /:(.+)/;
  8565. cssText.split(listDelimiter).forEach(function (item) {
  8566. if (item) {
  8567. var tmp = item.split(propertyDelimiter);
  8568. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  8569. }
  8570. });
  8571. return res
  8572. });
  8573. // normalize possible array / string values into Object
  8574. function normalizeStyleBinding (bindingStyle) {
  8575. if (Array.isArray(bindingStyle)) {
  8576. return toObject(bindingStyle)
  8577. }
  8578. if (typeof bindingStyle === 'string') {
  8579. return parseStyleText(bindingStyle)
  8580. }
  8581. return bindingStyle
  8582. }
  8583. /* */
  8584. var MP_METHODS = ['createSelectorQuery', 'createIntersectionObserver', 'selectAllComponents', 'selectComponent'];
  8585. function getTarget(obj, path) {
  8586. var parts = path.split('.');
  8587. var key = parts[0];
  8588. if (key.indexOf('__$n') === 0) { //number index
  8589. key = parseInt(key.replace('__$n', ''));
  8590. }
  8591. if (parts.length === 1) {
  8592. return obj[key]
  8593. }
  8594. return getTarget(obj[key], parts.slice(1).join('.'))
  8595. }
  8596. function internalMixin(Vue) {
  8597. Vue.config.errorHandler = function(err, vm, info) {
  8598. Vue.util.warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  8599. console.error(err);
  8600. /* eslint-disable no-undef */
  8601. var app = typeof getApp === 'function' && getApp();
  8602. if (app && app.onError) {
  8603. app.onError(err);
  8604. }
  8605. };
  8606. var oldEmit = Vue.prototype.$emit;
  8607. Vue.prototype.$emit = function(event) {
  8608. if (this.$scope && event) {
  8609. var triggerEvent = this.$scope['_triggerEvent'] || this.$scope['triggerEvent'];
  8610. if (triggerEvent) {
  8611. try {
  8612. triggerEvent.call(this.$scope, event, {
  8613. __args__: toArray(arguments, 1)
  8614. });
  8615. } catch (error) {
  8616. }
  8617. }
  8618. }
  8619. return oldEmit.apply(this, arguments)
  8620. };
  8621. Vue.prototype.$nextTick = function(fn) {
  8622. return nextTick$1(this, fn)
  8623. };
  8624. MP_METHODS.forEach(function (method) {
  8625. Vue.prototype[method] = function(args) {
  8626. if (this.$scope && this.$scope[method]) {
  8627. return this.$scope[method](args)
  8628. }
  8629. // mp-alipay
  8630. if (typeof my === 'undefined') {
  8631. return
  8632. }
  8633. if (method === 'createSelectorQuery') {
  8634. /* eslint-disable no-undef */
  8635. return my.createSelectorQuery(args)
  8636. } else if (method === 'createIntersectionObserver') {
  8637. /* eslint-disable no-undef */
  8638. return my.createIntersectionObserver(args)
  8639. }
  8640. // TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
  8641. };
  8642. });
  8643. Vue.prototype.__init_provide = initProvide;
  8644. Vue.prototype.__init_injections = initInjections;
  8645. Vue.prototype.__call_hook = function(hook, args) {
  8646. var vm = this;
  8647. // #7573 disable dep collection when invoking lifecycle hooks
  8648. pushTarget();
  8649. var handlers = vm.$options[hook];
  8650. var info = hook + " hook";
  8651. var ret;
  8652. if (handlers) {
  8653. for (var i = 0, j = handlers.length; i < j; i++) {
  8654. ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
  8655. }
  8656. }
  8657. if (vm._hasHookEvent) {
  8658. vm.$emit('hook:' + hook, args);
  8659. }
  8660. popTarget();
  8661. return ret
  8662. };
  8663. Vue.prototype.__set_model = function(target, key, value, modifiers) {
  8664. if (Array.isArray(modifiers)) {
  8665. if (modifiers.indexOf('trim') !== -1) {
  8666. value = value.trim();
  8667. }
  8668. if (modifiers.indexOf('number') !== -1) {
  8669. value = this._n(value);
  8670. }
  8671. }
  8672. if (!target) {
  8673. target = this;
  8674. }
  8675. // 解决动态属性添加
  8676. Vue.set(target, key, value);
  8677. };
  8678. Vue.prototype.__set_sync = function(target, key, value) {
  8679. if (!target) {
  8680. target = this;
  8681. }
  8682. // 解决动态属性添加
  8683. Vue.set(target, key, value);
  8684. };
  8685. Vue.prototype.__get_orig = function(item) {
  8686. if (isPlainObject(item)) {
  8687. return item['$orig'] || item
  8688. }
  8689. return item
  8690. };
  8691. Vue.prototype.__get_value = function(dataPath, target) {
  8692. return getTarget(target || this, dataPath)
  8693. };
  8694. Vue.prototype.__get_class = function(dynamicClass, staticClass) {
  8695. return renderClass(staticClass, dynamicClass)
  8696. };
  8697. Vue.prototype.__get_style = function(dynamicStyle, staticStyle) {
  8698. if (!dynamicStyle && !staticStyle) {
  8699. return ''
  8700. }
  8701. var dynamicStyleObj = normalizeStyleBinding(dynamicStyle);
  8702. var styleObj = staticStyle ? extend(staticStyle, dynamicStyleObj) : dynamicStyleObj;
  8703. return Object.keys(styleObj).map(function (name) { return ((hyphenate(name)) + ":" + (styleObj[name])); }).join(';')
  8704. };
  8705. Vue.prototype.__map = function(val, iteratee) {
  8706. //TODO 暂不考虑 string
  8707. var ret, i, l, keys, key;
  8708. if (Array.isArray(val)) {
  8709. ret = new Array(val.length);
  8710. for (i = 0, l = val.length; i < l; i++) {
  8711. ret[i] = iteratee(val[i], i);
  8712. }
  8713. return ret
  8714. } else if (isObject(val)) {
  8715. keys = Object.keys(val);
  8716. ret = Object.create(null);
  8717. for (i = 0, l = keys.length; i < l; i++) {
  8718. key = keys[i];
  8719. ret[key] = iteratee(val[key], key, i);
  8720. }
  8721. return ret
  8722. } else if (typeof val === 'number') {
  8723. ret = new Array(val);
  8724. for (i = 0, l = val; i < l; i++) {
  8725. // 第一个参数暂时仍和小程序一致
  8726. ret[i] = iteratee(i, i);
  8727. }
  8728. return ret
  8729. }
  8730. return []
  8731. };
  8732. }
  8733. /* */
  8734. var LIFECYCLE_HOOKS$1 = [
  8735. //App
  8736. 'onLaunch',
  8737. 'onShow',
  8738. 'onHide',
  8739. 'onUniNViewMessage',
  8740. 'onPageNotFound',
  8741. 'onThemeChange',
  8742. 'onError',
  8743. 'onUnhandledRejection',
  8744. //Page
  8745. 'onInit',
  8746. 'onLoad',
  8747. // 'onShow',
  8748. 'onReady',
  8749. // 'onHide',
  8750. 'onUnload',
  8751. 'onPullDownRefresh',
  8752. 'onReachBottom',
  8753. 'onTabItemTap',
  8754. 'onAddToFavorites',
  8755. 'onShareTimeline',
  8756. 'onShareAppMessage',
  8757. 'onResize',
  8758. 'onPageScroll',
  8759. 'onNavigationBarButtonTap',
  8760. 'onBackPress',
  8761. 'onNavigationBarSearchInputChanged',
  8762. 'onNavigationBarSearchInputConfirmed',
  8763. 'onNavigationBarSearchInputClicked',
  8764. 'onUploadDouyinVideo',
  8765. 'onNFCReadMessage',
  8766. //Component
  8767. // 'onReady', // 兼容旧版本,应该移除该事件
  8768. 'onPageShow',
  8769. 'onPageHide',
  8770. 'onPageResize'
  8771. ];
  8772. function lifecycleMixin$1(Vue) {
  8773. //fixed vue-class-component
  8774. var oldExtend = Vue.extend;
  8775. Vue.extend = function(extendOptions) {
  8776. extendOptions = extendOptions || {};
  8777. var methods = extendOptions.methods;
  8778. if (methods) {
  8779. Object.keys(methods).forEach(function (methodName) {
  8780. if (LIFECYCLE_HOOKS$1.indexOf(methodName)!==-1) {
  8781. extendOptions[methodName] = methods[methodName];
  8782. delete methods[methodName];
  8783. }
  8784. });
  8785. }
  8786. return oldExtend.call(this, extendOptions)
  8787. };
  8788. var strategies = Vue.config.optionMergeStrategies;
  8789. var mergeHook = strategies.created;
  8790. LIFECYCLE_HOOKS$1.forEach(function (hook) {
  8791. strategies[hook] = mergeHook;
  8792. });
  8793. Vue.prototype.__lifecycle_hooks__ = LIFECYCLE_HOOKS$1;
  8794. }
  8795. /* */
  8796. // install platform patch function
  8797. Vue.prototype.__patch__ = patch;
  8798. // public mount method
  8799. Vue.prototype.$mount = function(
  8800. el ,
  8801. hydrating
  8802. ) {
  8803. return mountComponent$1(this, el, hydrating)
  8804. };
  8805. lifecycleMixin$1(Vue);
  8806. internalMixin(Vue);
  8807. /* */
  8808. /* harmony default export */ __webpack_exports__["default"] = (Vue);
  8809. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ 3)))
  8810. /***/ }),
  8811. /* 26 */
  8812. /*!***********************************************************!*\
  8813. !*** C:/Users/Administrator/Desktop/yswc/tiyu/pages.json ***!
  8814. \***********************************************************/
  8815. /*! no static exports found */
  8816. /***/ (function(module, exports) {
  8817. /***/ }),
  8818. /* 27 */,
  8819. /* 28 */,
  8820. /* 29 */,
  8821. /* 30 */,
  8822. /* 31 */,
  8823. /* 32 */
  8824. /*!**********************************************************************************************************!*\
  8825. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js ***!
  8826. \**********************************************************************************************************/
  8827. /*! exports provided: default */
  8828. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8829. "use strict";
  8830. __webpack_require__.r(__webpack_exports__);
  8831. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  8832. /* globals __VUE_SSR_CONTEXT__ */
  8833. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  8834. // This module is a runtime utility for cleaner component module output and will
  8835. // be included in the final webpack user bundle.
  8836. function normalizeComponent (
  8837. scriptExports,
  8838. render,
  8839. staticRenderFns,
  8840. functionalTemplate,
  8841. injectStyles,
  8842. scopeId,
  8843. moduleIdentifier, /* server only */
  8844. shadowMode, /* vue-cli only */
  8845. components, // fixed by xxxxxx auto components
  8846. renderjs // fixed by xxxxxx renderjs
  8847. ) {
  8848. // Vue.extend constructor export interop
  8849. var options = typeof scriptExports === 'function'
  8850. ? scriptExports.options
  8851. : scriptExports
  8852. // fixed by xxxxxx auto components
  8853. if (components) {
  8854. if (!options.components) {
  8855. options.components = {}
  8856. }
  8857. var hasOwn = Object.prototype.hasOwnProperty
  8858. for (var name in components) {
  8859. if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {
  8860. options.components[name] = components[name]
  8861. }
  8862. }
  8863. }
  8864. // fixed by xxxxxx renderjs
  8865. if (renderjs) {
  8866. if(typeof renderjs.beforeCreate === 'function'){
  8867. renderjs.beforeCreate = [renderjs.beforeCreate]
  8868. }
  8869. (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {
  8870. this[renderjs.__module] = this
  8871. });
  8872. (options.mixins || (options.mixins = [])).push(renderjs)
  8873. }
  8874. // render functions
  8875. if (render) {
  8876. options.render = render
  8877. options.staticRenderFns = staticRenderFns
  8878. options._compiled = true
  8879. }
  8880. // functional template
  8881. if (functionalTemplate) {
  8882. options.functional = true
  8883. }
  8884. // scopedId
  8885. if (scopeId) {
  8886. options._scopeId = 'data-v-' + scopeId
  8887. }
  8888. var hook
  8889. if (moduleIdentifier) { // server build
  8890. hook = function (context) {
  8891. // 2.3 injection
  8892. context =
  8893. context || // cached call
  8894. (this.$vnode && this.$vnode.ssrContext) || // stateful
  8895. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  8896. // 2.2 with runInNewContext: true
  8897. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  8898. context = __VUE_SSR_CONTEXT__
  8899. }
  8900. // inject component styles
  8901. if (injectStyles) {
  8902. injectStyles.call(this, context)
  8903. }
  8904. // register component module identifier for async chunk inferrence
  8905. if (context && context._registeredComponents) {
  8906. context._registeredComponents.add(moduleIdentifier)
  8907. }
  8908. }
  8909. // used by ssr in case component is cached and beforeCreate
  8910. // never gets called
  8911. options._ssrRegister = hook
  8912. } else if (injectStyles) {
  8913. hook = shadowMode
  8914. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  8915. : injectStyles
  8916. }
  8917. if (hook) {
  8918. if (options.functional) {
  8919. // for template-only hot-reload because in that case the render fn doesn't
  8920. // go through the normalizer
  8921. options._injectStyles = hook
  8922. // register for functioal component in vue file
  8923. var originalRender = options.render
  8924. options.render = function renderWithStyleInjection (h, context) {
  8925. hook.call(context)
  8926. return originalRender(h, context)
  8927. }
  8928. } else {
  8929. // inject component registration as beforeCreate hook
  8930. var existing = options.beforeCreate
  8931. options.beforeCreate = existing
  8932. ? [].concat(existing, hook)
  8933. : [hook]
  8934. }
  8935. }
  8936. return {
  8937. exports: scriptExports,
  8938. options: options
  8939. }
  8940. }
  8941. /***/ }),
  8942. /* 33 */
  8943. /*!******************************************************************!*\
  8944. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/index.js ***!
  8945. \******************************************************************/
  8946. /*! no static exports found */
  8947. /***/ (function(module, exports, __webpack_require__) {
  8948. "use strict";
  8949. /* WEBPACK VAR INJECTION */(function(uni) {
  8950. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  8951. Object.defineProperty(exports, "__esModule", {
  8952. value: true
  8953. });
  8954. exports.default = void 0;
  8955. var _mixin = _interopRequireDefault(__webpack_require__(/*! ./libs/mixin/mixin.js */ 34));
  8956. var _request = _interopRequireDefault(__webpack_require__(/*! ./libs/request */ 35));
  8957. var _queryParams = _interopRequireDefault(__webpack_require__(/*! ./libs/function/queryParams.js */ 39));
  8958. var _route = _interopRequireDefault(__webpack_require__(/*! ./libs/function/route.js */ 40));
  8959. var _timeFormat = _interopRequireDefault(__webpack_require__(/*! ./libs/function/timeFormat.js */ 44));
  8960. var _timeFrom = _interopRequireDefault(__webpack_require__(/*! ./libs/function/timeFrom.js */ 45));
  8961. var _colorGradient = _interopRequireDefault(__webpack_require__(/*! ./libs/function/colorGradient.js */ 46));
  8962. var _guid = _interopRequireDefault(__webpack_require__(/*! ./libs/function/guid.js */ 47));
  8963. var _color = _interopRequireDefault(__webpack_require__(/*! ./libs/function/color.js */ 48));
  8964. var _type2icon = _interopRequireDefault(__webpack_require__(/*! ./libs/function/type2icon.js */ 49));
  8965. var _randomArray = _interopRequireDefault(__webpack_require__(/*! ./libs/function/randomArray.js */ 50));
  8966. var _deepClone = _interopRequireDefault(__webpack_require__(/*! ./libs/function/deepClone.js */ 37));
  8967. var _deepMerge = _interopRequireDefault(__webpack_require__(/*! ./libs/function/deepMerge.js */ 36));
  8968. var _addUnit = _interopRequireDefault(__webpack_require__(/*! ./libs/function/addUnit.js */ 51));
  8969. var _test = _interopRequireDefault(__webpack_require__(/*! ./libs/function/test.js */ 38));
  8970. var _random = _interopRequireDefault(__webpack_require__(/*! ./libs/function/random.js */ 52));
  8971. var _trim = _interopRequireDefault(__webpack_require__(/*! ./libs/function/trim.js */ 53));
  8972. var _toast = _interopRequireDefault(__webpack_require__(/*! ./libs/function/toast.js */ 54));
  8973. var _getParent = _interopRequireDefault(__webpack_require__(/*! ./libs/function/getParent.js */ 55));
  8974. var _$parent = _interopRequireDefault(__webpack_require__(/*! ./libs/function/$parent.js */ 56));
  8975. var _sys = __webpack_require__(/*! ./libs/function/sys.js */ 57);
  8976. var _debounce = _interopRequireDefault(__webpack_require__(/*! ./libs/function/debounce.js */ 58));
  8977. var _throttle = _interopRequireDefault(__webpack_require__(/*! ./libs/function/throttle.js */ 59));
  8978. var _config = _interopRequireDefault(__webpack_require__(/*! ./libs/config/config.js */ 60));
  8979. var _zIndex = _interopRequireDefault(__webpack_require__(/*! ./libs/config/zIndex.js */ 61));
  8980. // 引入全局mixin
  8981. // 引入关于是否mixin集成小程序分享的配置
  8982. // import wxshare from './libs/mixin/mpShare.js'
  8983. // 全局挂载引入http相关请求拦截插件
  8984. function wranning(str) {
  8985. // 开发环境进行信息输出,主要是一些报错信息
  8986. // 这个环境的来由是在程序编写时候,点击hx编辑器运行调试代码的时候,详见:
  8987. // 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
  8988. if (true) {
  8989. console.warn(str);
  8990. }
  8991. }
  8992. // 尝试判断在根目录的/store中是否有$u.mixin.js,此文件uView默认为需要挂在到全局的vuex的state变量
  8993. // HX2.6.11版本,放到try中,控制台依然会警告,暂时不用此方式,
  8994. // let vuexStore = {};
  8995. // try {
  8996. // vuexStore = require("@/store/$u.mixin.js");
  8997. // } catch (e) {
  8998. // //TODO handle the exception
  8999. // }
  9000. // post类型对象参数转为get类型url参数
  9001. var $u = {
  9002. queryParams: _queryParams.default,
  9003. route: _route.default,
  9004. timeFormat: _timeFormat.default,
  9005. date: _timeFormat.default,
  9006. // 另名date
  9007. timeFrom: _timeFrom.default,
  9008. colorGradient: _colorGradient.default.colorGradient,
  9009. colorToRgba: _colorGradient.default.colorToRgba,
  9010. guid: _guid.default,
  9011. color: _color.default,
  9012. sys: _sys.sys,
  9013. os: _sys.os,
  9014. type2icon: _type2icon.default,
  9015. randomArray: _randomArray.default,
  9016. wranning: wranning,
  9017. get: _request.default.get,
  9018. post: _request.default.post,
  9019. put: _request.default.put,
  9020. 'delete': _request.default.delete,
  9021. hexToRgb: _colorGradient.default.hexToRgb,
  9022. rgbToHex: _colorGradient.default.rgbToHex,
  9023. test: _test.default,
  9024. random: _random.default,
  9025. deepClone: _deepClone.default,
  9026. deepMerge: _deepMerge.default,
  9027. getParent: _getParent.default,
  9028. $parent: _$parent.default,
  9029. addUnit: _addUnit.default,
  9030. trim: _trim.default,
  9031. type: ['primary', 'success', 'error', 'warning', 'info'],
  9032. http: _request.default,
  9033. toast: _toast.default,
  9034. config: _config.default,
  9035. // uView配置信息相关,比如版本号
  9036. zIndex: _zIndex.default,
  9037. debounce: _debounce.default,
  9038. throttle: _throttle.default
  9039. };
  9040. // $u挂载到uni对象上
  9041. uni.$u = $u;
  9042. var install = function install(Vue) {
  9043. Vue.mixin(_mixin.default);
  9044. if (Vue.prototype.openShare) {
  9045. Vue.mixin(mpShare);
  9046. }
  9047. // Vue.mixin(vuexStore);
  9048. // 时间格式化,同时两个名称,date和timeFormat
  9049. Vue.filter('timeFormat', function (timestamp, format) {
  9050. return (0, _timeFormat.default)(timestamp, format);
  9051. });
  9052. Vue.filter('date', function (timestamp, format) {
  9053. return (0, _timeFormat.default)(timestamp, format);
  9054. });
  9055. // 将多久以前的方法,注入到全局过滤器
  9056. Vue.filter('timeFrom', function (timestamp, format) {
  9057. return (0, _timeFrom.default)(timestamp, format);
  9058. });
  9059. Vue.prototype.$u = $u;
  9060. };
  9061. var _default = {
  9062. install: install
  9063. };
  9064. exports.default = _default;
  9065. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  9066. /***/ }),
  9067. /* 34 */
  9068. /*!*****************************************************************************!*\
  9069. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/libs/mixin/mixin.js ***!
  9070. \*****************************************************************************/
  9071. /*! no static exports found */
  9072. /***/ (function(module, exports, __webpack_require__) {
  9073. /* WEBPACK VAR INJECTION */(function(uni) {module.exports = {
  9074. data: function data() {
  9075. return {};
  9076. },
  9077. onLoad: function onLoad() {
  9078. // getRect挂载到$u上,因为这方法需要使用in(this),所以无法把它独立成一个单独的文件导出
  9079. this.$u.getRect = this.$uGetRect;
  9080. },
  9081. methods: {
  9082. // 查询节点信息
  9083. // 目前此方法在支付宝小程序中无法获取组件跟接点的尺寸,为支付宝的bug(2020-07-21)
  9084. // 解决办法为在组件根部再套一个没有任何作用的view元素
  9085. $uGetRect: function $uGetRect(selector, all) {
  9086. var _this = this;
  9087. return new Promise(function (resolve) {
  9088. uni.createSelectorQuery().in(_this)[all ? 'selectAll' : 'select'](selector).boundingClientRect(function (rect) {
  9089. if (all && Array.isArray(rect) && rect.length) {
  9090. resolve(rect);
  9091. }
  9092. if (!all && rect) {
  9093. resolve(rect);
  9094. }
  9095. }).exec();
  9096. });
  9097. },
  9098. getParentData: function getParentData() {
  9099. var _this2 = this;
  9100. var parentName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  9101. // 避免在created中去定义parent变量
  9102. if (!this.parent) this.parent = false;
  9103. // 这里的本质原理是,通过获取父组件实例(也即u-radio-group的this)
  9104. // 将父组件this中对应的参数,赋值给本组件(u-radio的this)的parentData对象中对应的属性
  9105. // 之所以需要这么做,是因为所有端中,头条小程序不支持通过this.parent.xxx去监听父组件参数的变化
  9106. this.parent = this.$u.$parent.call(this, parentName);
  9107. if (this.parent) {
  9108. // 历遍parentData中的属性,将parent中的同名属性赋值给parentData
  9109. Object.keys(this.parentData).map(function (key) {
  9110. _this2.parentData[key] = _this2.parent[key];
  9111. });
  9112. }
  9113. },
  9114. // 阻止事件冒泡
  9115. preventEvent: function preventEvent(e) {
  9116. e && e.stopPropagation && e.stopPropagation();
  9117. }
  9118. },
  9119. onReachBottom: function onReachBottom() {
  9120. uni.$emit('uOnReachBottom');
  9121. },
  9122. beforeDestroy: function beforeDestroy() {
  9123. var _this3 = this;
  9124. // 判断当前页面是否存在parent和children,一般在checkbox和checkbox-group父子联动的场景会有此情况
  9125. // 组件销毁时,移除子组件在父组件children数组中的实例,释放资源,避免数据混乱
  9126. if (this.parent && uni.$u.test.array(this.parent.children)) {
  9127. // 组件销毁时,移除父组件中的children数组中对应的实例
  9128. var childrenList = this.parent.children;
  9129. childrenList.map(function (child, index) {
  9130. // 如果相等,则移除
  9131. if (child === _this3) {
  9132. childrenList.splice(index, 1);
  9133. }
  9134. });
  9135. }
  9136. }
  9137. };
  9138. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  9139. /***/ }),
  9140. /* 35 */
  9141. /*!*******************************************************************************!*\
  9142. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/libs/request/index.js ***!
  9143. \*******************************************************************************/
  9144. /*! no static exports found */
  9145. /***/ (function(module, exports, __webpack_require__) {
  9146. "use strict";
  9147. /* WEBPACK VAR INJECTION */(function(uni) {
  9148. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  9149. Object.defineProperty(exports, "__esModule", {
  9150. value: true
  9151. });
  9152. exports.default = void 0;
  9153. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
  9154. var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
  9155. var _deepMerge = _interopRequireDefault(__webpack_require__(/*! ../function/deepMerge */ 36));
  9156. var _test = _interopRequireDefault(__webpack_require__(/*! ../function/test */ 38));
  9157. var Request = /*#__PURE__*/function () {
  9158. function Request() {
  9159. var _this = this;
  9160. (0, _classCallCheck2.default)(this, Request);
  9161. this.config = {
  9162. baseUrl: '',
  9163. // 请求的根域名
  9164. // 默认的请求头
  9165. header: {},
  9166. method: 'POST',
  9167. // 设置为json,返回后uni.request会对数据进行一次JSON.parse
  9168. dataType: 'json',
  9169. // 此参数无需处理,因为5+和支付宝小程序不支持,默认为text即可
  9170. responseType: 'text',
  9171. showLoading: true,
  9172. // 是否显示请求中的loading
  9173. loadingText: '请求中...',
  9174. loadingTime: 800,
  9175. // 在此时间内,请求还没回来的话,就显示加载中动画,单位ms
  9176. timer: null,
  9177. // 定时器
  9178. originalData: false,
  9179. // 是否在拦截器中返回服务端的原始数据,见文档说明
  9180. loadingMask: true // 展示loading的时候,是否给一个透明的蒙层,防止触摸穿透
  9181. };
  9182. // 拦截器
  9183. this.interceptor = {
  9184. // 请求前的拦截
  9185. request: null,
  9186. // 请求后的拦截
  9187. response: null
  9188. };
  9189. // get请求
  9190. this.get = function (url) {
  9191. var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  9192. var header = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  9193. return _this.request({
  9194. method: 'GET',
  9195. url: url,
  9196. header: header,
  9197. data: data
  9198. });
  9199. };
  9200. // post请求
  9201. this.post = function (url) {
  9202. var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  9203. var header = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  9204. return _this.request({
  9205. url: url,
  9206. method: 'POST',
  9207. header: header,
  9208. data: data
  9209. });
  9210. };
  9211. // put请求,不支持支付宝小程序(HX2.6.15)
  9212. this.put = function (url) {
  9213. var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  9214. var header = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  9215. return _this.request({
  9216. url: url,
  9217. method: 'PUT',
  9218. header: header,
  9219. data: data
  9220. });
  9221. };
  9222. // delete请求,不支持支付宝和头条小程序(HX2.6.15)
  9223. this.delete = function (url) {
  9224. var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  9225. var header = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  9226. return _this.request({
  9227. url: url,
  9228. method: 'DELETE',
  9229. header: header,
  9230. data: data
  9231. });
  9232. };
  9233. }
  9234. (0, _createClass2.default)(Request, [{
  9235. key: "setConfig",
  9236. value:
  9237. // 设置全局默认配置
  9238. function setConfig(customConfig) {
  9239. // 深度合并对象,否则会造成对象深层属性丢失
  9240. this.config = (0, _deepMerge.default)(this.config, customConfig);
  9241. }
  9242. // 主要请求部分
  9243. }, {
  9244. key: "request",
  9245. value: function request() {
  9246. var _this2 = this;
  9247. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  9248. // 检查请求拦截
  9249. if (this.interceptor.request && typeof this.interceptor.request === 'function') {
  9250. var tmpConfig = {};
  9251. var interceptorRequest = this.interceptor.request(options);
  9252. if (interceptorRequest === false) {
  9253. // 返回一个处于pending状态中的Promise,来取消原promise,避免进入then()回调
  9254. return new Promise(function () {});
  9255. }
  9256. this.options = interceptorRequest;
  9257. }
  9258. options.dataType = options.dataType || this.config.dataType;
  9259. options.responseType = options.responseType || this.config.responseType;
  9260. options.url = options.url || '';
  9261. options.params = options.params || {};
  9262. options.header = Object.assign({}, this.config.header, options.header);
  9263. options.method = options.method || this.config.method;
  9264. return new Promise(function (resolve, reject) {
  9265. options.complete = function (response) {
  9266. // 请求返回后,隐藏loading(如果请求返回快的话,可能会没有loading)
  9267. uni.hideLoading();
  9268. // 清除定时器,如果请求回来了,就无需loading
  9269. clearTimeout(_this2.config.timer);
  9270. _this2.config.timer = null;
  9271. // 判断用户对拦截返回数据的要求,如果originalData为true,返回所有的数据(response)到拦截器,否则只返回response.data
  9272. if (_this2.config.originalData) {
  9273. // 判断是否存在拦截器
  9274. if (_this2.interceptor.response && typeof _this2.interceptor.response === 'function') {
  9275. var resInterceptors = _this2.interceptor.response(response);
  9276. // 如果拦截器不返回false,就将拦截器返回的内容给this.$u.post的then回调
  9277. if (resInterceptors !== false) {
  9278. resolve(resInterceptors);
  9279. } else {
  9280. // 如果拦截器返回false,意味着拦截器定义者认为返回有问题,直接接入catch回调
  9281. reject(response);
  9282. }
  9283. } else {
  9284. // 如果要求返回原始数据,就算没有拦截器,也返回最原始的数据
  9285. resolve(response);
  9286. }
  9287. } else {
  9288. if (response.statusCode == 200) {
  9289. if (_this2.interceptor.response && typeof _this2.interceptor.response === 'function') {
  9290. var _resInterceptors = _this2.interceptor.response(response.data);
  9291. if (_resInterceptors !== false) {
  9292. resolve(_resInterceptors);
  9293. } else {
  9294. reject(response.data);
  9295. }
  9296. } else {
  9297. // 如果不是返回原始数据(originalData=false),且没有拦截器的情况下,返回纯数据给then回调
  9298. resolve(response.data);
  9299. }
  9300. } else {
  9301. // 不返回原始数据的情况下,服务器状态码不为200,modal弹框提示
  9302. // if(response.errMsg) {
  9303. // uni.showModal({
  9304. // title: response.errMsg
  9305. // });
  9306. // }
  9307. reject(response);
  9308. }
  9309. }
  9310. };
  9311. // 判断用户传递的URL是否/开头,如果不是,加上/,这里使用了uView的test.js验证库的url()方法
  9312. options.url = _test.default.url(options.url) ? options.url : _this2.config.baseUrl + (options.url.indexOf('/') == 0 ? options.url : '/' + options.url);
  9313. // 是否显示loading
  9314. // 加一个是否已有timer定时器的判断,否则有两个同时请求的时候,后者会清除前者的定时器id
  9315. // 而没有清除前者的定时器,导致前者超时,一直显示loading
  9316. if (_this2.config.showLoading && !_this2.config.timer) {
  9317. _this2.config.timer = setTimeout(function () {
  9318. uni.showLoading({
  9319. title: _this2.config.loadingText,
  9320. mask: _this2.config.loadingMask
  9321. });
  9322. _this2.config.timer = null;
  9323. }, _this2.config.loadingTime);
  9324. }
  9325. uni.request(options);
  9326. });
  9327. // .catch(res => {
  9328. // // 如果返回reject(),不让其进入this.$u.post().then().catch()后面的catct()
  9329. // // 因为很多人都会忘了写后面的catch(),导致报错捕获不到catch
  9330. // return new Promise(()=>{});
  9331. // })
  9332. }
  9333. }]);
  9334. return Request;
  9335. }();
  9336. var _default = new Request();
  9337. exports.default = _default;
  9338. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  9339. /***/ }),
  9340. /* 36 */
  9341. /*!************************************************************************************!*\
  9342. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/libs/function/deepMerge.js ***!
  9343. \************************************************************************************/
  9344. /*! no static exports found */
  9345. /***/ (function(module, exports, __webpack_require__) {
  9346. "use strict";
  9347. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  9348. Object.defineProperty(exports, "__esModule", {
  9349. value: true
  9350. });
  9351. exports.default = void 0;
  9352. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  9353. var _deepClone = _interopRequireDefault(__webpack_require__(/*! ./deepClone */ 37));
  9354. // JS对象深度合并
  9355. function deepMerge() {
  9356. var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  9357. var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  9358. target = (0, _deepClone.default)(target);
  9359. if ((0, _typeof2.default)(target) !== 'object' || (0, _typeof2.default)(source) !== 'object') return false;
  9360. for (var prop in source) {
  9361. if (!source.hasOwnProperty(prop)) continue;
  9362. if (prop in target) {
  9363. if ((0, _typeof2.default)(target[prop]) !== 'object') {
  9364. target[prop] = source[prop];
  9365. } else {
  9366. if ((0, _typeof2.default)(source[prop]) !== 'object') {
  9367. target[prop] = source[prop];
  9368. } else {
  9369. if (target[prop].concat && source[prop].concat) {
  9370. target[prop] = target[prop].concat(source[prop]);
  9371. } else {
  9372. target[prop] = deepMerge(target[prop], source[prop]);
  9373. }
  9374. }
  9375. }
  9376. } else {
  9377. target[prop] = source[prop];
  9378. }
  9379. }
  9380. return target;
  9381. }
  9382. var _default = deepMerge;
  9383. exports.default = _default;
  9384. /***/ }),
  9385. /* 37 */
  9386. /*!************************************************************************************!*\
  9387. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/libs/function/deepClone.js ***!
  9388. \************************************************************************************/
  9389. /*! no static exports found */
  9390. /***/ (function(module, exports, __webpack_require__) {
  9391. "use strict";
  9392. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  9393. Object.defineProperty(exports, "__esModule", {
  9394. value: true
  9395. });
  9396. exports.default = void 0;
  9397. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  9398. // 判断arr是否为一个数组,返回一个bool值
  9399. function isArray(arr) {
  9400. return Object.prototype.toString.call(arr) === '[object Array]';
  9401. }
  9402. // 深度克隆
  9403. function deepClone(obj) {
  9404. // 对常见的“非”值,直接返回原来值
  9405. if ([null, undefined, NaN, false].includes(obj)) return obj;
  9406. if ((0, _typeof2.default)(obj) !== "object" && typeof obj !== 'function') {
  9407. //原始类型直接返回
  9408. return obj;
  9409. }
  9410. var o = isArray(obj) ? [] : {};
  9411. for (var i in obj) {
  9412. if (obj.hasOwnProperty(i)) {
  9413. o[i] = (0, _typeof2.default)(obj[i]) === "object" ? deepClone(obj[i]) : obj[i];
  9414. }
  9415. }
  9416. return o;
  9417. }
  9418. var _default = deepClone;
  9419. exports.default = _default;
  9420. /***/ }),
  9421. /* 38 */
  9422. /*!*******************************************************************************!*\
  9423. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/libs/function/test.js ***!
  9424. \*******************************************************************************/
  9425. /*! no static exports found */
  9426. /***/ (function(module, exports, __webpack_require__) {
  9427. "use strict";
  9428. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  9429. Object.defineProperty(exports, "__esModule", {
  9430. value: true
  9431. });
  9432. exports.default = void 0;
  9433. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  9434. /**
  9435. * 验证电子邮箱格式
  9436. */
  9437. function email(value) {
  9438. return /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/.test(value);
  9439. }
  9440. /**
  9441. * 验证手机格式
  9442. */
  9443. function mobile(value) {
  9444. return /^1[3-9]\d{9}$/.test(value);
  9445. }
  9446. /**
  9447. * 验证URL格式
  9448. */
  9449. function url(value) {
  9450. return /http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w-.\/?%&=]*)?/.test(value);
  9451. }
  9452. /**
  9453. * 验证日期格式
  9454. */
  9455. function date(value) {
  9456. return !/Invalid|NaN/.test(new Date(value).toString());
  9457. }
  9458. /**
  9459. * 验证ISO类型的日期格式
  9460. */
  9461. function dateISO(value) {
  9462. return /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(value);
  9463. }
  9464. /**
  9465. * 验证十进制数字
  9466. */
  9467. function number(value) {
  9468. return /^[\+-]?(\d+\.?\d*|\.\d+|\d\.\d+e\+\d+)$/.test(value);
  9469. }
  9470. /**
  9471. * 验证整数
  9472. */
  9473. function digits(value) {
  9474. return /^\d+$/.test(value);
  9475. }
  9476. /**
  9477. * 验证身份证号码
  9478. */
  9479. function idCard(value) {
  9480. 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(value);
  9481. }
  9482. /**
  9483. * 是否车牌号
  9484. */
  9485. function carNo(value) {
  9486. // 新能源车牌
  9487. var xreg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/;
  9488. // 旧车牌
  9489. var creg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;
  9490. if (value.length === 7) {
  9491. return creg.test(value);
  9492. } else if (value.length === 8) {
  9493. return xreg.test(value);
  9494. } else {
  9495. return false;
  9496. }
  9497. }
  9498. /**
  9499. * 金额,只允许2位小数
  9500. */
  9501. function amount(value) {
  9502. //金额,只允许保留两位小数
  9503. return /^[1-9]\d*(,\d{3})*(\.\d{1,2})?$|^0\.\d{1,2}$/.test(value);
  9504. }
  9505. /**
  9506. * 中文
  9507. */
  9508. function chinese(value) {
  9509. var reg = /^[\u4e00-\u9fa5]+$/gi;
  9510. return reg.test(value);
  9511. }
  9512. /**
  9513. * 只能输入字母
  9514. */
  9515. function letter(value) {
  9516. return /^[a-zA-Z]*$/.test(value);
  9517. }
  9518. /**
  9519. * 只能是字母或者数字
  9520. */
  9521. function enOrNum(value) {
  9522. //英文或者数字
  9523. var reg = /^[0-9a-zA-Z]*$/g;
  9524. return reg.test(value);
  9525. }
  9526. /**
  9527. * 验证是否包含某个值
  9528. */
  9529. function contains(value, param) {
  9530. return value.indexOf(param) >= 0;
  9531. }
  9532. /**
  9533. * 验证一个值范围[min, max]
  9534. */
  9535. function range(value, param) {
  9536. return value >= param[0] && value <= param[1];
  9537. }
  9538. /**
  9539. * 验证一个长度范围[min, max]
  9540. */
  9541. function rangeLength(value, param) {
  9542. return value.length >= param[0] && value.length <= param[1];
  9543. }
  9544. /**
  9545. * 是否固定电话
  9546. */
  9547. function landline(value) {
  9548. var reg = /^\d{3,4}-\d{7,8}(-\d{3,4})?$/;
  9549. return reg.test(value);
  9550. }
  9551. /**
  9552. * 判断是否为空
  9553. */
  9554. function empty(value) {
  9555. switch ((0, _typeof2.default)(value)) {
  9556. case 'undefined':
  9557. return true;
  9558. case 'string':
  9559. if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true;
  9560. break;
  9561. case 'boolean':
  9562. if (!value) return true;
  9563. break;
  9564. case 'number':
  9565. if (0 === value || isNaN(value)) return true;
  9566. break;
  9567. case 'object':
  9568. if (null === value || value.length === 0) return true;
  9569. for (var i in value) {
  9570. return false;
  9571. }
  9572. return true;
  9573. }
  9574. return false;
  9575. }
  9576. /**
  9577. * 是否json字符串
  9578. */
  9579. function jsonString(value) {
  9580. if (typeof value == 'string') {
  9581. try {
  9582. var obj = JSON.parse(value);
  9583. if ((0, _typeof2.default)(obj) == 'object' && obj) {
  9584. return true;
  9585. } else {
  9586. return false;
  9587. }
  9588. } catch (e) {
  9589. return false;
  9590. }
  9591. }
  9592. return false;
  9593. }
  9594. /**
  9595. * 是否数组
  9596. */
  9597. function array(value) {
  9598. if (typeof Array.isArray === "function") {
  9599. return Array.isArray(value);
  9600. } else {
  9601. return Object.prototype.toString.call(value) === "[object Array]";
  9602. }
  9603. }
  9604. /**
  9605. * 是否对象
  9606. */
  9607. function object(value) {
  9608. return Object.prototype.toString.call(value) === '[object Object]';
  9609. }
  9610. /**
  9611. * 是否短信验证码
  9612. */
  9613. function code(value) {
  9614. var len = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 6;
  9615. return new RegExp("^\\d{".concat(len, "}$")).test(value);
  9616. }
  9617. var _default = {
  9618. email: email,
  9619. mobile: mobile,
  9620. url: url,
  9621. date: date,
  9622. dateISO: dateISO,
  9623. number: number,
  9624. digits: digits,
  9625. idCard: idCard,
  9626. carNo: carNo,
  9627. amount: amount,
  9628. chinese: chinese,
  9629. letter: letter,
  9630. enOrNum: enOrNum,
  9631. contains: contains,
  9632. range: range,
  9633. rangeLength: rangeLength,
  9634. empty: empty,
  9635. isEmpty: empty,
  9636. jsonString: jsonString,
  9637. landline: landline,
  9638. object: object,
  9639. array: array,
  9640. code: code
  9641. };
  9642. exports.default = _default;
  9643. /***/ }),
  9644. /* 39 */
  9645. /*!**************************************************************************************!*\
  9646. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/libs/function/queryParams.js ***!
  9647. \**************************************************************************************/
  9648. /*! no static exports found */
  9649. /***/ (function(module, exports, __webpack_require__) {
  9650. "use strict";
  9651. Object.defineProperty(exports, "__esModule", {
  9652. value: true
  9653. });
  9654. exports.default = void 0;
  9655. /**
  9656. * 对象转url参数
  9657. * @param {*} data,对象
  9658. * @param {*} isPrefix,是否自动加上"?"
  9659. */
  9660. function queryParams() {
  9661. var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  9662. var isPrefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  9663. var arrayFormat = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'brackets';
  9664. var prefix = isPrefix ? '?' : '';
  9665. var _result = [];
  9666. if (['indices', 'brackets', 'repeat', 'comma'].indexOf(arrayFormat) == -1) arrayFormat = 'brackets';
  9667. var _loop = function _loop(key) {
  9668. var value = data[key];
  9669. // 去掉为空的参数
  9670. if (['', undefined, null].indexOf(value) >= 0) {
  9671. return "continue";
  9672. }
  9673. // 如果值为数组,另行处理
  9674. if (value.constructor === Array) {
  9675. // e.g. {ids: [1, 2, 3]}
  9676. switch (arrayFormat) {
  9677. case 'indices':
  9678. // 结果: ids[0]=1&ids[1]=2&ids[2]=3
  9679. for (var i = 0; i < value.length; i++) {
  9680. _result.push(key + '[' + i + ']=' + value[i]);
  9681. }
  9682. break;
  9683. case 'brackets':
  9684. // 结果: ids[]=1&ids[]=2&ids[]=3
  9685. value.forEach(function (_value) {
  9686. _result.push(key + '[]=' + _value);
  9687. });
  9688. break;
  9689. case 'repeat':
  9690. // 结果: ids=1&ids=2&ids=3
  9691. value.forEach(function (_value) {
  9692. _result.push(key + '=' + _value);
  9693. });
  9694. break;
  9695. case 'comma':
  9696. // 结果: ids=1,2,3
  9697. var commaStr = "";
  9698. value.forEach(function (_value) {
  9699. commaStr += (commaStr ? "," : "") + _value;
  9700. });
  9701. _result.push(key + '=' + commaStr);
  9702. break;
  9703. default:
  9704. value.forEach(function (_value) {
  9705. _result.push(key + '[]=' + _value);
  9706. });
  9707. }
  9708. } else {
  9709. _result.push(key + '=' + value);
  9710. }
  9711. };
  9712. for (var key in data) {
  9713. var _ret = _loop(key);
  9714. if (_ret === "continue") continue;
  9715. }
  9716. return _result.length ? prefix + _result.join('&') : '';
  9717. }
  9718. var _default = queryParams;
  9719. exports.default = _default;
  9720. /***/ }),
  9721. /* 40 */
  9722. /*!********************************************************************************!*\
  9723. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/libs/function/route.js ***!
  9724. \********************************************************************************/
  9725. /*! no static exports found */
  9726. /***/ (function(module, exports, __webpack_require__) {
  9727. "use strict";
  9728. /* WEBPACK VAR INJECTION */(function(uni) {
  9729. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  9730. Object.defineProperty(exports, "__esModule", {
  9731. value: true
  9732. });
  9733. exports.default = void 0;
  9734. var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 41));
  9735. var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 43));
  9736. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
  9737. var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
  9738. /**
  9739. * 路由跳转方法,该方法相对于直接使用uni.xxx的好处是使用更加简单快捷
  9740. * 并且带有路由拦截功能
  9741. */
  9742. var Router = /*#__PURE__*/function () {
  9743. function Router() {
  9744. (0, _classCallCheck2.default)(this, Router);
  9745. // 原始属性定义
  9746. this.config = {
  9747. type: 'navigateTo',
  9748. url: '',
  9749. delta: 1,
  9750. // navigateBack页面后退时,回退的层数
  9751. params: {},
  9752. // 传递的参数
  9753. animationType: 'pop-in',
  9754. // 窗口动画,只在APP有效
  9755. animationDuration: 300,
  9756. // 窗口动画持续时间,单位毫秒,只在APP有效
  9757. intercept: false // 是否需要拦截
  9758. };
  9759. // 因为route方法是需要对外赋值给另外的对象使用,同时route内部有使用this,会导致route失去上下文
  9760. // 这里在构造函数中进行this绑定
  9761. this.route = this.route.bind(this);
  9762. }
  9763. // 判断url前面是否有"/",如果没有则加上,否则无法跳转
  9764. (0, _createClass2.default)(Router, [{
  9765. key: "addRootPath",
  9766. value: function addRootPath(url) {
  9767. return url[0] === '/' ? url : "/".concat(url);
  9768. }
  9769. // 整合路由参数
  9770. }, {
  9771. key: "mixinParam",
  9772. value: function mixinParam(url, params) {
  9773. url = url && this.addRootPath(url);
  9774. // 使用正则匹配,主要依据是判断是否有"/","?","="等,如“/page/index/index?name=mary"
  9775. // 如果有url中有get参数,转换后无需带上"?"
  9776. var query = '';
  9777. if (/.*\/.*\?.*=.*/.test(url)) {
  9778. // object对象转为get类型的参数
  9779. query = uni.$u.queryParams(params, false);
  9780. // 因为已有get参数,所以后面拼接的参数需要带上"&"隔开
  9781. return url += "&" + query;
  9782. } else {
  9783. // 直接拼接参数,因为此处url中没有后面的query参数,也就没有"?/&"之类的符号
  9784. query = uni.$u.queryParams(params);
  9785. return url += query;
  9786. }
  9787. }
  9788. // 对外的方法名称
  9789. }, {
  9790. key: "route",
  9791. value: function () {
  9792. var _route = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
  9793. var options,
  9794. params,
  9795. mergeConfig,
  9796. isNext,
  9797. _args = arguments;
  9798. return _regenerator.default.wrap(function _callee$(_context) {
  9799. while (1) {
  9800. switch (_context.prev = _context.next) {
  9801. case 0:
  9802. options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
  9803. params = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
  9804. // 合并用户的配置和内部的默认配置
  9805. mergeConfig = {};
  9806. if (typeof options === 'string') {
  9807. // 如果options为字符串,则为route(url, params)的形式
  9808. mergeConfig.url = this.mixinParam(options, params);
  9809. mergeConfig.type = 'navigateTo';
  9810. } else {
  9811. mergeConfig = uni.$u.deepClone(options, this.config);
  9812. // 否则正常使用mergeConfig中的url和params进行拼接
  9813. mergeConfig.url = this.mixinParam(options.url, options.params);
  9814. }
  9815. if (params.intercept) {
  9816. this.config.intercept = params.intercept;
  9817. }
  9818. // params参数也带给拦截器
  9819. mergeConfig.params = params;
  9820. // 合并内外部参数
  9821. mergeConfig = uni.$u.deepMerge(this.config, mergeConfig);
  9822. // 判断用户是否定义了拦截器
  9823. if (!(typeof uni.$u.routeIntercept === 'function')) {
  9824. _context.next = 14;
  9825. break;
  9826. }
  9827. _context.next = 10;
  9828. return new Promise(function (resolve, reject) {
  9829. uni.$u.routeIntercept(mergeConfig, resolve);
  9830. });
  9831. case 10:
  9832. isNext = _context.sent;
  9833. // 如果isNext为true,则执行路由跳转
  9834. isNext && this.openPage(mergeConfig);
  9835. _context.next = 15;
  9836. break;
  9837. case 14:
  9838. this.openPage(mergeConfig);
  9839. case 15:
  9840. case "end":
  9841. return _context.stop();
  9842. }
  9843. }
  9844. }, _callee, this);
  9845. }));
  9846. function route() {
  9847. return _route.apply(this, arguments);
  9848. }
  9849. return route;
  9850. }() // 执行路由跳转
  9851. }, {
  9852. key: "openPage",
  9853. value: function openPage(config) {
  9854. // 解构参数
  9855. var url = config.url,
  9856. type = config.type,
  9857. delta = config.delta,
  9858. animationType = config.animationType,
  9859. animationDuration = config.animationDuration;
  9860. if (config.type == 'navigateTo' || config.type == 'to') {
  9861. uni.navigateTo({
  9862. url: url,
  9863. animationType: animationType,
  9864. animationDuration: animationDuration
  9865. });
  9866. }
  9867. if (config.type == 'redirectTo' || config.type == 'redirect') {
  9868. uni.redirectTo({
  9869. url: url
  9870. });
  9871. }
  9872. if (config.type == 'switchTab' || config.type == 'tab') {
  9873. uni.switchTab({
  9874. url: url
  9875. });
  9876. }
  9877. if (config.type == 'reLaunch' || config.type == 'launch') {
  9878. uni.reLaunch({
  9879. url: url
  9880. });
  9881. }
  9882. if (config.type == 'navigateBack' || config.type == 'back') {
  9883. uni.navigateBack({
  9884. delta: delta
  9885. });
  9886. }
  9887. }
  9888. }]);
  9889. return Router;
  9890. }();
  9891. var _default = new Router().route;
  9892. exports.default = _default;
  9893. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  9894. /***/ }),
  9895. /* 41 */
  9896. /*!************************************************************************************************!*\
  9897. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/@babel/runtime/regenerator/index.js ***!
  9898. \************************************************************************************************/
  9899. /*! no static exports found */
  9900. /***/ (function(module, exports, __webpack_require__) {
  9901. // TODO(Babel 8): Remove this file.
  9902. var runtime = __webpack_require__(/*! @babel/runtime/helpers/regeneratorRuntime */ 42)();
  9903. module.exports = runtime;
  9904. /***/ }),
  9905. /* 42 */
  9906. /*!*******************************************************************!*\
  9907. !*** ./node_modules/@babel/runtime/helpers/regeneratorRuntime.js ***!
  9908. \*******************************************************************/
  9909. /*! no static exports found */
  9910. /***/ (function(module, exports, __webpack_require__) {
  9911. var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
  9912. function _regeneratorRuntime() {
  9913. "use strict";
  9914. /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
  9915. module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
  9916. return exports;
  9917. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  9918. var exports = {},
  9919. Op = Object.prototype,
  9920. hasOwn = Op.hasOwnProperty,
  9921. defineProperty = Object.defineProperty || function (obj, key, desc) {
  9922. obj[key] = desc.value;
  9923. },
  9924. $Symbol = "function" == typeof Symbol ? Symbol : {},
  9925. iteratorSymbol = $Symbol.iterator || "@@iterator",
  9926. asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
  9927. toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  9928. function define(obj, key, value) {
  9929. return Object.defineProperty(obj, key, {
  9930. value: value,
  9931. enumerable: !0,
  9932. configurable: !0,
  9933. writable: !0
  9934. }), obj[key];
  9935. }
  9936. try {
  9937. define({}, "");
  9938. } catch (err) {
  9939. define = function define(obj, key, value) {
  9940. return obj[key] = value;
  9941. };
  9942. }
  9943. function wrap(innerFn, outerFn, self, tryLocsList) {
  9944. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
  9945. generator = Object.create(protoGenerator.prototype),
  9946. context = new Context(tryLocsList || []);
  9947. return defineProperty(generator, "_invoke", {
  9948. value: makeInvokeMethod(innerFn, self, context)
  9949. }), generator;
  9950. }
  9951. function tryCatch(fn, obj, arg) {
  9952. try {
  9953. return {
  9954. type: "normal",
  9955. arg: fn.call(obj, arg)
  9956. };
  9957. } catch (err) {
  9958. return {
  9959. type: "throw",
  9960. arg: err
  9961. };
  9962. }
  9963. }
  9964. exports.wrap = wrap;
  9965. var ContinueSentinel = {};
  9966. function Generator() {}
  9967. function GeneratorFunction() {}
  9968. function GeneratorFunctionPrototype() {}
  9969. var IteratorPrototype = {};
  9970. define(IteratorPrototype, iteratorSymbol, function () {
  9971. return this;
  9972. });
  9973. var getProto = Object.getPrototypeOf,
  9974. NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  9975. NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
  9976. var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
  9977. function defineIteratorMethods(prototype) {
  9978. ["next", "throw", "return"].forEach(function (method) {
  9979. define(prototype, method, function (arg) {
  9980. return this._invoke(method, arg);
  9981. });
  9982. });
  9983. }
  9984. function AsyncIterator(generator, PromiseImpl) {
  9985. function invoke(method, arg, resolve, reject) {
  9986. var record = tryCatch(generator[method], generator, arg);
  9987. if ("throw" !== record.type) {
  9988. var result = record.arg,
  9989. value = result.value;
  9990. return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
  9991. invoke("next", value, resolve, reject);
  9992. }, function (err) {
  9993. invoke("throw", err, resolve, reject);
  9994. }) : PromiseImpl.resolve(value).then(function (unwrapped) {
  9995. result.value = unwrapped, resolve(result);
  9996. }, function (error) {
  9997. return invoke("throw", error, resolve, reject);
  9998. });
  9999. }
  10000. reject(record.arg);
  10001. }
  10002. var previousPromise;
  10003. defineProperty(this, "_invoke", {
  10004. value: function value(method, arg) {
  10005. function callInvokeWithMethodAndArg() {
  10006. return new PromiseImpl(function (resolve, reject) {
  10007. invoke(method, arg, resolve, reject);
  10008. });
  10009. }
  10010. return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
  10011. }
  10012. });
  10013. }
  10014. function makeInvokeMethod(innerFn, self, context) {
  10015. var state = "suspendedStart";
  10016. return function (method, arg) {
  10017. if ("executing" === state) throw new Error("Generator is already running");
  10018. if ("completed" === state) {
  10019. if ("throw" === method) throw arg;
  10020. return doneResult();
  10021. }
  10022. for (context.method = method, context.arg = arg;;) {
  10023. var delegate = context.delegate;
  10024. if (delegate) {
  10025. var delegateResult = maybeInvokeDelegate(delegate, context);
  10026. if (delegateResult) {
  10027. if (delegateResult === ContinueSentinel) continue;
  10028. return delegateResult;
  10029. }
  10030. }
  10031. if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
  10032. if ("suspendedStart" === state) throw state = "completed", context.arg;
  10033. context.dispatchException(context.arg);
  10034. } else "return" === context.method && context.abrupt("return", context.arg);
  10035. state = "executing";
  10036. var record = tryCatch(innerFn, self, context);
  10037. if ("normal" === record.type) {
  10038. if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
  10039. return {
  10040. value: record.arg,
  10041. done: context.done
  10042. };
  10043. }
  10044. "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
  10045. }
  10046. };
  10047. }
  10048. function maybeInvokeDelegate(delegate, context) {
  10049. var methodName = context.method,
  10050. method = delegate.iterator[methodName];
  10051. if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
  10052. var record = tryCatch(method, delegate.iterator, context.arg);
  10053. if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
  10054. var info = record.arg;
  10055. return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
  10056. }
  10057. function pushTryEntry(locs) {
  10058. var entry = {
  10059. tryLoc: locs[0]
  10060. };
  10061. 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
  10062. }
  10063. function resetTryEntry(entry) {
  10064. var record = entry.completion || {};
  10065. record.type = "normal", delete record.arg, entry.completion = record;
  10066. }
  10067. function Context(tryLocsList) {
  10068. this.tryEntries = [{
  10069. tryLoc: "root"
  10070. }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
  10071. }
  10072. function values(iterable) {
  10073. if (iterable) {
  10074. var iteratorMethod = iterable[iteratorSymbol];
  10075. if (iteratorMethod) return iteratorMethod.call(iterable);
  10076. if ("function" == typeof iterable.next) return iterable;
  10077. if (!isNaN(iterable.length)) {
  10078. var i = -1,
  10079. next = function next() {
  10080. for (; ++i < iterable.length;) {
  10081. if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
  10082. }
  10083. return next.value = undefined, next.done = !0, next;
  10084. };
  10085. return next.next = next;
  10086. }
  10087. }
  10088. return {
  10089. next: doneResult
  10090. };
  10091. }
  10092. function doneResult() {
  10093. return {
  10094. value: undefined,
  10095. done: !0
  10096. };
  10097. }
  10098. return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
  10099. value: GeneratorFunctionPrototype,
  10100. configurable: !0
  10101. }), defineProperty(GeneratorFunctionPrototype, "constructor", {
  10102. value: GeneratorFunction,
  10103. configurable: !0
  10104. }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
  10105. var ctor = "function" == typeof genFun && genFun.constructor;
  10106. return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
  10107. }, exports.mark = function (genFun) {
  10108. return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
  10109. }, exports.awrap = function (arg) {
  10110. return {
  10111. __await: arg
  10112. };
  10113. }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
  10114. return this;
  10115. }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
  10116. void 0 === PromiseImpl && (PromiseImpl = Promise);
  10117. var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
  10118. return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
  10119. return result.done ? result.value : iter.next();
  10120. });
  10121. }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
  10122. return this;
  10123. }), define(Gp, "toString", function () {
  10124. return "[object Generator]";
  10125. }), exports.keys = function (val) {
  10126. var object = Object(val),
  10127. keys = [];
  10128. for (var key in object) {
  10129. keys.push(key);
  10130. }
  10131. return keys.reverse(), function next() {
  10132. for (; keys.length;) {
  10133. var key = keys.pop();
  10134. if (key in object) return next.value = key, next.done = !1, next;
  10135. }
  10136. return next.done = !0, next;
  10137. };
  10138. }, exports.values = values, Context.prototype = {
  10139. constructor: Context,
  10140. reset: function reset(skipTempReset) {
  10141. if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) {
  10142. "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
  10143. }
  10144. },
  10145. stop: function stop() {
  10146. this.done = !0;
  10147. var rootRecord = this.tryEntries[0].completion;
  10148. if ("throw" === rootRecord.type) throw rootRecord.arg;
  10149. return this.rval;
  10150. },
  10151. dispatchException: function dispatchException(exception) {
  10152. if (this.done) throw exception;
  10153. var context = this;
  10154. function handle(loc, caught) {
  10155. return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
  10156. }
  10157. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  10158. var entry = this.tryEntries[i],
  10159. record = entry.completion;
  10160. if ("root" === entry.tryLoc) return handle("end");
  10161. if (entry.tryLoc <= this.prev) {
  10162. var hasCatch = hasOwn.call(entry, "catchLoc"),
  10163. hasFinally = hasOwn.call(entry, "finallyLoc");
  10164. if (hasCatch && hasFinally) {
  10165. if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
  10166. if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
  10167. } else if (hasCatch) {
  10168. if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
  10169. } else {
  10170. if (!hasFinally) throw new Error("try statement without catch or finally");
  10171. if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
  10172. }
  10173. }
  10174. }
  10175. },
  10176. abrupt: function abrupt(type, arg) {
  10177. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  10178. var entry = this.tryEntries[i];
  10179. if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
  10180. var finallyEntry = entry;
  10181. break;
  10182. }
  10183. }
  10184. finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
  10185. var record = finallyEntry ? finallyEntry.completion : {};
  10186. return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
  10187. },
  10188. complete: function complete(record, afterLoc) {
  10189. if ("throw" === record.type) throw record.arg;
  10190. return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
  10191. },
  10192. finish: function finish(finallyLoc) {
  10193. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  10194. var entry = this.tryEntries[i];
  10195. if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
  10196. }
  10197. },
  10198. "catch": function _catch(tryLoc) {
  10199. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  10200. var entry = this.tryEntries[i];
  10201. if (entry.tryLoc === tryLoc) {
  10202. var record = entry.completion;
  10203. if ("throw" === record.type) {
  10204. var thrown = record.arg;
  10205. resetTryEntry(entry);
  10206. }
  10207. return thrown;
  10208. }
  10209. }
  10210. throw new Error("illegal catch attempt");
  10211. },
  10212. delegateYield: function delegateYield(iterable, resultName, nextLoc) {
  10213. return this.delegate = {
  10214. iterator: values(iterable),
  10215. resultName: resultName,
  10216. nextLoc: nextLoc
  10217. }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
  10218. }
  10219. }, exports;
  10220. }
  10221. module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
  10222. /***/ }),
  10223. /* 43 */
  10224. /*!*****************************************************************!*\
  10225. !*** ./node_modules/@babel/runtime/helpers/asyncToGenerator.js ***!
  10226. \*****************************************************************/
  10227. /*! no static exports found */
  10228. /***/ (function(module, exports) {
  10229. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
  10230. try {
  10231. var info = gen[key](arg);
  10232. var value = info.value;
  10233. } catch (error) {
  10234. reject(error);
  10235. return;
  10236. }
  10237. if (info.done) {
  10238. resolve(value);
  10239. } else {
  10240. Promise.resolve(value).then(_next, _throw);
  10241. }
  10242. }
  10243. function _asyncToGenerator(fn) {
  10244. return function () {
  10245. var self = this,
  10246. args = arguments;
  10247. return new Promise(function (resolve, reject) {
  10248. var gen = fn.apply(self, args);
  10249. function _next(value) {
  10250. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
  10251. }
  10252. function _throw(err) {
  10253. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
  10254. }
  10255. _next(undefined);
  10256. });
  10257. };
  10258. }
  10259. module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
  10260. /***/ }),
  10261. /* 44 */
  10262. /*!*************************************************************************************!*\
  10263. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/libs/function/timeFormat.js ***!
  10264. \*************************************************************************************/
  10265. /*! no static exports found */
  10266. /***/ (function(module, exports, __webpack_require__) {
  10267. "use strict";
  10268. Object.defineProperty(exports, "__esModule", {
  10269. value: true
  10270. });
  10271. exports.default = void 0;
  10272. // padStart 的 polyfill,因为某些机型或情况,还无法支持es7的padStart,比如电脑版的微信小程序
  10273. // 所以这里做一个兼容polyfill的兼容处理
  10274. if (!String.prototype.padStart) {
  10275. // 为了方便表示这里 fillString 用了ES6 的默认参数,不影响理解
  10276. String.prototype.padStart = function (maxLength) {
  10277. var fillString = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ' ';
  10278. if (Object.prototype.toString.call(fillString) !== "[object String]") throw new TypeError('fillString must be String');
  10279. var str = this;
  10280. // 返回 String(str) 这里是为了使返回的值是字符串字面量,在控制台中更符合直觉
  10281. if (str.length >= maxLength) return String(str);
  10282. var fillLength = maxLength - str.length,
  10283. times = Math.ceil(fillLength / fillString.length);
  10284. while (times >>= 1) {
  10285. fillString += fillString;
  10286. if (times === 1) {
  10287. fillString += fillString;
  10288. }
  10289. }
  10290. return fillString.slice(0, fillLength) + str;
  10291. };
  10292. }
  10293. // 其他更多是格式化有如下:
  10294. // yyyy:mm:dd|yyyy:mm|yyyy年mm月dd日|yyyy年mm月dd日 hh时MM分等,可自定义组合
  10295. function timeFormat() {
  10296. var dateTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  10297. var fmt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yyyy-mm-dd';
  10298. // 如果为null,则格式化当前时间
  10299. if (!dateTime) dateTime = Number(new Date());
  10300. // 如果dateTime长度为10或者13,则为秒和毫秒的时间戳,如果超过13位,则为其他的时间格式
  10301. if (dateTime.toString().length == 10) dateTime *= 1000;
  10302. var date = new Date(dateTime);
  10303. var ret;
  10304. var opt = {
  10305. "y+": date.getFullYear().toString(),
  10306. // 年
  10307. "m+": (date.getMonth() + 1).toString(),
  10308. // 月
  10309. "d+": date.getDate().toString(),
  10310. // 日
  10311. "h+": date.getHours().toString(),
  10312. // 时
  10313. "M+": date.getMinutes().toString(),
  10314. // 分
  10315. "s+": date.getSeconds().toString() // 秒
  10316. // 有其他格式化字符需求可以继续添加,必须转化成字符串
  10317. };
  10318. for (var k in opt) {
  10319. ret = new RegExp("(" + k + ")").exec(fmt);
  10320. if (ret) {
  10321. fmt = fmt.replace(ret[1], ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, "0"));
  10322. }
  10323. ;
  10324. }
  10325. ;
  10326. return fmt;
  10327. }
  10328. var _default = timeFormat;
  10329. exports.default = _default;
  10330. /***/ }),
  10331. /* 45 */
  10332. /*!***********************************************************************************!*\
  10333. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/libs/function/timeFrom.js ***!
  10334. \***********************************************************************************/
  10335. /*! no static exports found */
  10336. /***/ (function(module, exports, __webpack_require__) {
  10337. "use strict";
  10338. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  10339. Object.defineProperty(exports, "__esModule", {
  10340. value: true
  10341. });
  10342. exports.default = void 0;
  10343. var _timeFormat = _interopRequireDefault(__webpack_require__(/*! ../../libs/function/timeFormat.js */ 44));
  10344. /**
  10345. * 时间戳转为多久之前
  10346. * @param String timestamp 时间戳
  10347. * @param String | Boolean format 如果为时间格式字符串,超出一定时间范围,返回固定的时间格式;
  10348. * 如果为布尔值false,无论什么时间,都返回多久以前的格式
  10349. */
  10350. function timeFrom() {
  10351. var dateTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  10352. var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yyyy-mm-dd';
  10353. // 如果为null,则格式化当前时间
  10354. if (!dateTime) dateTime = Number(new Date());
  10355. // 如果dateTime长度为10或者13,则为秒和毫秒的时间戳,如果超过13位,则为其他的时间格式
  10356. if (dateTime.toString().length == 10) dateTime *= 1000;
  10357. var timestamp = +new Date(Number(dateTime));
  10358. var timer = (Number(new Date()) - timestamp) / 1000;
  10359. // 如果小于5分钟,则返回"刚刚",其他以此类推
  10360. var tips = '';
  10361. switch (true) {
  10362. case timer < 300:
  10363. tips = '刚刚';
  10364. break;
  10365. case timer >= 300 && timer < 3600:
  10366. tips = parseInt(timer / 60) + '分钟前';
  10367. break;
  10368. case timer >= 3600 && timer < 86400:
  10369. tips = parseInt(timer / 3600) + '小时前';
  10370. break;
  10371. case timer >= 86400 && timer < 2592000:
  10372. tips = parseInt(timer / 86400) + '天前';
  10373. break;
  10374. default:
  10375. // 如果format为false,则无论什么时间戳,都显示xx之前
  10376. if (format === false) {
  10377. if (timer >= 2592000 && timer < 365 * 86400) {
  10378. tips = parseInt(timer / (86400 * 30)) + '个月前';
  10379. } else {
  10380. tips = parseInt(timer / (86400 * 365)) + '年前';
  10381. }
  10382. } else {
  10383. tips = (0, _timeFormat.default)(timestamp, format);
  10384. }
  10385. }
  10386. return tips;
  10387. }
  10388. var _default = timeFrom;
  10389. exports.default = _default;
  10390. /***/ }),
  10391. /* 46 */
  10392. /*!****************************************************************************************!*\
  10393. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/libs/function/colorGradient.js ***!
  10394. \****************************************************************************************/
  10395. /*! no static exports found */
  10396. /***/ (function(module, exports, __webpack_require__) {
  10397. "use strict";
  10398. Object.defineProperty(exports, "__esModule", {
  10399. value: true
  10400. });
  10401. exports.default = void 0;
  10402. /**
  10403. * 求两个颜色之间的渐变值
  10404. * @param {string} startColor 开始的颜色
  10405. * @param {string} endColor 结束的颜色
  10406. * @param {number} step 颜色等分的份额
  10407. * */
  10408. function colorGradient() {
  10409. var startColor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'rgb(0, 0, 0)';
  10410. var endColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'rgb(255, 255, 255)';
  10411. var step = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10;
  10412. var startRGB = hexToRgb(startColor, false); //转换为rgb数组模式
  10413. var startR = startRGB[0];
  10414. var startG = startRGB[1];
  10415. var startB = startRGB[2];
  10416. var endRGB = hexToRgb(endColor, false);
  10417. var endR = endRGB[0];
  10418. var endG = endRGB[1];
  10419. var endB = endRGB[2];
  10420. var sR = (endR - startR) / step; //总差值
  10421. var sG = (endG - startG) / step;
  10422. var sB = (endB - startB) / step;
  10423. var colorArr = [];
  10424. for (var i = 0; i < step; i++) {
  10425. //计算每一步的hex值
  10426. var hex = rgbToHex('rgb(' + Math.round(sR * i + startR) + ',' + Math.round(sG * i + startG) + ',' + Math.round(sB * i + startB) + ')');
  10427. colorArr.push(hex);
  10428. }
  10429. return colorArr;
  10430. }
  10431. // 将hex表示方式转换为rgb表示方式(这里返回rgb数组模式)
  10432. function hexToRgb(sColor) {
  10433. var str = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  10434. var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
  10435. sColor = sColor.toLowerCase();
  10436. if (sColor && reg.test(sColor)) {
  10437. if (sColor.length === 4) {
  10438. var sColorNew = "#";
  10439. for (var i = 1; i < 4; i += 1) {
  10440. sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));
  10441. }
  10442. sColor = sColorNew;
  10443. }
  10444. //处理六位的颜色值
  10445. var sColorChange = [];
  10446. for (var _i = 1; _i < 7; _i += 2) {
  10447. sColorChange.push(parseInt("0x" + sColor.slice(_i, _i + 2)));
  10448. }
  10449. if (!str) {
  10450. return sColorChange;
  10451. } else {
  10452. return "rgb(".concat(sColorChange[0], ",").concat(sColorChange[1], ",").concat(sColorChange[2], ")");
  10453. }
  10454. } else if (/^(rgb|RGB)/.test(sColor)) {
  10455. var arr = sColor.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(",");
  10456. return arr.map(function (val) {
  10457. return Number(val);
  10458. });
  10459. } else {
  10460. return sColor;
  10461. }
  10462. }
  10463. ;
  10464. // 将rgb表示方式转换为hex表示方式
  10465. function rgbToHex(rgb) {
  10466. var _this = rgb;
  10467. var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
  10468. if (/^(rgb|RGB)/.test(_this)) {
  10469. var aColor = _this.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(",");
  10470. var strHex = "#";
  10471. for (var i = 0; i < aColor.length; i++) {
  10472. var hex = Number(aColor[i]).toString(16);
  10473. hex = String(hex).length == 1 ? 0 + '' + hex : hex; // 保证每个rgb的值为2位
  10474. if (hex === "0") {
  10475. hex += hex;
  10476. }
  10477. strHex += hex;
  10478. }
  10479. if (strHex.length !== 7) {
  10480. strHex = _this;
  10481. }
  10482. return strHex;
  10483. } else if (reg.test(_this)) {
  10484. var aNum = _this.replace(/#/, "").split("");
  10485. if (aNum.length === 6) {
  10486. return _this;
  10487. } else if (aNum.length === 3) {
  10488. var numHex = "#";
  10489. for (var _i2 = 0; _i2 < aNum.length; _i2 += 1) {
  10490. numHex += aNum[_i2] + aNum[_i2];
  10491. }
  10492. return numHex;
  10493. }
  10494. } else {
  10495. return _this;
  10496. }
  10497. }
  10498. /**
  10499. * JS颜色十六进制转换为rgb或rgba,返回的格式为 rgba(255,255,255,0.5)字符串
  10500. * sHex为传入的十六进制的色值
  10501. * alpha为rgba的透明度
  10502. */
  10503. function colorToRgba(color) {
  10504. var alpha = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.3;
  10505. color = rgbToHex(color);
  10506. // 十六进制颜色值的正则表达式
  10507. var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
  10508. /* 16进制颜色转为RGB格式 */
  10509. var sColor = color.toLowerCase();
  10510. if (sColor && reg.test(sColor)) {
  10511. if (sColor.length === 4) {
  10512. var sColorNew = '#';
  10513. for (var i = 1; i < 4; i += 1) {
  10514. sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));
  10515. }
  10516. sColor = sColorNew;
  10517. }
  10518. // 处理六位的颜色值
  10519. var sColorChange = [];
  10520. for (var _i3 = 1; _i3 < 7; _i3 += 2) {
  10521. sColorChange.push(parseInt('0x' + sColor.slice(_i3, _i3 + 2)));
  10522. }
  10523. // return sColorChange.join(',')
  10524. return 'rgba(' + sColorChange.join(',') + ',' + alpha + ')';
  10525. } else {
  10526. return sColor;
  10527. }
  10528. }
  10529. var _default = {
  10530. colorGradient: colorGradient,
  10531. hexToRgb: hexToRgb,
  10532. rgbToHex: rgbToHex,
  10533. colorToRgba: colorToRgba
  10534. };
  10535. exports.default = _default;
  10536. /***/ }),
  10537. /* 47 */
  10538. /*!*******************************************************************************!*\
  10539. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/libs/function/guid.js ***!
  10540. \*******************************************************************************/
  10541. /*! no static exports found */
  10542. /***/ (function(module, exports, __webpack_require__) {
  10543. "use strict";
  10544. Object.defineProperty(exports, "__esModule", {
  10545. value: true
  10546. });
  10547. exports.default = void 0;
  10548. /**
  10549. * 本算法来源于简书开源代码,详见:https://www.jianshu.com/p/fdbf293d0a85
  10550. * 全局唯一标识符(uuid,Globally Unique Identifier),也称作 uuid(Universally Unique IDentifier)
  10551. * 一般用于多个组件之间,给它一个唯一的标识符,或者v-for循环的时候,如果使用数组的index可能会导致更新列表出现问题
  10552. * 最可能的情况是左滑删除item或者对某条信息流"不喜欢"并去掉它的时候,会导致组件内的数据可能出现错乱
  10553. * v-for的时候,推荐使用后端返回的id而不是循环的index
  10554. * @param {Number} len uuid的长度
  10555. * @param {Boolean} firstU 将返回的首字母置为"u"
  10556. * @param {Number} radix 生成uuid的基数(意味着返回的字符串都是这个基数),2-二进制,8-八进制,10-十进制,16-十六进制
  10557. */
  10558. function guid() {
  10559. var len = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 32;
  10560. var firstU = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  10561. var radix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  10562. var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
  10563. var uuid = [];
  10564. radix = radix || chars.length;
  10565. if (len) {
  10566. // 如果指定uuid长度,只是取随机的字符,0|x为位运算,能去掉x的小数位,返回整数位
  10567. for (var i = 0; i < len; i++) {
  10568. uuid[i] = chars[0 | Math.random() * radix];
  10569. }
  10570. } else {
  10571. var r;
  10572. // rfc4122标准要求返回的uuid中,某些位为固定的字符
  10573. uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
  10574. uuid[14] = '4';
  10575. for (var _i = 0; _i < 36; _i++) {
  10576. if (!uuid[_i]) {
  10577. r = 0 | Math.random() * 16;
  10578. uuid[_i] = chars[_i == 19 ? r & 0x3 | 0x8 : r];
  10579. }
  10580. }
  10581. }
  10582. // 移除第一个字符,并用u替代,因为第一个字符为数值时,该guid不能用作id或者class
  10583. if (firstU) {
  10584. uuid.shift();
  10585. return 'u' + uuid.join('');
  10586. } else {
  10587. return uuid.join('');
  10588. }
  10589. }
  10590. var _default = guid;
  10591. exports.default = _default;
  10592. /***/ }),
  10593. /* 48 */
  10594. /*!********************************************************************************!*\
  10595. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/libs/function/color.js ***!
  10596. \********************************************************************************/
  10597. /*! no static exports found */
  10598. /***/ (function(module, exports, __webpack_require__) {
  10599. "use strict";
  10600. Object.defineProperty(exports, "__esModule", {
  10601. value: true
  10602. });
  10603. exports.default = void 0;
  10604. // 为了让用户能够自定义主题,会逐步弃用此文件,各颜色通过css提供
  10605. // 为了给某些特殊场景使用和向后兼容,无需删除此文件(2020-06-20)
  10606. var color = {
  10607. primary: "#2979ff",
  10608. primaryDark: "#2b85e4",
  10609. primaryDisabled: "#a0cfff",
  10610. primaryLight: "#ecf5ff",
  10611. bgColor: "#f3f4f6",
  10612. info: "#909399",
  10613. infoDark: "#82848a",
  10614. infoDisabled: "#c8c9cc",
  10615. infoLight: "#f4f4f5",
  10616. warning: "#ff9900",
  10617. warningDark: "#f29100",
  10618. warningDisabled: "#fcbd71",
  10619. warningLight: "#fdf6ec",
  10620. error: "#fa3534",
  10621. errorDark: "#dd6161",
  10622. errorDisabled: "#fab6b6",
  10623. errorLight: "#fef0f0",
  10624. success: "#19be6b",
  10625. successDark: "#18b566",
  10626. successDisabled: "#71d5a1",
  10627. successLight: "#dbf1e1",
  10628. mainColor: "#303133",
  10629. contentColor: "#606266",
  10630. tipsColor: "#909399",
  10631. lightColor: "#c0c4cc",
  10632. borderColor: "#e4e7ed"
  10633. };
  10634. var _default = color;
  10635. exports.default = _default;
  10636. /***/ }),
  10637. /* 49 */
  10638. /*!************************************************************************************!*\
  10639. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/libs/function/type2icon.js ***!
  10640. \************************************************************************************/
  10641. /*! no static exports found */
  10642. /***/ (function(module, exports, __webpack_require__) {
  10643. "use strict";
  10644. Object.defineProperty(exports, "__esModule", {
  10645. value: true
  10646. });
  10647. exports.default = void 0;
  10648. /**
  10649. * 根据主题type值,获取对应的图标
  10650. * @param String type 主题名称,primary|info|error|warning|success
  10651. * @param String fill 是否使用fill填充实体的图标
  10652. */
  10653. function type2icon() {
  10654. var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'success';
  10655. var fill = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  10656. // 如果非预置值,默认为success
  10657. if (['primary', 'info', 'error', 'warning', 'success'].indexOf(type) == -1) type = 'success';
  10658. var iconName = '';
  10659. // 目前(2019-12-12),info和primary使用同一个图标
  10660. switch (type) {
  10661. case 'primary':
  10662. iconName = 'info-circle';
  10663. break;
  10664. case 'info':
  10665. iconName = 'info-circle';
  10666. break;
  10667. case 'error':
  10668. iconName = 'close-circle';
  10669. break;
  10670. case 'warning':
  10671. iconName = 'error-circle';
  10672. break;
  10673. case 'success':
  10674. iconName = 'checkmark-circle';
  10675. break;
  10676. default:
  10677. iconName = 'checkmark-circle';
  10678. }
  10679. // 是否是实体类型,加上-fill,在icon组件库中,实体的类名是后面加-fill的
  10680. if (fill) iconName += '-fill';
  10681. return iconName;
  10682. }
  10683. var _default = type2icon;
  10684. exports.default = _default;
  10685. /***/ }),
  10686. /* 50 */
  10687. /*!**************************************************************************************!*\
  10688. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/libs/function/randomArray.js ***!
  10689. \**************************************************************************************/
  10690. /*! no static exports found */
  10691. /***/ (function(module, exports, __webpack_require__) {
  10692. "use strict";
  10693. Object.defineProperty(exports, "__esModule", {
  10694. value: true
  10695. });
  10696. exports.default = void 0;
  10697. // 打乱数组
  10698. function randomArray() {
  10699. var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  10700. // 原理是sort排序,Math.random()产生0<= x < 1之间的数,会导致x-0.05大于或者小于0
  10701. return array.sort(function () {
  10702. return Math.random() - 0.5;
  10703. });
  10704. }
  10705. var _default = randomArray;
  10706. exports.default = _default;
  10707. /***/ }),
  10708. /* 51 */
  10709. /*!**********************************************************************************!*\
  10710. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/libs/function/addUnit.js ***!
  10711. \**********************************************************************************/
  10712. /*! no static exports found */
  10713. /***/ (function(module, exports, __webpack_require__) {
  10714. "use strict";
  10715. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  10716. Object.defineProperty(exports, "__esModule", {
  10717. value: true
  10718. });
  10719. exports.default = addUnit;
  10720. var _test = _interopRequireDefault(__webpack_require__(/*! ./test.js */ 38));
  10721. // 添加单位,如果有rpx,%,px等单位结尾或者值为auto,直接返回,否则加上rpx单位结尾
  10722. function addUnit() {
  10723. var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'auto';
  10724. var unit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'rpx';
  10725. value = String(value);
  10726. // 用uView内置验证规则中的number判断是否为数值
  10727. return _test.default.number(value) ? "".concat(value).concat(unit) : value;
  10728. }
  10729. /***/ }),
  10730. /* 52 */
  10731. /*!*********************************************************************************!*\
  10732. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/libs/function/random.js ***!
  10733. \*********************************************************************************/
  10734. /*! no static exports found */
  10735. /***/ (function(module, exports, __webpack_require__) {
  10736. "use strict";
  10737. Object.defineProperty(exports, "__esModule", {
  10738. value: true
  10739. });
  10740. exports.default = void 0;
  10741. function random(min, max) {
  10742. if (min >= 0 && max > 0 && max >= min) {
  10743. var gab = max - min + 1;
  10744. return Math.floor(Math.random() * gab + min);
  10745. } else {
  10746. return 0;
  10747. }
  10748. }
  10749. var _default = random;
  10750. exports.default = _default;
  10751. /***/ }),
  10752. /* 53 */
  10753. /*!*******************************************************************************!*\
  10754. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/libs/function/trim.js ***!
  10755. \*******************************************************************************/
  10756. /*! no static exports found */
  10757. /***/ (function(module, exports, __webpack_require__) {
  10758. "use strict";
  10759. Object.defineProperty(exports, "__esModule", {
  10760. value: true
  10761. });
  10762. exports.default = void 0;
  10763. function trim(str) {
  10764. var pos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'both';
  10765. if (pos == 'both') {
  10766. return str.replace(/^\s+|\s+$/g, "");
  10767. } else if (pos == "left") {
  10768. return str.replace(/^\s*/, '');
  10769. } else if (pos == 'right') {
  10770. return str.replace(/(\s*$)/g, "");
  10771. } else if (pos == 'all') {
  10772. return str.replace(/\s+/g, "");
  10773. } else {
  10774. return str;
  10775. }
  10776. }
  10777. var _default = trim;
  10778. exports.default = _default;
  10779. /***/ }),
  10780. /* 54 */
  10781. /*!********************************************************************************!*\
  10782. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/libs/function/toast.js ***!
  10783. \********************************************************************************/
  10784. /*! no static exports found */
  10785. /***/ (function(module, exports, __webpack_require__) {
  10786. "use strict";
  10787. /* WEBPACK VAR INJECTION */(function(uni) {
  10788. Object.defineProperty(exports, "__esModule", {
  10789. value: true
  10790. });
  10791. exports.default = void 0;
  10792. function toast(title) {
  10793. var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1500;
  10794. uni.showToast({
  10795. title: title,
  10796. icon: 'none',
  10797. duration: duration
  10798. });
  10799. }
  10800. var _default = toast;
  10801. exports.default = _default;
  10802. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  10803. /***/ }),
  10804. /* 55 */
  10805. /*!************************************************************************************!*\
  10806. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/libs/function/getParent.js ***!
  10807. \************************************************************************************/
  10808. /*! no static exports found */
  10809. /***/ (function(module, exports, __webpack_require__) {
  10810. "use strict";
  10811. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  10812. Object.defineProperty(exports, "__esModule", {
  10813. value: true
  10814. });
  10815. exports.default = getParent;
  10816. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  10817. // 获取父组件的参数,因为支付宝小程序不支持provide/inject的写法
  10818. // this.$parent在非H5中,可以准确获取到父组件,但是在H5中,需要多次this.$parent.$parent.xxx
  10819. function getParent(name, keys) {
  10820. var parent = this.$parent;
  10821. // 通过while历遍,这里主要是为了H5需要多层解析的问题
  10822. while (parent) {
  10823. // 父组件
  10824. if (parent.$options.name !== name) {
  10825. // 如果组件的name不相等,继续上一级寻找
  10826. parent = parent.$parent;
  10827. } else {
  10828. var _ret = function () {
  10829. var data = {};
  10830. // 判断keys是否数组,如果传过来的是一个数组,那么直接使用数组元素值当做键值去父组件寻找
  10831. if (Array.isArray(keys)) {
  10832. keys.map(function (val) {
  10833. data[val] = parent[val] ? parent[val] : '';
  10834. });
  10835. } else {
  10836. // 历遍传过来的对象参数
  10837. for (var i in keys) {
  10838. // 如果子组件有此值则用,无此值则用父组件的值
  10839. // 判断是否空数组,如果是,则用父组件的值,否则用子组件的值
  10840. if (Array.isArray(keys[i])) {
  10841. if (keys[i].length) {
  10842. data[i] = keys[i];
  10843. } else {
  10844. data[i] = parent[i];
  10845. }
  10846. } else if (keys[i].constructor === Object) {
  10847. // 判断是否对象,如果是对象,且有属性,那么使用子组件的值,否则使用父组件的值
  10848. if (Object.keys(keys[i]).length) {
  10849. data[i] = keys[i];
  10850. } else {
  10851. data[i] = parent[i];
  10852. }
  10853. } else {
  10854. // 只要子组件有传值,即使是false值,也是“传值”了,也需要覆盖父组件的同名参数
  10855. data[i] = keys[i] || keys[i] === false ? keys[i] : parent[i];
  10856. }
  10857. }
  10858. }
  10859. return {
  10860. v: data
  10861. };
  10862. }();
  10863. if ((0, _typeof2.default)(_ret) === "object") return _ret.v;
  10864. }
  10865. }
  10866. return {};
  10867. }
  10868. /***/ }),
  10869. /* 56 */
  10870. /*!**********************************************************************************!*\
  10871. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/libs/function/$parent.js ***!
  10872. \**********************************************************************************/
  10873. /*! no static exports found */
  10874. /***/ (function(module, exports, __webpack_require__) {
  10875. "use strict";
  10876. Object.defineProperty(exports, "__esModule", {
  10877. value: true
  10878. });
  10879. exports.default = $parent;
  10880. // 获取父组件的参数,因为支付宝小程序不支持provide/inject的写法
  10881. // this.$parent在非H5中,可以准确获取到父组件,但是在H5中,需要多次this.$parent.$parent.xxx
  10882. // 这里默认值等于undefined有它的含义,因为最顶层元素(组件)的$parent就是undefined,意味着不传name
  10883. // 值(默认为undefined),就是查找最顶层的$parent
  10884. function $parent() {
  10885. var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
  10886. var parent = this.$parent;
  10887. // 通过while历遍,这里主要是为了H5需要多层解析的问题
  10888. while (parent) {
  10889. // 父组件
  10890. if (parent.$options && parent.$options.name !== name) {
  10891. // 如果组件的name不相等,继续上一级寻找
  10892. parent = parent.$parent;
  10893. } else {
  10894. return parent;
  10895. }
  10896. }
  10897. return false;
  10898. }
  10899. /***/ }),
  10900. /* 57 */
  10901. /*!******************************************************************************!*\
  10902. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/libs/function/sys.js ***!
  10903. \******************************************************************************/
  10904. /*! no static exports found */
  10905. /***/ (function(module, exports, __webpack_require__) {
  10906. "use strict";
  10907. /* WEBPACK VAR INJECTION */(function(uni) {
  10908. Object.defineProperty(exports, "__esModule", {
  10909. value: true
  10910. });
  10911. exports.os = os;
  10912. exports.sys = sys;
  10913. function os() {
  10914. return uni.getSystemInfoSync().platform;
  10915. }
  10916. ;
  10917. function sys() {
  10918. return uni.getSystemInfoSync();
  10919. }
  10920. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  10921. /***/ }),
  10922. /* 58 */
  10923. /*!***********************************************************************************!*\
  10924. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/libs/function/debounce.js ***!
  10925. \***********************************************************************************/
  10926. /*! no static exports found */
  10927. /***/ (function(module, exports, __webpack_require__) {
  10928. "use strict";
  10929. Object.defineProperty(exports, "__esModule", {
  10930. value: true
  10931. });
  10932. exports.default = void 0;
  10933. var timeout = null;
  10934. /**
  10935. * 防抖原理:一定时间内,只有最后一次操作,再过wait毫秒后才执行函数
  10936. *
  10937. * @param {Function} func 要执行的回调函数
  10938. * @param {Number} wait 延时的时间
  10939. * @param {Boolean} immediate 是否立即执行
  10940. * @return null
  10941. */
  10942. function debounce(func) {
  10943. var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
  10944. var immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  10945. // 清除定时器
  10946. if (timeout !== null) clearTimeout(timeout);
  10947. // 立即执行,此类情况一般用不到
  10948. if (immediate) {
  10949. var callNow = !timeout;
  10950. timeout = setTimeout(function () {
  10951. timeout = null;
  10952. }, wait);
  10953. if (callNow) typeof func === 'function' && func();
  10954. } else {
  10955. // 设置定时器,当最后一次操作后,timeout不会再被清除,所以在延时wait毫秒后执行func回调方法
  10956. timeout = setTimeout(function () {
  10957. typeof func === 'function' && func();
  10958. }, wait);
  10959. }
  10960. }
  10961. var _default = debounce;
  10962. exports.default = _default;
  10963. /***/ }),
  10964. /* 59 */
  10965. /*!***********************************************************************************!*\
  10966. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/libs/function/throttle.js ***!
  10967. \***********************************************************************************/
  10968. /*! no static exports found */
  10969. /***/ (function(module, exports, __webpack_require__) {
  10970. "use strict";
  10971. Object.defineProperty(exports, "__esModule", {
  10972. value: true
  10973. });
  10974. exports.default = void 0;
  10975. var timer, flag;
  10976. /**
  10977. * 节流原理:在一定时间内,只能触发一次
  10978. *
  10979. * @param {Function} func 要执行的回调函数
  10980. * @param {Number} wait 延时的时间
  10981. * @param {Boolean} immediate 是否立即执行
  10982. * @return null
  10983. */
  10984. function throttle(func) {
  10985. var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
  10986. var immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  10987. if (immediate) {
  10988. if (!flag) {
  10989. flag = true;
  10990. // 如果是立即执行,则在wait毫秒内开始时执行
  10991. typeof func === 'function' && func();
  10992. timer = setTimeout(function () {
  10993. flag = false;
  10994. }, wait);
  10995. }
  10996. } else {
  10997. if (!flag) {
  10998. flag = true;
  10999. // 如果是非立即执行,则在wait毫秒内的结束处执行
  11000. timer = setTimeout(function () {
  11001. flag = false;
  11002. typeof func === 'function' && func();
  11003. }, wait);
  11004. }
  11005. }
  11006. }
  11007. ;
  11008. var _default = throttle;
  11009. exports.default = _default;
  11010. /***/ }),
  11011. /* 60 */
  11012. /*!*******************************************************************************!*\
  11013. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/libs/config/config.js ***!
  11014. \*******************************************************************************/
  11015. /*! no static exports found */
  11016. /***/ (function(module, exports, __webpack_require__) {
  11017. "use strict";
  11018. Object.defineProperty(exports, "__esModule", {
  11019. value: true
  11020. });
  11021. exports.default = void 0;
  11022. // 此版本发布于2022-04-19
  11023. var version = '1.8.6';
  11024. var _default = {
  11025. v: version,
  11026. version: version,
  11027. // 主题名称
  11028. type: ['primary', 'success', 'info', 'error', 'warning']
  11029. };
  11030. exports.default = _default;
  11031. /***/ }),
  11032. /* 61 */
  11033. /*!*******************************************************************************!*\
  11034. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uview-ui/libs/config/zIndex.js ***!
  11035. \*******************************************************************************/
  11036. /*! no static exports found */
  11037. /***/ (function(module, exports, __webpack_require__) {
  11038. "use strict";
  11039. Object.defineProperty(exports, "__esModule", {
  11040. value: true
  11041. });
  11042. exports.default = void 0;
  11043. // uniapp在H5中各API的z-index值如下:
  11044. /**
  11045. * actionsheet: 999
  11046. * modal: 999
  11047. * navigate: 998
  11048. * tabbar: 998
  11049. * toast: 999
  11050. */
  11051. var _default = {
  11052. toast: 10090,
  11053. noNetwork: 10080,
  11054. // popup包含popup,actionsheet,keyboard,picker的值
  11055. popup: 10075,
  11056. mask: 10070,
  11057. navbar: 980,
  11058. topTips: 975,
  11059. sticky: 970,
  11060. indexListSticky: 965
  11061. };
  11062. exports.default = _default;
  11063. /***/ }),
  11064. /* 62 */
  11065. /*!*************************************************************************!*\
  11066. !*** C:/Users/Administrator/Desktop/yswc/tiyu/uni.promisify.adaptor.js ***!
  11067. \*************************************************************************/
  11068. /*! no static exports found */
  11069. /***/ (function(module, exports, __webpack_require__) {
  11070. /* WEBPACK VAR INJECTION */(function(uni) {var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ 13);
  11071. uni.addInterceptor({
  11072. returnValue: function returnValue(res) {
  11073. if (!(!!res && (_typeof(res) === "object" || typeof res === "function") && typeof res.then === "function")) {
  11074. return res;
  11075. }
  11076. return new Promise(function (resolve, reject) {
  11077. res.then(function (res) {
  11078. return res[0] ? reject(res[0]) : resolve(res[1]);
  11079. });
  11080. });
  11081. }
  11082. });
  11083. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  11084. /***/ }),
  11085. /* 63 */
  11086. /*!***************************************************************************!*\
  11087. !*** C:/Users/Administrator/Desktop/yswc/tiyu/common/http.interceptor.js ***!
  11088. \***************************************************************************/
  11089. /*! no static exports found */
  11090. /***/ (function(module, exports, __webpack_require__) {
  11091. "use strict";
  11092. /* WEBPACK VAR INJECTION */(function(uni) {
  11093. Object.defineProperty(exports, "__esModule", {
  11094. value: true
  11095. });
  11096. exports.default = void 0;
  11097. var install = function install(Vue, vm) {
  11098. Vue.prototype.$u.http.setConfig({
  11099. baseUrl: Vue.prototype.$url,
  11100. // 请求的本域名
  11101. loadingText: '加载中...',
  11102. loadingTime: 800,
  11103. showLoading: true,
  11104. // 是否显示请求中的loading
  11105. loadingMask: true,
  11106. // 展示loading的时候,是否给一个透明的蒙层,防止触摸穿透
  11107. originalData: true,
  11108. // 是否在拦截器中返回服务端的原始数据
  11109. // 配置请求头信息
  11110. header: {}
  11111. });
  11112. // 请求拦截部分,如配置,每次请求前都会执行
  11113. Vue.prototype.$u.http.interceptor.request = function (config) {
  11114. // 引用token
  11115. // 方式一,存放在vuex的token,假设使用了uView封装的vuex方式
  11116. // 见:https://uviewui.com/components/globalVariable.html
  11117. // config.header.token = vm.token;
  11118. // 方式二,如果没有使用uView封装的vuex方法,那么需要使用$store.state获取
  11119. // config.header.token = vm.$store.state.token;
  11120. // 方式三,如果token放在了globalData,通过getApp().globalData获取
  11121. // config.header.token = getApp().globalData.username;
  11122. // 方式四,如果token放在了Storage本地存储中,拦截是每次请求都执行的
  11123. // 所以哪怕您重新登录修改了Storage,下一次的请求将会是最新值
  11124. var token = uni.getStorageSync('token');
  11125. config.header.token = token;
  11126. // 可以对某个url进行特别处理,此url参数为this.$u.get(url)中的url值
  11127. // if(config.url == '/user/login') config.header.noToken = true;
  11128. // 最后需要将config进行return
  11129. return config;
  11130. // 如果return一个false值,则会取消本次请求
  11131. // if(config.url == '/user/rest') return false; // 取消某次请求
  11132. };
  11133. // 响应拦截,如配置,每次请求结束都会执行本方法
  11134. Vue.prototype.$u.http.interceptor.response = function (res) {
  11135. if (res.statusCode == 200) {
  11136. // res为服务端返回值,可能有code,result等字段
  11137. // 这里对res.result进行返回,将会在this.$u.post(url).then(res => {})的then回调中的res的到
  11138. // 如果配置了originalData为true,请留意这里的返回值
  11139. return res.data;
  11140. } else {
  11141. // 假设201为token失效,这里跳转登录
  11142. if (res.statusCode == 500) {
  11143. var title = '';
  11144. var title1 = '';
  11145. var html = res.data;
  11146. var start = html.indexOf('<h1>');
  11147. var end = html.indexOf('</h1>');
  11148. title = html.substring(start + 4, end);
  11149. var start1 = html.indexOf('</abbr> in <a class="toggle" title=');
  11150. var end1 = html.indexOf('</a></h2>');
  11151. title1 = html.substring(start1 + 35, end1);
  11152. if (title1 && title) {
  11153. uni.showModal({
  11154. title: "\u7F51\u7EDC\u9519\u8BEF\uFF1A".concat(res.statusCode),
  11155. content: "\u4F4D\u7F6E\uFF1A".concat(title1, "\r\n \u6807\u9898\uFF1A").concat(title)
  11156. });
  11157. } else {
  11158. uni.showModal({
  11159. title: "\u7F51\u7EDC\u9519\u8BEF\uFF1A".concat(res.statusCode)
  11160. });
  11161. }
  11162. } else {
  11163. // uni.showModal({
  11164. // content: `未知错误:${res.statusCode}`
  11165. // })
  11166. }
  11167. return false;
  11168. }
  11169. };
  11170. };
  11171. var _default = {
  11172. install: install
  11173. };
  11174. exports.default = _default;
  11175. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  11176. /***/ })
  11177. ]]);
  11178. //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map