vendor.js 270 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791
  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. /* 3 */,
  44. /* 4 */
  45. /*!************************************************************!*\
  46. !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js ***!
  47. \************************************************************/
  48. /*! no static exports found */
  49. /***/ (function(module, exports, __webpack_require__) {
  50. "use strict";
  51. /* WEBPACK VAR INJECTION */(function(wx, global) {
  52. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 6);
  53. Object.defineProperty(exports, "__esModule", {
  54. value: true
  55. });
  56. exports.createApp = createApp;
  57. exports.createComponent = createComponent;
  58. exports.createPage = createPage;
  59. exports.createPlugin = createPlugin;
  60. exports.createSubpackageApp = createSubpackageApp;
  61. exports.default = void 0;
  62. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 7));
  63. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 13));
  64. var _construct2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/construct */ 17));
  65. var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ 20));
  66. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 15));
  67. var _uniI18n = __webpack_require__(/*! @dcloudio/uni-i18n */ 24);
  68. var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 27));
  69. 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; }
  70. 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; }
  71. var realAtob;
  72. var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  73. var b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
  74. if (typeof atob !== 'function') {
  75. realAtob = function realAtob(str) {
  76. str = String(str).replace(/[\t\n\f\r ]+/g, '');
  77. if (!b64re.test(str)) {
  78. throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
  79. }
  80. // Adding the padding if missing, for semplicity
  81. str += '=='.slice(2 - (str.length & 3));
  82. var bitmap;
  83. var result = '';
  84. var r1;
  85. var r2;
  86. var i = 0;
  87. for (; i < str.length;) {
  88. 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++)));
  89. 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);
  90. }
  91. return result;
  92. };
  93. } else {
  94. // 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法
  95. realAtob = atob;
  96. }
  97. function b64DecodeUnicode(str) {
  98. return decodeURIComponent(realAtob(str).split('').map(function (c) {
  99. return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
  100. }).join(''));
  101. }
  102. function getCurrentUserInfo() {
  103. var token = wx.getStorageSync('uni_id_token') || '';
  104. var tokenArr = token.split('.');
  105. if (!token || tokenArr.length !== 3) {
  106. return {
  107. uid: null,
  108. role: [],
  109. permission: [],
  110. tokenExpired: 0
  111. };
  112. }
  113. var userInfo;
  114. try {
  115. userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
  116. } catch (error) {
  117. throw new Error('获取当前用户信息出错,详细错误信息为:' + error.message);
  118. }
  119. userInfo.tokenExpired = userInfo.exp * 1000;
  120. delete userInfo.exp;
  121. delete userInfo.iat;
  122. return userInfo;
  123. }
  124. function uniIdMixin(Vue) {
  125. Vue.prototype.uniIDHasRole = function (roleId) {
  126. var _getCurrentUserInfo = getCurrentUserInfo(),
  127. role = _getCurrentUserInfo.role;
  128. return role.indexOf(roleId) > -1;
  129. };
  130. Vue.prototype.uniIDHasPermission = function (permissionId) {
  131. var _getCurrentUserInfo2 = getCurrentUserInfo(),
  132. permission = _getCurrentUserInfo2.permission;
  133. return this.uniIDHasRole('admin') || permission.indexOf(permissionId) > -1;
  134. };
  135. Vue.prototype.uniIDTokenValid = function () {
  136. var _getCurrentUserInfo3 = getCurrentUserInfo(),
  137. tokenExpired = _getCurrentUserInfo3.tokenExpired;
  138. return tokenExpired > Date.now();
  139. };
  140. }
  141. var _toString = Object.prototype.toString;
  142. var hasOwnProperty = Object.prototype.hasOwnProperty;
  143. function isFn(fn) {
  144. return typeof fn === 'function';
  145. }
  146. function isStr(str) {
  147. return typeof str === 'string';
  148. }
  149. function isObject(obj) {
  150. return obj !== null && (0, _typeof2.default)(obj) === 'object';
  151. }
  152. function isPlainObject(obj) {
  153. return _toString.call(obj) === '[object Object]';
  154. }
  155. function hasOwn(obj, key) {
  156. return hasOwnProperty.call(obj, key);
  157. }
  158. function noop() {}
  159. /**
  160. * Create a cached version of a pure function.
  161. */
  162. function cached(fn) {
  163. var cache = Object.create(null);
  164. return function cachedFn(str) {
  165. var hit = cache[str];
  166. return hit || (cache[str] = fn(str));
  167. };
  168. }
  169. /**
  170. * Camelize a hyphen-delimited string.
  171. */
  172. var camelizeRE = /-(\w)/g;
  173. var camelize = cached(function (str) {
  174. return str.replace(camelizeRE, function (_, c) {
  175. return c ? c.toUpperCase() : '';
  176. });
  177. });
  178. function sortObject(obj) {
  179. var sortObj = {};
  180. if (isPlainObject(obj)) {
  181. Object.keys(obj).sort().forEach(function (key) {
  182. sortObj[key] = obj[key];
  183. });
  184. }
  185. return !Object.keys(sortObj) ? obj : sortObj;
  186. }
  187. var HOOKS = ['invoke', 'success', 'fail', 'complete', 'returnValue'];
  188. var globalInterceptors = {};
  189. var scopedInterceptors = {};
  190. function mergeHook(parentVal, childVal) {
  191. var res = childVal ? parentVal ? parentVal.concat(childVal) : Array.isArray(childVal) ? childVal : [childVal] : parentVal;
  192. return res ? dedupeHooks(res) : res;
  193. }
  194. function dedupeHooks(hooks) {
  195. var res = [];
  196. for (var i = 0; i < hooks.length; i++) {
  197. if (res.indexOf(hooks[i]) === -1) {
  198. res.push(hooks[i]);
  199. }
  200. }
  201. return res;
  202. }
  203. function removeHook(hooks, hook) {
  204. var index = hooks.indexOf(hook);
  205. if (index !== -1) {
  206. hooks.splice(index, 1);
  207. }
  208. }
  209. function mergeInterceptorHook(interceptor, option) {
  210. Object.keys(option).forEach(function (hook) {
  211. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  212. interceptor[hook] = mergeHook(interceptor[hook], option[hook]);
  213. }
  214. });
  215. }
  216. function removeInterceptorHook(interceptor, option) {
  217. if (!interceptor || !option) {
  218. return;
  219. }
  220. Object.keys(option).forEach(function (hook) {
  221. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  222. removeHook(interceptor[hook], option[hook]);
  223. }
  224. });
  225. }
  226. function addInterceptor(method, option) {
  227. if (typeof method === 'string' && isPlainObject(option)) {
  228. mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), option);
  229. } else if (isPlainObject(method)) {
  230. mergeInterceptorHook(globalInterceptors, method);
  231. }
  232. }
  233. function removeInterceptor(method, option) {
  234. if (typeof method === 'string') {
  235. if (isPlainObject(option)) {
  236. removeInterceptorHook(scopedInterceptors[method], option);
  237. } else {
  238. delete scopedInterceptors[method];
  239. }
  240. } else if (isPlainObject(method)) {
  241. removeInterceptorHook(globalInterceptors, method);
  242. }
  243. }
  244. function wrapperHook(hook, params) {
  245. return function (data) {
  246. return hook(data, params) || data;
  247. };
  248. }
  249. function isPromise(obj) {
  250. return !!obj && ((0, _typeof2.default)(obj) === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
  251. }
  252. function queue(hooks, data, params) {
  253. var promise = false;
  254. for (var i = 0; i < hooks.length; i++) {
  255. var hook = hooks[i];
  256. if (promise) {
  257. promise = Promise.resolve(wrapperHook(hook, params));
  258. } else {
  259. var res = hook(data, params);
  260. if (isPromise(res)) {
  261. promise = Promise.resolve(res);
  262. }
  263. if (res === false) {
  264. return {
  265. then: function then() {}
  266. };
  267. }
  268. }
  269. }
  270. return promise || {
  271. then: function then(callback) {
  272. return callback(data);
  273. }
  274. };
  275. }
  276. function wrapperOptions(interceptor) {
  277. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  278. ['success', 'fail', 'complete'].forEach(function (name) {
  279. if (Array.isArray(interceptor[name])) {
  280. var oldCallback = options[name];
  281. options[name] = function callbackInterceptor(res) {
  282. queue(interceptor[name], res, options).then(function (res) {
  283. /* eslint-disable no-mixed-operators */
  284. return isFn(oldCallback) && oldCallback(res) || res;
  285. });
  286. };
  287. }
  288. });
  289. return options;
  290. }
  291. function wrapperReturnValue(method, returnValue) {
  292. var returnValueHooks = [];
  293. if (Array.isArray(globalInterceptors.returnValue)) {
  294. returnValueHooks.push.apply(returnValueHooks, (0, _toConsumableArray2.default)(globalInterceptors.returnValue));
  295. }
  296. var interceptor = scopedInterceptors[method];
  297. if (interceptor && Array.isArray(interceptor.returnValue)) {
  298. returnValueHooks.push.apply(returnValueHooks, (0, _toConsumableArray2.default)(interceptor.returnValue));
  299. }
  300. returnValueHooks.forEach(function (hook) {
  301. returnValue = hook(returnValue) || returnValue;
  302. });
  303. return returnValue;
  304. }
  305. function getApiInterceptorHooks(method) {
  306. var interceptor = Object.create(null);
  307. Object.keys(globalInterceptors).forEach(function (hook) {
  308. if (hook !== 'returnValue') {
  309. interceptor[hook] = globalInterceptors[hook].slice();
  310. }
  311. });
  312. var scopedInterceptor = scopedInterceptors[method];
  313. if (scopedInterceptor) {
  314. Object.keys(scopedInterceptor).forEach(function (hook) {
  315. if (hook !== 'returnValue') {
  316. interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
  317. }
  318. });
  319. }
  320. return interceptor;
  321. }
  322. function invokeApi(method, api, options) {
  323. for (var _len = arguments.length, params = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
  324. params[_key - 3] = arguments[_key];
  325. }
  326. var interceptor = getApiInterceptorHooks(method);
  327. if (interceptor && Object.keys(interceptor).length) {
  328. if (Array.isArray(interceptor.invoke)) {
  329. var res = queue(interceptor.invoke, options);
  330. return res.then(function (options) {
  331. // 重新访问 getApiInterceptorHooks, 允许 invoke 中再次调用 addInterceptor,removeInterceptor
  332. return api.apply(void 0, [wrapperOptions(getApiInterceptorHooks(method), options)].concat(params));
  333. });
  334. } else {
  335. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  336. }
  337. }
  338. return api.apply(void 0, [options].concat(params));
  339. }
  340. var promiseInterceptor = {
  341. returnValue: function returnValue(res) {
  342. if (!isPromise(res)) {
  343. return res;
  344. }
  345. return new Promise(function (resolve, reject) {
  346. res.then(function (res) {
  347. if (res[0]) {
  348. reject(res[0]);
  349. } else {
  350. resolve(res[1]);
  351. }
  352. });
  353. });
  354. }
  355. };
  356. 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/;
  357. var CONTEXT_API_RE = /^create|Manager$/;
  358. // Context例外情况
  359. var CONTEXT_API_RE_EXC = ['createBLEConnection'];
  360. // 同步例外情况
  361. var ASYNC_API = ['createBLEConnection', 'createPushMessage'];
  362. var CALLBACK_API_RE = /^on|^off/;
  363. function isContextApi(name) {
  364. return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1;
  365. }
  366. function isSyncApi(name) {
  367. return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1;
  368. }
  369. function isCallbackApi(name) {
  370. return CALLBACK_API_RE.test(name) && name !== 'onPush';
  371. }
  372. function handlePromise(promise) {
  373. return promise.then(function (data) {
  374. return [null, data];
  375. }).catch(function (err) {
  376. return [err];
  377. });
  378. }
  379. function shouldPromise(name) {
  380. if (isContextApi(name) || isSyncApi(name) || isCallbackApi(name)) {
  381. return false;
  382. }
  383. return true;
  384. }
  385. /* eslint-disable no-extend-native */
  386. if (!Promise.prototype.finally) {
  387. Promise.prototype.finally = function (callback) {
  388. var promise = this.constructor;
  389. return this.then(function (value) {
  390. return promise.resolve(callback()).then(function () {
  391. return value;
  392. });
  393. }, function (reason) {
  394. return promise.resolve(callback()).then(function () {
  395. throw reason;
  396. });
  397. });
  398. };
  399. }
  400. function promisify(name, api) {
  401. if (!shouldPromise(name) || !isFn(api)) {
  402. return api;
  403. }
  404. return function promiseApi() {
  405. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  406. for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  407. params[_key2 - 1] = arguments[_key2];
  408. }
  409. if (isFn(options.success) || isFn(options.fail) || isFn(options.complete)) {
  410. return wrapperReturnValue(name, invokeApi.apply(void 0, [name, api, options].concat(params)));
  411. }
  412. return wrapperReturnValue(name, handlePromise(new Promise(function (resolve, reject) {
  413. invokeApi.apply(void 0, [name, api, Object.assign({}, options, {
  414. success: resolve,
  415. fail: reject
  416. })].concat(params));
  417. })));
  418. };
  419. }
  420. var EPS = 1e-4;
  421. var BASE_DEVICE_WIDTH = 750;
  422. var isIOS = false;
  423. var deviceWidth = 0;
  424. var deviceDPR = 0;
  425. function checkDeviceWidth() {
  426. var _wx$getSystemInfoSync = wx.getSystemInfoSync(),
  427. platform = _wx$getSystemInfoSync.platform,
  428. pixelRatio = _wx$getSystemInfoSync.pixelRatio,
  429. windowWidth = _wx$getSystemInfoSync.windowWidth; // uni=>wx runtime 编译目标是 uni 对象,内部不允许直接使用 uni
  430. deviceWidth = windowWidth;
  431. deviceDPR = pixelRatio;
  432. isIOS = platform === 'ios';
  433. }
  434. function upx2px(number, newDeviceWidth) {
  435. if (deviceWidth === 0) {
  436. checkDeviceWidth();
  437. }
  438. number = Number(number);
  439. if (number === 0) {
  440. return 0;
  441. }
  442. var result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth);
  443. if (result < 0) {
  444. result = -result;
  445. }
  446. result = Math.floor(result + EPS);
  447. if (result === 0) {
  448. if (deviceDPR === 1 || !isIOS) {
  449. result = 1;
  450. } else {
  451. result = 0.5;
  452. }
  453. }
  454. return number < 0 ? -result : result;
  455. }
  456. var LOCALE_ZH_HANS = 'zh-Hans';
  457. var LOCALE_ZH_HANT = 'zh-Hant';
  458. var LOCALE_EN = 'en';
  459. var LOCALE_FR = 'fr';
  460. var LOCALE_ES = 'es';
  461. var messages = {};
  462. var locale;
  463. {
  464. locale = normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN;
  465. }
  466. function initI18nMessages() {
  467. if (!isEnableLocale()) {
  468. return;
  469. }
  470. var localeKeys = Object.keys(__uniConfig.locales);
  471. if (localeKeys.length) {
  472. localeKeys.forEach(function (locale) {
  473. var curMessages = messages[locale];
  474. var userMessages = __uniConfig.locales[locale];
  475. if (curMessages) {
  476. Object.assign(curMessages, userMessages);
  477. } else {
  478. messages[locale] = userMessages;
  479. }
  480. });
  481. }
  482. }
  483. initI18nMessages();
  484. var i18n = (0, _uniI18n.initVueI18n)(locale, {});
  485. var t = i18n.t;
  486. var i18nMixin = i18n.mixin = {
  487. beforeCreate: function beforeCreate() {
  488. var _this = this;
  489. var unwatch = i18n.i18n.watchLocale(function () {
  490. _this.$forceUpdate();
  491. });
  492. this.$once('hook:beforeDestroy', function () {
  493. unwatch();
  494. });
  495. },
  496. methods: {
  497. $$t: function $$t(key, values) {
  498. return t(key, values);
  499. }
  500. }
  501. };
  502. var setLocale = i18n.setLocale;
  503. var getLocale = i18n.getLocale;
  504. function initAppLocale(Vue, appVm, locale) {
  505. var state = Vue.observable({
  506. locale: locale || i18n.getLocale()
  507. });
  508. var localeWatchers = [];
  509. appVm.$watchLocale = function (fn) {
  510. localeWatchers.push(fn);
  511. };
  512. Object.defineProperty(appVm, '$locale', {
  513. get: function get() {
  514. return state.locale;
  515. },
  516. set: function set(v) {
  517. state.locale = v;
  518. localeWatchers.forEach(function (watch) {
  519. return watch(v);
  520. });
  521. }
  522. });
  523. }
  524. function isEnableLocale() {
  525. return typeof __uniConfig !== 'undefined' && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length;
  526. }
  527. function include(str, parts) {
  528. return !!parts.find(function (part) {
  529. return str.indexOf(part) !== -1;
  530. });
  531. }
  532. function startsWith(str, parts) {
  533. return parts.find(function (part) {
  534. return str.indexOf(part) === 0;
  535. });
  536. }
  537. function normalizeLocale(locale, messages) {
  538. if (!locale) {
  539. return;
  540. }
  541. locale = locale.trim().replace(/_/g, '-');
  542. if (messages && messages[locale]) {
  543. return locale;
  544. }
  545. locale = locale.toLowerCase();
  546. if (locale === 'chinese') {
  547. // 支付宝
  548. return LOCALE_ZH_HANS;
  549. }
  550. if (locale.indexOf('zh') === 0) {
  551. if (locale.indexOf('-hans') > -1) {
  552. return LOCALE_ZH_HANS;
  553. }
  554. if (locale.indexOf('-hant') > -1) {
  555. return LOCALE_ZH_HANT;
  556. }
  557. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  558. return LOCALE_ZH_HANT;
  559. }
  560. return LOCALE_ZH_HANS;
  561. }
  562. var lang = startsWith(locale, [LOCALE_EN, LOCALE_FR, LOCALE_ES]);
  563. if (lang) {
  564. return lang;
  565. }
  566. }
  567. // export function initI18n() {
  568. // const localeKeys = Object.keys(__uniConfig.locales || {})
  569. // if (localeKeys.length) {
  570. // localeKeys.forEach((locale) =>
  571. // i18n.add(locale, __uniConfig.locales[locale])
  572. // )
  573. // }
  574. // }
  575. function getLocale$1() {
  576. // 优先使用 $locale
  577. if (isFn(getApp)) {
  578. var app = getApp({
  579. allowDefault: true
  580. });
  581. if (app && app.$vm) {
  582. return app.$vm.$locale;
  583. }
  584. }
  585. return normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN;
  586. }
  587. function setLocale$1(locale) {
  588. var app = isFn(getApp) ? getApp() : false;
  589. if (!app) {
  590. return false;
  591. }
  592. var oldLocale = app.$vm.$locale;
  593. if (oldLocale !== locale) {
  594. app.$vm.$locale = locale;
  595. onLocaleChangeCallbacks.forEach(function (fn) {
  596. return fn({
  597. locale: locale
  598. });
  599. });
  600. return true;
  601. }
  602. return false;
  603. }
  604. var onLocaleChangeCallbacks = [];
  605. function onLocaleChange(fn) {
  606. if (onLocaleChangeCallbacks.indexOf(fn) === -1) {
  607. onLocaleChangeCallbacks.push(fn);
  608. }
  609. }
  610. if (typeof global !== 'undefined') {
  611. global.getLocale = getLocale$1;
  612. }
  613. var interceptors = {
  614. promiseInterceptor: promiseInterceptor
  615. };
  616. var baseApi = /*#__PURE__*/Object.freeze({
  617. __proto__: null,
  618. upx2px: upx2px,
  619. getLocale: getLocale$1,
  620. setLocale: setLocale$1,
  621. onLocaleChange: onLocaleChange,
  622. addInterceptor: addInterceptor,
  623. removeInterceptor: removeInterceptor,
  624. interceptors: interceptors
  625. });
  626. function findExistsPageIndex(url) {
  627. var pages = getCurrentPages();
  628. var len = pages.length;
  629. while (len--) {
  630. var page = pages[len];
  631. if (page.$page && page.$page.fullPath === url) {
  632. return len;
  633. }
  634. }
  635. return -1;
  636. }
  637. var redirectTo = {
  638. name: function name(fromArgs) {
  639. if (fromArgs.exists === 'back' && fromArgs.delta) {
  640. return 'navigateBack';
  641. }
  642. return 'redirectTo';
  643. },
  644. args: function args(fromArgs) {
  645. if (fromArgs.exists === 'back' && fromArgs.url) {
  646. var existsPageIndex = findExistsPageIndex(fromArgs.url);
  647. if (existsPageIndex !== -1) {
  648. var delta = getCurrentPages().length - 1 - existsPageIndex;
  649. if (delta > 0) {
  650. fromArgs.delta = delta;
  651. }
  652. }
  653. }
  654. }
  655. };
  656. var previewImage = {
  657. args: function args(fromArgs) {
  658. var currentIndex = parseInt(fromArgs.current);
  659. if (isNaN(currentIndex)) {
  660. return;
  661. }
  662. var urls = fromArgs.urls;
  663. if (!Array.isArray(urls)) {
  664. return;
  665. }
  666. var len = urls.length;
  667. if (!len) {
  668. return;
  669. }
  670. if (currentIndex < 0) {
  671. currentIndex = 0;
  672. } else if (currentIndex >= len) {
  673. currentIndex = len - 1;
  674. }
  675. if (currentIndex > 0) {
  676. fromArgs.current = urls[currentIndex];
  677. fromArgs.urls = urls.filter(function (item, index) {
  678. return index < currentIndex ? item !== urls[currentIndex] : true;
  679. });
  680. } else {
  681. fromArgs.current = urls[0];
  682. }
  683. return {
  684. indicator: false,
  685. loop: false
  686. };
  687. }
  688. };
  689. var UUID_KEY = '__DC_STAT_UUID';
  690. var deviceId;
  691. function useDeviceId(result) {
  692. deviceId = deviceId || wx.getStorageSync(UUID_KEY);
  693. if (!deviceId) {
  694. deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7);
  695. wx.setStorage({
  696. key: UUID_KEY,
  697. data: deviceId
  698. });
  699. }
  700. result.deviceId = deviceId;
  701. }
  702. function addSafeAreaInsets(result) {
  703. if (result.safeArea) {
  704. var safeArea = result.safeArea;
  705. result.safeAreaInsets = {
  706. top: safeArea.top,
  707. left: safeArea.left,
  708. right: result.windowWidth - safeArea.right,
  709. bottom: result.screenHeight - safeArea.bottom
  710. };
  711. }
  712. }
  713. function populateParameters(result) {
  714. var _result$brand = result.brand,
  715. brand = _result$brand === void 0 ? '' : _result$brand,
  716. _result$model = result.model,
  717. model = _result$model === void 0 ? '' : _result$model,
  718. _result$system = result.system,
  719. system = _result$system === void 0 ? '' : _result$system,
  720. _result$language = result.language,
  721. language = _result$language === void 0 ? '' : _result$language,
  722. theme = result.theme,
  723. version = result.version,
  724. platform = result.platform,
  725. fontSizeSetting = result.fontSizeSetting,
  726. SDKVersion = result.SDKVersion,
  727. pixelRatio = result.pixelRatio,
  728. deviceOrientation = result.deviceOrientation;
  729. // const isQuickApp = "mp-weixin".indexOf('quickapp-webview') !== -1
  730. var extraParam = {};
  731. // osName osVersion
  732. var osName = '';
  733. var osVersion = '';
  734. {
  735. osName = system.split(' ')[0] || '';
  736. osVersion = system.split(' ')[1] || '';
  737. }
  738. var hostVersion = version;
  739. // deviceType
  740. var deviceType = getGetDeviceType(result, model);
  741. // deviceModel
  742. var deviceBrand = getDeviceBrand(brand);
  743. // hostName
  744. var _hostName = getHostName(result);
  745. // deviceOrientation
  746. var _deviceOrientation = deviceOrientation; // 仅 微信 百度 支持
  747. // devicePixelRatio
  748. var _devicePixelRatio = pixelRatio;
  749. // SDKVersion
  750. var _SDKVersion = SDKVersion;
  751. // hostLanguage
  752. var hostLanguage = language.replace(/_/g, '-');
  753. // wx.getAccountInfoSync
  754. var parameters = {
  755. appId: "__UNI__5ADCEDA",
  756. appName: "jje_staff_uniapp",
  757. appVersion: "1.0.0",
  758. appVersionCode: "100",
  759. appLanguage: getAppLanguage(hostLanguage),
  760. uniCompileVersion: "3.98",
  761. uniRuntimeVersion: "3.98",
  762. uniPlatform: undefined || "mp-weixin",
  763. deviceBrand: deviceBrand,
  764. deviceModel: model,
  765. deviceType: deviceType,
  766. devicePixelRatio: _devicePixelRatio,
  767. deviceOrientation: _deviceOrientation,
  768. osName: osName.toLocaleLowerCase(),
  769. osVersion: osVersion,
  770. hostTheme: theme,
  771. hostVersion: hostVersion,
  772. hostLanguage: hostLanguage,
  773. hostName: _hostName,
  774. hostSDKVersion: _SDKVersion,
  775. hostFontSizeSetting: fontSizeSetting,
  776. windowTop: 0,
  777. windowBottom: 0,
  778. // TODO
  779. osLanguage: undefined,
  780. osTheme: undefined,
  781. ua: undefined,
  782. hostPackageName: undefined,
  783. browserName: undefined,
  784. browserVersion: undefined
  785. };
  786. Object.assign(result, parameters, extraParam);
  787. }
  788. function getGetDeviceType(result, model) {
  789. var deviceType = result.deviceType || 'phone';
  790. {
  791. var deviceTypeMaps = {
  792. ipad: 'pad',
  793. windows: 'pc',
  794. mac: 'pc'
  795. };
  796. var deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
  797. var _model = model.toLocaleLowerCase();
  798. for (var index = 0; index < deviceTypeMapsKeys.length; index++) {
  799. var _m = deviceTypeMapsKeys[index];
  800. if (_model.indexOf(_m) !== -1) {
  801. deviceType = deviceTypeMaps[_m];
  802. break;
  803. }
  804. }
  805. }
  806. return deviceType;
  807. }
  808. function getDeviceBrand(brand) {
  809. var deviceBrand = brand;
  810. if (deviceBrand) {
  811. deviceBrand = brand.toLocaleLowerCase();
  812. }
  813. return deviceBrand;
  814. }
  815. function getAppLanguage(defaultLanguage) {
  816. return getLocale$1 ? getLocale$1() : defaultLanguage;
  817. }
  818. function getHostName(result) {
  819. var _platform = 'WeChat';
  820. var _hostName = result.hostName || _platform; // mp-jd
  821. {
  822. if (result.environment) {
  823. _hostName = result.environment;
  824. } else if (result.host && result.host.env) {
  825. _hostName = result.host.env;
  826. }
  827. }
  828. return _hostName;
  829. }
  830. var getSystemInfo = {
  831. returnValue: function returnValue(result) {
  832. useDeviceId(result);
  833. addSafeAreaInsets(result);
  834. populateParameters(result);
  835. }
  836. };
  837. var showActionSheet = {
  838. args: function args(fromArgs) {
  839. if ((0, _typeof2.default)(fromArgs) === 'object') {
  840. fromArgs.alertText = fromArgs.title;
  841. }
  842. }
  843. };
  844. var getAppBaseInfo = {
  845. returnValue: function returnValue(result) {
  846. var _result = result,
  847. version = _result.version,
  848. language = _result.language,
  849. SDKVersion = _result.SDKVersion,
  850. theme = _result.theme;
  851. var _hostName = getHostName(result);
  852. var hostLanguage = language.replace('_', '-');
  853. result = sortObject(Object.assign(result, {
  854. appId: "__UNI__5ADCEDA",
  855. appName: "jje_staff_uniapp",
  856. appVersion: "1.0.0",
  857. appVersionCode: "100",
  858. appLanguage: getAppLanguage(hostLanguage),
  859. hostVersion: version,
  860. hostLanguage: hostLanguage,
  861. hostName: _hostName,
  862. hostSDKVersion: SDKVersion,
  863. hostTheme: theme
  864. }));
  865. }
  866. };
  867. var getDeviceInfo = {
  868. returnValue: function returnValue(result) {
  869. var _result2 = result,
  870. brand = _result2.brand,
  871. model = _result2.model;
  872. var deviceType = getGetDeviceType(result, model);
  873. var deviceBrand = getDeviceBrand(brand);
  874. useDeviceId(result);
  875. result = sortObject(Object.assign(result, {
  876. deviceType: deviceType,
  877. deviceBrand: deviceBrand,
  878. deviceModel: model
  879. }));
  880. }
  881. };
  882. var getWindowInfo = {
  883. returnValue: function returnValue(result) {
  884. addSafeAreaInsets(result);
  885. result = sortObject(Object.assign(result, {
  886. windowTop: 0,
  887. windowBottom: 0
  888. }));
  889. }
  890. };
  891. var getAppAuthorizeSetting = {
  892. returnValue: function returnValue(result) {
  893. var locationReducedAccuracy = result.locationReducedAccuracy;
  894. result.locationAccuracy = 'unsupported';
  895. if (locationReducedAccuracy === true) {
  896. result.locationAccuracy = 'reduced';
  897. } else if (locationReducedAccuracy === false) {
  898. result.locationAccuracy = 'full';
  899. }
  900. }
  901. };
  902. // import navigateTo from 'uni-helpers/navigate-to'
  903. var compressImage = {
  904. args: function args(fromArgs) {
  905. // https://developers.weixin.qq.com/community/develop/doc/000c08940c865011298e0a43256800?highLine=compressHeight
  906. if (fromArgs.compressedHeight && !fromArgs.compressHeight) {
  907. fromArgs.compressHeight = fromArgs.compressedHeight;
  908. }
  909. if (fromArgs.compressedWidth && !fromArgs.compressWidth) {
  910. fromArgs.compressWidth = fromArgs.compressedWidth;
  911. }
  912. }
  913. };
  914. var protocols = {
  915. redirectTo: redirectTo,
  916. // navigateTo, // 由于在微信开发者工具的页面参数,会显示__id__参数,因此暂时关闭mp-weixin对于navigateTo的AOP
  917. previewImage: previewImage,
  918. getSystemInfo: getSystemInfo,
  919. getSystemInfoSync: getSystemInfo,
  920. showActionSheet: showActionSheet,
  921. getAppBaseInfo: getAppBaseInfo,
  922. getDeviceInfo: getDeviceInfo,
  923. getWindowInfo: getWindowInfo,
  924. getAppAuthorizeSetting: getAppAuthorizeSetting,
  925. compressImage: compressImage
  926. };
  927. var todos = ['vibrate', 'preloadPage', 'unPreloadPage', 'loadSubPackage'];
  928. var canIUses = [];
  929. var CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
  930. function processCallback(methodName, method, returnValue) {
  931. return function (res) {
  932. return method(processReturnValue(methodName, res, returnValue));
  933. };
  934. }
  935. function processArgs(methodName, fromArgs) {
  936. var argsOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  937. var returnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  938. var keepFromArgs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  939. if (isPlainObject(fromArgs)) {
  940. // 一般 api 的参数解析
  941. var toArgs = keepFromArgs === true ? fromArgs : {}; // returnValue 为 false 时,说明是格式化返回值,直接在返回值对象上修改赋值
  942. if (isFn(argsOption)) {
  943. argsOption = argsOption(fromArgs, toArgs) || {};
  944. }
  945. for (var key in fromArgs) {
  946. if (hasOwn(argsOption, key)) {
  947. var keyOption = argsOption[key];
  948. if (isFn(keyOption)) {
  949. keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
  950. }
  951. if (!keyOption) {
  952. // 不支持的参数
  953. console.warn("The '".concat(methodName, "' method of platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support option '").concat(key, "'"));
  954. } else if (isStr(keyOption)) {
  955. // 重写参数 key
  956. toArgs[keyOption] = fromArgs[key];
  957. } else if (isPlainObject(keyOption)) {
  958. // {name:newName,value:value}可重新指定参数 key:value
  959. toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
  960. }
  961. } else if (CALLBACKS.indexOf(key) !== -1) {
  962. if (isFn(fromArgs[key])) {
  963. toArgs[key] = processCallback(methodName, fromArgs[key], returnValue);
  964. }
  965. } else {
  966. if (!keepFromArgs) {
  967. toArgs[key] = fromArgs[key];
  968. }
  969. }
  970. }
  971. return toArgs;
  972. } else if (isFn(fromArgs)) {
  973. fromArgs = processCallback(methodName, fromArgs, returnValue);
  974. }
  975. return fromArgs;
  976. }
  977. function processReturnValue(methodName, res, returnValue) {
  978. var keepReturnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  979. if (isFn(protocols.returnValue)) {
  980. // 处理通用 returnValue
  981. res = protocols.returnValue(methodName, res);
  982. }
  983. return processArgs(methodName, res, returnValue, {}, keepReturnValue);
  984. }
  985. function wrapper(methodName, method) {
  986. if (hasOwn(protocols, methodName)) {
  987. var protocol = protocols[methodName];
  988. if (!protocol) {
  989. // 暂不支持的 api
  990. return function () {
  991. console.error("Platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support '".concat(methodName, "'."));
  992. };
  993. }
  994. return function (arg1, arg2) {
  995. // 目前 api 最多两个参数
  996. var options = protocol;
  997. if (isFn(protocol)) {
  998. options = protocol(arg1);
  999. }
  1000. arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
  1001. var args = [arg1];
  1002. if (typeof arg2 !== 'undefined') {
  1003. args.push(arg2);
  1004. }
  1005. if (isFn(options.name)) {
  1006. methodName = options.name(arg1);
  1007. } else if (isStr(options.name)) {
  1008. methodName = options.name;
  1009. }
  1010. var returnValue = wx[methodName].apply(wx, args);
  1011. if (isSyncApi(methodName)) {
  1012. // 同步 api
  1013. return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
  1014. }
  1015. return returnValue;
  1016. };
  1017. }
  1018. return method;
  1019. }
  1020. var todoApis = Object.create(null);
  1021. var TODOS = ['onTabBarMidButtonTap', 'subscribePush', 'unsubscribePush', 'onPush', 'offPush', 'share'];
  1022. function createTodoApi(name) {
  1023. return function todoApi(_ref) {
  1024. var fail = _ref.fail,
  1025. complete = _ref.complete;
  1026. var res = {
  1027. errMsg: "".concat(name, ":fail method '").concat(name, "' not supported")
  1028. };
  1029. isFn(fail) && fail(res);
  1030. isFn(complete) && complete(res);
  1031. };
  1032. }
  1033. TODOS.forEach(function (name) {
  1034. todoApis[name] = createTodoApi(name);
  1035. });
  1036. var providers = {
  1037. oauth: ['weixin'],
  1038. share: ['weixin'],
  1039. payment: ['wxpay'],
  1040. push: ['weixin']
  1041. };
  1042. function getProvider(_ref2) {
  1043. var service = _ref2.service,
  1044. success = _ref2.success,
  1045. fail = _ref2.fail,
  1046. complete = _ref2.complete;
  1047. var res = false;
  1048. if (providers[service]) {
  1049. res = {
  1050. errMsg: 'getProvider:ok',
  1051. service: service,
  1052. provider: providers[service]
  1053. };
  1054. isFn(success) && success(res);
  1055. } else {
  1056. res = {
  1057. errMsg: 'getProvider:fail service not found'
  1058. };
  1059. isFn(fail) && fail(res);
  1060. }
  1061. isFn(complete) && complete(res);
  1062. }
  1063. var extraApi = /*#__PURE__*/Object.freeze({
  1064. __proto__: null,
  1065. getProvider: getProvider
  1066. });
  1067. var getEmitter = function () {
  1068. var Emitter;
  1069. return function getUniEmitter() {
  1070. if (!Emitter) {
  1071. Emitter = new _vue.default();
  1072. }
  1073. return Emitter;
  1074. };
  1075. }();
  1076. function apply(ctx, method, args) {
  1077. return ctx[method].apply(ctx, args);
  1078. }
  1079. function $on() {
  1080. return apply(getEmitter(), '$on', Array.prototype.slice.call(arguments));
  1081. }
  1082. function $off() {
  1083. return apply(getEmitter(), '$off', Array.prototype.slice.call(arguments));
  1084. }
  1085. function $once() {
  1086. return apply(getEmitter(), '$once', Array.prototype.slice.call(arguments));
  1087. }
  1088. function $emit() {
  1089. return apply(getEmitter(), '$emit', Array.prototype.slice.call(arguments));
  1090. }
  1091. var eventApi = /*#__PURE__*/Object.freeze({
  1092. __proto__: null,
  1093. $on: $on,
  1094. $off: $off,
  1095. $once: $once,
  1096. $emit: $emit
  1097. });
  1098. /**
  1099. * 框架内 try-catch
  1100. */
  1101. /**
  1102. * 开发者 try-catch
  1103. */
  1104. function tryCatch(fn) {
  1105. return function () {
  1106. try {
  1107. return fn.apply(fn, arguments);
  1108. } catch (e) {
  1109. // TODO
  1110. console.error(e);
  1111. }
  1112. };
  1113. }
  1114. function getApiCallbacks(params) {
  1115. var apiCallbacks = {};
  1116. for (var name in params) {
  1117. var param = params[name];
  1118. if (isFn(param)) {
  1119. apiCallbacks[name] = tryCatch(param);
  1120. delete params[name];
  1121. }
  1122. }
  1123. return apiCallbacks;
  1124. }
  1125. var cid;
  1126. var cidErrMsg;
  1127. var enabled;
  1128. function normalizePushMessage(message) {
  1129. try {
  1130. return JSON.parse(message);
  1131. } catch (e) {}
  1132. return message;
  1133. }
  1134. function invokePushCallback(args) {
  1135. if (args.type === 'enabled') {
  1136. enabled = true;
  1137. } else if (args.type === 'clientId') {
  1138. cid = args.cid;
  1139. cidErrMsg = args.errMsg;
  1140. invokeGetPushCidCallbacks(cid, args.errMsg);
  1141. } else if (args.type === 'pushMsg') {
  1142. var message = {
  1143. type: 'receive',
  1144. data: normalizePushMessage(args.message)
  1145. };
  1146. for (var i = 0; i < onPushMessageCallbacks.length; i++) {
  1147. var callback = onPushMessageCallbacks[i];
  1148. callback(message);
  1149. // 该消息已被阻止
  1150. if (message.stopped) {
  1151. break;
  1152. }
  1153. }
  1154. } else if (args.type === 'click') {
  1155. onPushMessageCallbacks.forEach(function (callback) {
  1156. callback({
  1157. type: 'click',
  1158. data: normalizePushMessage(args.message)
  1159. });
  1160. });
  1161. }
  1162. }
  1163. var getPushCidCallbacks = [];
  1164. function invokeGetPushCidCallbacks(cid, errMsg) {
  1165. getPushCidCallbacks.forEach(function (callback) {
  1166. callback(cid, errMsg);
  1167. });
  1168. getPushCidCallbacks.length = 0;
  1169. }
  1170. function getPushClientId(args) {
  1171. if (!isPlainObject(args)) {
  1172. args = {};
  1173. }
  1174. var _getApiCallbacks = getApiCallbacks(args),
  1175. success = _getApiCallbacks.success,
  1176. fail = _getApiCallbacks.fail,
  1177. complete = _getApiCallbacks.complete;
  1178. var hasSuccess = isFn(success);
  1179. var hasFail = isFn(fail);
  1180. var hasComplete = isFn(complete);
  1181. Promise.resolve().then(function () {
  1182. if (typeof enabled === 'undefined') {
  1183. enabled = false;
  1184. cid = '';
  1185. cidErrMsg = 'uniPush is not enabled';
  1186. }
  1187. getPushCidCallbacks.push(function (cid, errMsg) {
  1188. var res;
  1189. if (cid) {
  1190. res = {
  1191. errMsg: 'getPushClientId:ok',
  1192. cid: cid
  1193. };
  1194. hasSuccess && success(res);
  1195. } else {
  1196. res = {
  1197. errMsg: 'getPushClientId:fail' + (errMsg ? ' ' + errMsg : '')
  1198. };
  1199. hasFail && fail(res);
  1200. }
  1201. hasComplete && complete(res);
  1202. });
  1203. if (typeof cid !== 'undefined') {
  1204. invokeGetPushCidCallbacks(cid, cidErrMsg);
  1205. }
  1206. });
  1207. }
  1208. var onPushMessageCallbacks = [];
  1209. // 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
  1210. var onPushMessage = function onPushMessage(fn) {
  1211. if (onPushMessageCallbacks.indexOf(fn) === -1) {
  1212. onPushMessageCallbacks.push(fn);
  1213. }
  1214. };
  1215. var offPushMessage = function offPushMessage(fn) {
  1216. if (!fn) {
  1217. onPushMessageCallbacks.length = 0;
  1218. } else {
  1219. var index = onPushMessageCallbacks.indexOf(fn);
  1220. if (index > -1) {
  1221. onPushMessageCallbacks.splice(index, 1);
  1222. }
  1223. }
  1224. };
  1225. var baseInfo = wx.getAppBaseInfo && wx.getAppBaseInfo();
  1226. if (!baseInfo) {
  1227. baseInfo = wx.getSystemInfoSync();
  1228. }
  1229. var host = baseInfo ? baseInfo.host : null;
  1230. var shareVideoMessage = host && host.env === 'SAAASDK' ? wx.miniapp.shareVideoMessage : wx.shareVideoMessage;
  1231. var api = /*#__PURE__*/Object.freeze({
  1232. __proto__: null,
  1233. shareVideoMessage: shareVideoMessage,
  1234. getPushClientId: getPushClientId,
  1235. onPushMessage: onPushMessage,
  1236. offPushMessage: offPushMessage,
  1237. invokePushCallback: invokePushCallback
  1238. });
  1239. var mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
  1240. function findVmByVueId(vm, vuePid) {
  1241. var $children = vm.$children;
  1242. // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
  1243. for (var i = $children.length - 1; i >= 0; i--) {
  1244. var childVm = $children[i];
  1245. if (childVm.$scope._$vueId === vuePid) {
  1246. return childVm;
  1247. }
  1248. }
  1249. // 反向递归查找
  1250. var parentVm;
  1251. for (var _i = $children.length - 1; _i >= 0; _i--) {
  1252. parentVm = findVmByVueId($children[_i], vuePid);
  1253. if (parentVm) {
  1254. return parentVm;
  1255. }
  1256. }
  1257. }
  1258. function initBehavior(options) {
  1259. return Behavior(options);
  1260. }
  1261. function isPage() {
  1262. return !!this.route;
  1263. }
  1264. function initRelation(detail) {
  1265. this.triggerEvent('__l', detail);
  1266. }
  1267. function selectAllComponents(mpInstance, selector, $refs) {
  1268. var components = mpInstance.selectAllComponents(selector) || [];
  1269. components.forEach(function (component) {
  1270. var ref = component.dataset.ref;
  1271. $refs[ref] = component.$vm || toSkip(component);
  1272. {
  1273. if (component.dataset.vueGeneric === 'scoped') {
  1274. component.selectAllComponents('.scoped-ref').forEach(function (scopedComponent) {
  1275. selectAllComponents(scopedComponent, selector, $refs);
  1276. });
  1277. }
  1278. }
  1279. });
  1280. }
  1281. function syncRefs(refs, newRefs) {
  1282. var oldKeys = (0, _construct2.default)(Set, (0, _toConsumableArray2.default)(Object.keys(refs)));
  1283. var newKeys = Object.keys(newRefs);
  1284. newKeys.forEach(function (key) {
  1285. var oldValue = refs[key];
  1286. var newValue = newRefs[key];
  1287. if (Array.isArray(oldValue) && Array.isArray(newValue) && oldValue.length === newValue.length && newValue.every(function (value) {
  1288. return oldValue.includes(value);
  1289. })) {
  1290. return;
  1291. }
  1292. refs[key] = newValue;
  1293. oldKeys.delete(key);
  1294. });
  1295. oldKeys.forEach(function (key) {
  1296. delete refs[key];
  1297. });
  1298. return refs;
  1299. }
  1300. function initRefs(vm) {
  1301. var mpInstance = vm.$scope;
  1302. var refs = {};
  1303. Object.defineProperty(vm, '$refs', {
  1304. get: function get() {
  1305. var $refs = {};
  1306. selectAllComponents(mpInstance, '.vue-ref', $refs);
  1307. // TODO 暂不考虑 for 中的 scoped
  1308. var forComponents = mpInstance.selectAllComponents('.vue-ref-in-for') || [];
  1309. forComponents.forEach(function (component) {
  1310. var ref = component.dataset.ref;
  1311. if (!$refs[ref]) {
  1312. $refs[ref] = [];
  1313. }
  1314. $refs[ref].push(component.$vm || toSkip(component));
  1315. });
  1316. return syncRefs(refs, $refs);
  1317. }
  1318. });
  1319. }
  1320. function handleLink(event) {
  1321. var _ref3 = event.detail || event.value,
  1322. vuePid = _ref3.vuePid,
  1323. vueOptions = _ref3.vueOptions; // detail 是微信,value 是百度(dipatch)
  1324. var parentVm;
  1325. if (vuePid) {
  1326. parentVm = findVmByVueId(this.$vm, vuePid);
  1327. }
  1328. if (!parentVm) {
  1329. parentVm = this.$vm;
  1330. }
  1331. vueOptions.parent = parentVm;
  1332. }
  1333. function markMPComponent(component) {
  1334. // 在 Vue 中标记为小程序组件
  1335. var IS_MP = '__v_isMPComponent';
  1336. Object.defineProperty(component, IS_MP, {
  1337. configurable: true,
  1338. enumerable: false,
  1339. value: true
  1340. });
  1341. return component;
  1342. }
  1343. function toSkip(obj) {
  1344. var OB = '__ob__';
  1345. var SKIP = '__v_skip';
  1346. if (isObject(obj) && Object.isExtensible(obj)) {
  1347. // 避免被 @vue/composition-api 观测
  1348. Object.defineProperty(obj, OB, {
  1349. configurable: true,
  1350. enumerable: false,
  1351. value: (0, _defineProperty2.default)({}, SKIP, true)
  1352. });
  1353. }
  1354. return obj;
  1355. }
  1356. var WORKLET_RE = /_(.*)_worklet_factory_/;
  1357. function initWorkletMethods(mpMethods, vueMethods) {
  1358. if (vueMethods) {
  1359. Object.keys(vueMethods).forEach(function (name) {
  1360. var matches = name.match(WORKLET_RE);
  1361. if (matches) {
  1362. var workletName = matches[1];
  1363. mpMethods[name] = vueMethods[name];
  1364. mpMethods[workletName] = vueMethods[workletName];
  1365. }
  1366. });
  1367. }
  1368. }
  1369. var MPPage = Page;
  1370. var MPComponent = Component;
  1371. var customizeRE = /:/g;
  1372. var customize = cached(function (str) {
  1373. return camelize(str.replace(customizeRE, '-'));
  1374. });
  1375. function initTriggerEvent(mpInstance) {
  1376. var oldTriggerEvent = mpInstance.triggerEvent;
  1377. var newTriggerEvent = function newTriggerEvent(event) {
  1378. for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
  1379. args[_key3 - 1] = arguments[_key3];
  1380. }
  1381. // 事件名统一转驼峰格式,仅处理:当前组件为 vue 组件、当前组件为 vue 组件子组件
  1382. if (this.$vm || this.dataset && this.dataset.comType) {
  1383. event = customize(event);
  1384. } else {
  1385. // 针对微信/QQ小程序单独补充驼峰格式事件,以兼容历史项目
  1386. var newEvent = customize(event);
  1387. if (newEvent !== event) {
  1388. oldTriggerEvent.apply(this, [newEvent].concat(args));
  1389. }
  1390. }
  1391. return oldTriggerEvent.apply(this, [event].concat(args));
  1392. };
  1393. try {
  1394. // 京东小程序 triggerEvent 为只读
  1395. mpInstance.triggerEvent = newTriggerEvent;
  1396. } catch (error) {
  1397. mpInstance._triggerEvent = newTriggerEvent;
  1398. }
  1399. }
  1400. function initHook(name, options, isComponent) {
  1401. var oldHook = options[name];
  1402. options[name] = function () {
  1403. markMPComponent(this);
  1404. initTriggerEvent(this);
  1405. if (oldHook) {
  1406. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  1407. args[_key4] = arguments[_key4];
  1408. }
  1409. return oldHook.apply(this, args);
  1410. }
  1411. };
  1412. }
  1413. if (!MPPage.__$wrappered) {
  1414. MPPage.__$wrappered = true;
  1415. Page = function Page() {
  1416. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1417. initHook('onLoad', options);
  1418. return MPPage(options);
  1419. };
  1420. Page.after = MPPage.after;
  1421. Component = function Component() {
  1422. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1423. initHook('created', options);
  1424. return MPComponent(options);
  1425. };
  1426. }
  1427. var PAGE_EVENT_HOOKS = ['onPullDownRefresh', 'onReachBottom', 'onAddToFavorites', 'onShareTimeline', 'onShareAppMessage', 'onPageScroll', 'onResize', 'onTabItemTap'];
  1428. function initMocks(vm, mocks) {
  1429. var mpInstance = vm.$mp[vm.mpType];
  1430. mocks.forEach(function (mock) {
  1431. if (hasOwn(mpInstance, mock)) {
  1432. vm[mock] = mpInstance[mock];
  1433. }
  1434. });
  1435. }
  1436. function hasHook(hook, vueOptions) {
  1437. if (!vueOptions) {
  1438. return true;
  1439. }
  1440. if (_vue.default.options && Array.isArray(_vue.default.options[hook])) {
  1441. return true;
  1442. }
  1443. vueOptions = vueOptions.default || vueOptions;
  1444. if (isFn(vueOptions)) {
  1445. if (isFn(vueOptions.extendOptions[hook])) {
  1446. return true;
  1447. }
  1448. if (vueOptions.super && vueOptions.super.options && Array.isArray(vueOptions.super.options[hook])) {
  1449. return true;
  1450. }
  1451. return false;
  1452. }
  1453. if (isFn(vueOptions[hook]) || Array.isArray(vueOptions[hook])) {
  1454. return true;
  1455. }
  1456. var mixins = vueOptions.mixins;
  1457. if (Array.isArray(mixins)) {
  1458. return !!mixins.find(function (mixin) {
  1459. return hasHook(hook, mixin);
  1460. });
  1461. }
  1462. }
  1463. function initHooks(mpOptions, hooks, vueOptions) {
  1464. hooks.forEach(function (hook) {
  1465. if (hasHook(hook, vueOptions)) {
  1466. mpOptions[hook] = function (args) {
  1467. return this.$vm && this.$vm.__call_hook(hook, args);
  1468. };
  1469. }
  1470. });
  1471. }
  1472. function initUnknownHooks(mpOptions, vueOptions) {
  1473. var excludes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  1474. findHooks(vueOptions).forEach(function (hook) {
  1475. return initHook$1(mpOptions, hook, excludes);
  1476. });
  1477. }
  1478. function findHooks(vueOptions) {
  1479. var hooks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  1480. if (vueOptions) {
  1481. Object.keys(vueOptions).forEach(function (name) {
  1482. if (name.indexOf('on') === 0 && isFn(vueOptions[name])) {
  1483. hooks.push(name);
  1484. }
  1485. });
  1486. }
  1487. return hooks;
  1488. }
  1489. function initHook$1(mpOptions, hook, excludes) {
  1490. if (excludes.indexOf(hook) === -1 && !hasOwn(mpOptions, hook)) {
  1491. mpOptions[hook] = function (args) {
  1492. return this.$vm && this.$vm.__call_hook(hook, args);
  1493. };
  1494. }
  1495. }
  1496. function initVueComponent(Vue, vueOptions) {
  1497. vueOptions = vueOptions.default || vueOptions;
  1498. var VueComponent;
  1499. if (isFn(vueOptions)) {
  1500. VueComponent = vueOptions;
  1501. } else {
  1502. VueComponent = Vue.extend(vueOptions);
  1503. }
  1504. vueOptions = VueComponent.options;
  1505. return [VueComponent, vueOptions];
  1506. }
  1507. function initSlots(vm, vueSlots) {
  1508. if (Array.isArray(vueSlots) && vueSlots.length) {
  1509. var $slots = Object.create(null);
  1510. vueSlots.forEach(function (slotName) {
  1511. $slots[slotName] = true;
  1512. });
  1513. vm.$scopedSlots = vm.$slots = $slots;
  1514. }
  1515. }
  1516. function initVueIds(vueIds, mpInstance) {
  1517. vueIds = (vueIds || '').split(',');
  1518. var len = vueIds.length;
  1519. if (len === 1) {
  1520. mpInstance._$vueId = vueIds[0];
  1521. } else if (len === 2) {
  1522. mpInstance._$vueId = vueIds[0];
  1523. mpInstance._$vuePid = vueIds[1];
  1524. }
  1525. }
  1526. function initData(vueOptions, context) {
  1527. var data = vueOptions.data || {};
  1528. var methods = vueOptions.methods || {};
  1529. if (typeof data === 'function') {
  1530. try {
  1531. data = data.call(context); // 支持 Vue.prototype 上挂的数据
  1532. } catch (e) {
  1533. if (Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"jje_staff_uniapp","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  1534. console.warn('根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。', data);
  1535. }
  1536. }
  1537. } else {
  1538. try {
  1539. // 对 data 格式化
  1540. data = JSON.parse(JSON.stringify(data));
  1541. } catch (e) {}
  1542. }
  1543. if (!isPlainObject(data)) {
  1544. data = {};
  1545. }
  1546. Object.keys(methods).forEach(function (methodName) {
  1547. if (context.__lifecycle_hooks__.indexOf(methodName) === -1 && !hasOwn(data, methodName)) {
  1548. data[methodName] = methods[methodName];
  1549. }
  1550. });
  1551. return data;
  1552. }
  1553. var PROP_TYPES = [String, Number, Boolean, Object, Array, null];
  1554. function createObserver(name) {
  1555. return function observer(newVal, oldVal) {
  1556. if (this.$vm) {
  1557. this.$vm[name] = newVal; // 为了触发其他非 render watcher
  1558. }
  1559. };
  1560. }
  1561. function initBehaviors(vueOptions, initBehavior) {
  1562. var vueBehaviors = vueOptions.behaviors;
  1563. var vueExtends = vueOptions.extends;
  1564. var vueMixins = vueOptions.mixins;
  1565. var vueProps = vueOptions.props;
  1566. if (!vueProps) {
  1567. vueOptions.props = vueProps = [];
  1568. }
  1569. var behaviors = [];
  1570. if (Array.isArray(vueBehaviors)) {
  1571. vueBehaviors.forEach(function (behavior) {
  1572. behaviors.push(behavior.replace('uni://', "wx".concat("://")));
  1573. if (behavior === 'uni://form-field') {
  1574. if (Array.isArray(vueProps)) {
  1575. vueProps.push('name');
  1576. vueProps.push('value');
  1577. } else {
  1578. vueProps.name = {
  1579. type: String,
  1580. default: ''
  1581. };
  1582. vueProps.value = {
  1583. type: [String, Number, Boolean, Array, Object, Date],
  1584. default: ''
  1585. };
  1586. }
  1587. }
  1588. });
  1589. }
  1590. if (isPlainObject(vueExtends) && vueExtends.props) {
  1591. behaviors.push(initBehavior({
  1592. properties: initProperties(vueExtends.props, true)
  1593. }));
  1594. }
  1595. if (Array.isArray(vueMixins)) {
  1596. vueMixins.forEach(function (vueMixin) {
  1597. if (isPlainObject(vueMixin) && vueMixin.props) {
  1598. behaviors.push(initBehavior({
  1599. properties: initProperties(vueMixin.props, true)
  1600. }));
  1601. }
  1602. });
  1603. }
  1604. return behaviors;
  1605. }
  1606. function parsePropType(key, type, defaultValue, file) {
  1607. // [String]=>String
  1608. if (Array.isArray(type) && type.length === 1) {
  1609. return type[0];
  1610. }
  1611. return type;
  1612. }
  1613. function initProperties(props) {
  1614. var isBehavior = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  1615. var file = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
  1616. var options = arguments.length > 3 ? arguments[3] : undefined;
  1617. var properties = {};
  1618. if (!isBehavior) {
  1619. properties.vueId = {
  1620. type: String,
  1621. value: ''
  1622. };
  1623. {
  1624. if (options.virtualHost) {
  1625. properties.virtualHostStyle = {
  1626. type: null,
  1627. value: ''
  1628. };
  1629. properties.virtualHostClass = {
  1630. type: null,
  1631. value: ''
  1632. };
  1633. }
  1634. }
  1635. // scopedSlotsCompiler auto
  1636. properties.scopedSlotsCompiler = {
  1637. type: String,
  1638. value: ''
  1639. };
  1640. properties.vueSlots = {
  1641. // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
  1642. type: null,
  1643. value: [],
  1644. observer: function observer(newVal, oldVal) {
  1645. var $slots = Object.create(null);
  1646. newVal.forEach(function (slotName) {
  1647. $slots[slotName] = true;
  1648. });
  1649. this.setData({
  1650. $slots: $slots
  1651. });
  1652. }
  1653. };
  1654. }
  1655. if (Array.isArray(props)) {
  1656. // ['title']
  1657. props.forEach(function (key) {
  1658. properties[key] = {
  1659. type: null,
  1660. observer: createObserver(key)
  1661. };
  1662. });
  1663. } else if (isPlainObject(props)) {
  1664. // {title:{type:String,default:''},content:String}
  1665. Object.keys(props).forEach(function (key) {
  1666. var opts = props[key];
  1667. if (isPlainObject(opts)) {
  1668. // title:{type:String,default:''}
  1669. var value = opts.default;
  1670. if (isFn(value)) {
  1671. value = value();
  1672. }
  1673. opts.type = parsePropType(key, opts.type);
  1674. properties[key] = {
  1675. type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
  1676. value: value,
  1677. observer: createObserver(key)
  1678. };
  1679. } else {
  1680. // content:String
  1681. var type = parsePropType(key, opts);
  1682. properties[key] = {
  1683. type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
  1684. observer: createObserver(key)
  1685. };
  1686. }
  1687. });
  1688. }
  1689. return properties;
  1690. }
  1691. function wrapper$1(event) {
  1692. // TODO 又得兼容 mpvue 的 mp 对象
  1693. try {
  1694. event.mp = JSON.parse(JSON.stringify(event));
  1695. } catch (e) {}
  1696. event.stopPropagation = noop;
  1697. event.preventDefault = noop;
  1698. event.target = event.target || {};
  1699. if (!hasOwn(event, 'detail')) {
  1700. event.detail = {};
  1701. }
  1702. if (hasOwn(event, 'markerId')) {
  1703. event.detail = (0, _typeof2.default)(event.detail) === 'object' ? event.detail : {};
  1704. event.detail.markerId = event.markerId;
  1705. }
  1706. if (isPlainObject(event.detail)) {
  1707. event.target = Object.assign({}, event.target, event.detail);
  1708. }
  1709. return event;
  1710. }
  1711. function getExtraValue(vm, dataPathsArray) {
  1712. var context = vm;
  1713. dataPathsArray.forEach(function (dataPathArray) {
  1714. var dataPath = dataPathArray[0];
  1715. var value = dataPathArray[2];
  1716. if (dataPath || typeof value !== 'undefined') {
  1717. // ['','',index,'disable']
  1718. var propPath = dataPathArray[1];
  1719. var valuePath = dataPathArray[3];
  1720. var vFor;
  1721. if (Number.isInteger(dataPath)) {
  1722. vFor = dataPath;
  1723. } else if (!dataPath) {
  1724. vFor = context;
  1725. } else if (typeof dataPath === 'string' && dataPath) {
  1726. if (dataPath.indexOf('#s#') === 0) {
  1727. vFor = dataPath.substr(3);
  1728. } else {
  1729. vFor = vm.__get_value(dataPath, context);
  1730. }
  1731. }
  1732. if (Number.isInteger(vFor)) {
  1733. context = value;
  1734. } else if (!propPath) {
  1735. context = vFor[value];
  1736. } else {
  1737. if (Array.isArray(vFor)) {
  1738. context = vFor.find(function (vForItem) {
  1739. return vm.__get_value(propPath, vForItem) === value;
  1740. });
  1741. } else if (isPlainObject(vFor)) {
  1742. context = Object.keys(vFor).find(function (vForKey) {
  1743. return vm.__get_value(propPath, vFor[vForKey]) === value;
  1744. });
  1745. } else {
  1746. console.error('v-for 暂不支持循环数据:', vFor);
  1747. }
  1748. }
  1749. if (valuePath) {
  1750. context = vm.__get_value(valuePath, context);
  1751. }
  1752. }
  1753. });
  1754. return context;
  1755. }
  1756. function processEventExtra(vm, extra, event, __args__) {
  1757. var extraObj = {};
  1758. if (Array.isArray(extra) && extra.length) {
  1759. /**
  1760. *[
  1761. * ['data.items', 'data.id', item.data.id],
  1762. * ['metas', 'id', meta.id]
  1763. *],
  1764. *[
  1765. * ['data.items', 'data.id', item.data.id],
  1766. * ['metas', 'id', meta.id]
  1767. *],
  1768. *'test'
  1769. */
  1770. extra.forEach(function (dataPath, index) {
  1771. if (typeof dataPath === 'string') {
  1772. if (!dataPath) {
  1773. // model,prop.sync
  1774. extraObj['$' + index] = vm;
  1775. } else {
  1776. if (dataPath === '$event') {
  1777. // $event
  1778. extraObj['$' + index] = event;
  1779. } else if (dataPath === 'arguments') {
  1780. extraObj['$' + index] = event.detail ? event.detail.__args__ || __args__ : __args__;
  1781. } else if (dataPath.indexOf('$event.') === 0) {
  1782. // $event.target.value
  1783. extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
  1784. } else {
  1785. extraObj['$' + index] = vm.__get_value(dataPath);
  1786. }
  1787. }
  1788. } else {
  1789. extraObj['$' + index] = getExtraValue(vm, dataPath);
  1790. }
  1791. });
  1792. }
  1793. return extraObj;
  1794. }
  1795. function getObjByArray(arr) {
  1796. var obj = {};
  1797. for (var i = 1; i < arr.length; i++) {
  1798. var element = arr[i];
  1799. obj[element[0]] = element[1];
  1800. }
  1801. return obj;
  1802. }
  1803. function processEventArgs(vm, event) {
  1804. var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  1805. var extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  1806. var isCustom = arguments.length > 4 ? arguments[4] : undefined;
  1807. var methodName = arguments.length > 5 ? arguments[5] : undefined;
  1808. var isCustomMPEvent = false; // wxcomponent 组件,传递原始 event 对象
  1809. // fixed 用户直接触发 mpInstance.triggerEvent
  1810. var __args__ = isPlainObject(event.detail) ? event.detail.__args__ || [event.detail] : [event.detail];
  1811. if (isCustom) {
  1812. // 自定义事件
  1813. isCustomMPEvent = event.currentTarget && event.currentTarget.dataset && event.currentTarget.dataset.comType === 'wx';
  1814. if (!args.length) {
  1815. // 无参数,直接传入 event 或 detail 数组
  1816. if (isCustomMPEvent) {
  1817. return [event];
  1818. }
  1819. return __args__;
  1820. }
  1821. }
  1822. var extraObj = processEventExtra(vm, extra, event, __args__);
  1823. var ret = [];
  1824. args.forEach(function (arg) {
  1825. if (arg === '$event') {
  1826. if (methodName === '__set_model' && !isCustom) {
  1827. // input v-model value
  1828. ret.push(event.target.value);
  1829. } else {
  1830. if (isCustom && !isCustomMPEvent) {
  1831. ret.push(__args__[0]);
  1832. } else {
  1833. // wxcomponent 组件或内置组件
  1834. ret.push(event);
  1835. }
  1836. }
  1837. } else {
  1838. if (Array.isArray(arg) && arg[0] === 'o') {
  1839. ret.push(getObjByArray(arg));
  1840. } else if (typeof arg === 'string' && hasOwn(extraObj, arg)) {
  1841. ret.push(extraObj[arg]);
  1842. } else {
  1843. ret.push(arg);
  1844. }
  1845. }
  1846. });
  1847. return ret;
  1848. }
  1849. var ONCE = '~';
  1850. var CUSTOM = '^';
  1851. function isMatchEventType(eventType, optType) {
  1852. return eventType === optType || optType === 'regionchange' && (eventType === 'begin' || eventType === 'end');
  1853. }
  1854. function getContextVm(vm) {
  1855. var $parent = vm.$parent;
  1856. // 父组件是 scoped slots 或者其他自定义组件时继续查找
  1857. while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) {
  1858. $parent = $parent.$parent;
  1859. }
  1860. return $parent && $parent.$parent;
  1861. }
  1862. function handleEvent(event) {
  1863. var _this2 = this;
  1864. event = wrapper$1(event);
  1865. // [['tap',[['handle',[1,2,a]],['handle1',[1,2,a]]]]]
  1866. var dataset = (event.currentTarget || event.target).dataset;
  1867. if (!dataset) {
  1868. return console.warn('事件信息不存在');
  1869. }
  1870. var eventOpts = dataset.eventOpts || dataset['event-opts']; // 支付宝 web-view 组件 dataset 非驼峰
  1871. if (!eventOpts) {
  1872. return console.warn('事件信息不存在');
  1873. }
  1874. // [['handle',[1,2,a]],['handle1',[1,2,a]]]
  1875. var eventType = event.type;
  1876. var ret = [];
  1877. eventOpts.forEach(function (eventOpt) {
  1878. var type = eventOpt[0];
  1879. var eventsArray = eventOpt[1];
  1880. var isCustom = type.charAt(0) === CUSTOM;
  1881. type = isCustom ? type.slice(1) : type;
  1882. var isOnce = type.charAt(0) === ONCE;
  1883. type = isOnce ? type.slice(1) : type;
  1884. if (eventsArray && isMatchEventType(eventType, type)) {
  1885. eventsArray.forEach(function (eventArray) {
  1886. var methodName = eventArray[0];
  1887. if (methodName) {
  1888. var handlerCtx = _this2.$vm;
  1889. if (handlerCtx.$options.generic) {
  1890. // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
  1891. handlerCtx = getContextVm(handlerCtx) || handlerCtx;
  1892. }
  1893. if (methodName === '$emit') {
  1894. handlerCtx.$emit.apply(handlerCtx, processEventArgs(_this2.$vm, event, eventArray[1], eventArray[2], isCustom, methodName));
  1895. return;
  1896. }
  1897. var handler = handlerCtx[methodName];
  1898. if (!isFn(handler)) {
  1899. var _type = _this2.$vm.mpType === 'page' ? 'Page' : 'Component';
  1900. var path = _this2.route || _this2.is;
  1901. throw new Error("".concat(_type, " \"").concat(path, "\" does not have a method \"").concat(methodName, "\""));
  1902. }
  1903. if (isOnce) {
  1904. if (handler.once) {
  1905. return;
  1906. }
  1907. handler.once = true;
  1908. }
  1909. var params = processEventArgs(_this2.$vm, event, eventArray[1], eventArray[2], isCustom, methodName);
  1910. params = Array.isArray(params) ? params : [];
  1911. // 参数尾部增加原始事件对象用于复杂表达式内获取额外数据
  1912. if (/=\s*\S+\.eventParams\s*\|\|\s*\S+\[['"]event-params['"]\]/.test(handler.toString())) {
  1913. // eslint-disable-next-line no-sparse-arrays
  1914. params = params.concat([,,,,,,,,,, event]);
  1915. }
  1916. ret.push(handler.apply(handlerCtx, params));
  1917. }
  1918. });
  1919. }
  1920. });
  1921. if (eventType === 'input' && ret.length === 1 && typeof ret[0] !== 'undefined') {
  1922. return ret[0];
  1923. }
  1924. }
  1925. var eventChannels = {};
  1926. function getEventChannel(id) {
  1927. var eventChannel = eventChannels[id];
  1928. delete eventChannels[id];
  1929. return eventChannel;
  1930. }
  1931. var hooks = ['onShow', 'onHide', 'onError', 'onPageNotFound', 'onThemeChange', 'onUnhandledRejection'];
  1932. function initEventChannel() {
  1933. _vue.default.prototype.getOpenerEventChannel = function () {
  1934. // 微信小程序使用自身getOpenerEventChannel
  1935. {
  1936. return this.$scope.getOpenerEventChannel();
  1937. }
  1938. };
  1939. var callHook = _vue.default.prototype.__call_hook;
  1940. _vue.default.prototype.__call_hook = function (hook, args) {
  1941. if (hook === 'onLoad' && args && args.__id__) {
  1942. this.__eventChannel__ = getEventChannel(args.__id__);
  1943. delete args.__id__;
  1944. }
  1945. return callHook.call(this, hook, args);
  1946. };
  1947. }
  1948. function initScopedSlotsParams() {
  1949. var center = {};
  1950. var parents = {};
  1951. function currentId(fn) {
  1952. var vueIds = this.$options.propsData.vueId;
  1953. if (vueIds) {
  1954. var vueId = vueIds.split(',')[0];
  1955. fn(vueId);
  1956. }
  1957. }
  1958. _vue.default.prototype.$hasSSP = function (vueId) {
  1959. var slot = center[vueId];
  1960. if (!slot) {
  1961. parents[vueId] = this;
  1962. this.$on('hook:destroyed', function () {
  1963. delete parents[vueId];
  1964. });
  1965. }
  1966. return slot;
  1967. };
  1968. _vue.default.prototype.$getSSP = function (vueId, name, needAll) {
  1969. var slot = center[vueId];
  1970. if (slot) {
  1971. var params = slot[name] || [];
  1972. if (needAll) {
  1973. return params;
  1974. }
  1975. return params[0];
  1976. }
  1977. };
  1978. _vue.default.prototype.$setSSP = function (name, value) {
  1979. var index = 0;
  1980. currentId.call(this, function (vueId) {
  1981. var slot = center[vueId];
  1982. var params = slot[name] = slot[name] || [];
  1983. params.push(value);
  1984. index = params.length - 1;
  1985. });
  1986. return index;
  1987. };
  1988. _vue.default.prototype.$initSSP = function () {
  1989. currentId.call(this, function (vueId) {
  1990. center[vueId] = {};
  1991. });
  1992. };
  1993. _vue.default.prototype.$callSSP = function () {
  1994. currentId.call(this, function (vueId) {
  1995. if (parents[vueId]) {
  1996. parents[vueId].$forceUpdate();
  1997. }
  1998. });
  1999. };
  2000. _vue.default.mixin({
  2001. destroyed: function destroyed() {
  2002. var propsData = this.$options.propsData;
  2003. var vueId = propsData && propsData.vueId;
  2004. if (vueId) {
  2005. delete center[vueId];
  2006. delete parents[vueId];
  2007. }
  2008. }
  2009. });
  2010. }
  2011. function parseBaseApp(vm, _ref4) {
  2012. var mocks = _ref4.mocks,
  2013. initRefs = _ref4.initRefs;
  2014. initEventChannel();
  2015. {
  2016. initScopedSlotsParams();
  2017. }
  2018. if (vm.$options.store) {
  2019. _vue.default.prototype.$store = vm.$options.store;
  2020. }
  2021. uniIdMixin(_vue.default);
  2022. _vue.default.prototype.mpHost = "mp-weixin";
  2023. _vue.default.mixin({
  2024. beforeCreate: function beforeCreate() {
  2025. if (!this.$options.mpType) {
  2026. return;
  2027. }
  2028. this.mpType = this.$options.mpType;
  2029. this.$mp = (0, _defineProperty2.default)({
  2030. data: {}
  2031. }, this.mpType, this.$options.mpInstance);
  2032. this.$scope = this.$options.mpInstance;
  2033. delete this.$options.mpType;
  2034. delete this.$options.mpInstance;
  2035. if (this.mpType === 'page' && typeof getApp === 'function') {
  2036. // hack vue-i18n
  2037. var app = getApp();
  2038. if (app.$vm && app.$vm.$i18n) {
  2039. this._i18n = app.$vm.$i18n;
  2040. }
  2041. }
  2042. if (this.mpType !== 'app') {
  2043. initRefs(this);
  2044. initMocks(this, mocks);
  2045. }
  2046. }
  2047. });
  2048. var appOptions = {
  2049. onLaunch: function onLaunch(args) {
  2050. if (this.$vm) {
  2051. // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
  2052. return;
  2053. }
  2054. {
  2055. if (wx.canIUse && !wx.canIUse('nextTick')) {
  2056. // 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断
  2057. console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上');
  2058. }
  2059. }
  2060. this.$vm = vm;
  2061. this.$vm.$mp = {
  2062. app: this
  2063. };
  2064. this.$vm.$scope = this;
  2065. // vm 上也挂载 globalData
  2066. this.$vm.globalData = this.globalData;
  2067. this.$vm._isMounted = true;
  2068. this.$vm.__call_hook('mounted', args);
  2069. this.$vm.__call_hook('onLaunch', args);
  2070. }
  2071. };
  2072. // 兼容旧版本 globalData
  2073. appOptions.globalData = vm.$options.globalData || {};
  2074. // 将 methods 中的方法挂在 getApp() 中
  2075. var methods = vm.$options.methods;
  2076. if (methods) {
  2077. Object.keys(methods).forEach(function (name) {
  2078. appOptions[name] = methods[name];
  2079. });
  2080. }
  2081. initAppLocale(_vue.default, vm, normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN);
  2082. initHooks(appOptions, hooks);
  2083. initUnknownHooks(appOptions, vm.$options);
  2084. return appOptions;
  2085. }
  2086. function parseApp(vm) {
  2087. return parseBaseApp(vm, {
  2088. mocks: mocks,
  2089. initRefs: initRefs
  2090. });
  2091. }
  2092. function createApp(vm) {
  2093. App(parseApp(vm));
  2094. return vm;
  2095. }
  2096. var encodeReserveRE = /[!'()*]/g;
  2097. var encodeReserveReplacer = function encodeReserveReplacer(c) {
  2098. return '%' + c.charCodeAt(0).toString(16);
  2099. };
  2100. var commaRE = /%2C/g;
  2101. // fixed encodeURIComponent which is more conformant to RFC3986:
  2102. // - escapes [!'()*]
  2103. // - preserve commas
  2104. var encode = function encode(str) {
  2105. return encodeURIComponent(str).replace(encodeReserveRE, encodeReserveReplacer).replace(commaRE, ',');
  2106. };
  2107. function stringifyQuery(obj) {
  2108. var encodeStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : encode;
  2109. var res = obj ? Object.keys(obj).map(function (key) {
  2110. var val = obj[key];
  2111. if (val === undefined) {
  2112. return '';
  2113. }
  2114. if (val === null) {
  2115. return encodeStr(key);
  2116. }
  2117. if (Array.isArray(val)) {
  2118. var result = [];
  2119. val.forEach(function (val2) {
  2120. if (val2 === undefined) {
  2121. return;
  2122. }
  2123. if (val2 === null) {
  2124. result.push(encodeStr(key));
  2125. } else {
  2126. result.push(encodeStr(key) + '=' + encodeStr(val2));
  2127. }
  2128. });
  2129. return result.join('&');
  2130. }
  2131. return encodeStr(key) + '=' + encodeStr(val);
  2132. }).filter(function (x) {
  2133. return x.length > 0;
  2134. }).join('&') : null;
  2135. return res ? "?".concat(res) : '';
  2136. }
  2137. function parseBaseComponent(vueComponentOptions) {
  2138. var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  2139. isPage = _ref5.isPage,
  2140. initRelation = _ref5.initRelation;
  2141. var needVueOptions = arguments.length > 2 ? arguments[2] : undefined;
  2142. var _initVueComponent = initVueComponent(_vue.default, vueComponentOptions),
  2143. _initVueComponent2 = (0, _slicedToArray2.default)(_initVueComponent, 2),
  2144. VueComponent = _initVueComponent2[0],
  2145. vueOptions = _initVueComponent2[1];
  2146. var options = _objectSpread({
  2147. multipleSlots: true,
  2148. // styleIsolation: 'apply-shared',
  2149. addGlobalClass: true
  2150. }, vueOptions.options || {});
  2151. {
  2152. // 微信 multipleSlots 部分情况有 bug,导致内容顺序错乱 如 u-list,提供覆盖选项
  2153. if (vueOptions['mp-weixin'] && vueOptions['mp-weixin'].options) {
  2154. Object.assign(options, vueOptions['mp-weixin'].options);
  2155. }
  2156. }
  2157. var componentOptions = {
  2158. options: options,
  2159. data: initData(vueOptions, _vue.default.prototype),
  2160. behaviors: initBehaviors(vueOptions, initBehavior),
  2161. properties: initProperties(vueOptions.props, false, vueOptions.__file, options),
  2162. lifetimes: {
  2163. attached: function attached() {
  2164. var properties = this.properties;
  2165. var options = {
  2166. mpType: isPage.call(this) ? 'page' : 'component',
  2167. mpInstance: this,
  2168. propsData: properties
  2169. };
  2170. initVueIds(properties.vueId, this);
  2171. // 处理父子关系
  2172. initRelation.call(this, {
  2173. vuePid: this._$vuePid,
  2174. vueOptions: options
  2175. });
  2176. // 初始化 vue 实例
  2177. this.$vm = new VueComponent(options);
  2178. // 处理$slots,$scopedSlots(暂不支持动态变化$slots)
  2179. initSlots(this.$vm, properties.vueSlots);
  2180. // 触发首次 setData
  2181. this.$vm.$mount();
  2182. },
  2183. ready: function ready() {
  2184. // 当组件 props 默认值为 true,初始化时传入 false 会导致 created,ready 触发, 但 attached 不触发
  2185. // https://developers.weixin.qq.com/community/develop/doc/00066ae2844cc0f8eb883e2a557800
  2186. if (this.$vm) {
  2187. this.$vm._isMounted = true;
  2188. this.$vm.__call_hook('mounted');
  2189. this.$vm.__call_hook('onReady');
  2190. }
  2191. },
  2192. detached: function detached() {
  2193. this.$vm && this.$vm.$destroy();
  2194. }
  2195. },
  2196. pageLifetimes: {
  2197. show: function show(args) {
  2198. this.$vm && this.$vm.__call_hook('onPageShow', args);
  2199. },
  2200. hide: function hide() {
  2201. this.$vm && this.$vm.__call_hook('onPageHide');
  2202. },
  2203. resize: function resize(size) {
  2204. this.$vm && this.$vm.__call_hook('onPageResize', size);
  2205. }
  2206. },
  2207. methods: {
  2208. __l: handleLink,
  2209. __e: handleEvent
  2210. }
  2211. };
  2212. // externalClasses
  2213. if (vueOptions.externalClasses) {
  2214. componentOptions.externalClasses = vueOptions.externalClasses;
  2215. }
  2216. if (Array.isArray(vueOptions.wxsCallMethods)) {
  2217. vueOptions.wxsCallMethods.forEach(function (callMethod) {
  2218. componentOptions.methods[callMethod] = function (args) {
  2219. return this.$vm[callMethod](args);
  2220. };
  2221. });
  2222. }
  2223. if (needVueOptions) {
  2224. return [componentOptions, vueOptions, VueComponent];
  2225. }
  2226. if (isPage) {
  2227. return componentOptions;
  2228. }
  2229. return [componentOptions, VueComponent];
  2230. }
  2231. function parseComponent(vueComponentOptions, needVueOptions) {
  2232. return parseBaseComponent(vueComponentOptions, {
  2233. isPage: isPage,
  2234. initRelation: initRelation
  2235. }, needVueOptions);
  2236. }
  2237. var hooks$1 = ['onShow', 'onHide', 'onUnload'];
  2238. hooks$1.push.apply(hooks$1, PAGE_EVENT_HOOKS);
  2239. function parseBasePage(vuePageOptions) {
  2240. var _parseComponent = parseComponent(vuePageOptions, true),
  2241. _parseComponent2 = (0, _slicedToArray2.default)(_parseComponent, 2),
  2242. pageOptions = _parseComponent2[0],
  2243. vueOptions = _parseComponent2[1];
  2244. initHooks(pageOptions.methods, hooks$1, vueOptions);
  2245. pageOptions.methods.onLoad = function (query) {
  2246. this.options = query;
  2247. var copyQuery = Object.assign({}, query);
  2248. delete copyQuery.__id__;
  2249. this.$page = {
  2250. fullPath: '/' + (this.route || this.is) + stringifyQuery(copyQuery)
  2251. };
  2252. this.$vm.$mp.query = query; // 兼容 mpvue
  2253. this.$vm.__call_hook('onLoad', query);
  2254. };
  2255. {
  2256. initUnknownHooks(pageOptions.methods, vuePageOptions, ['onReady']);
  2257. }
  2258. {
  2259. initWorkletMethods(pageOptions.methods, vueOptions.methods);
  2260. }
  2261. return pageOptions;
  2262. }
  2263. function parsePage(vuePageOptions) {
  2264. return parseBasePage(vuePageOptions);
  2265. }
  2266. function createPage(vuePageOptions) {
  2267. {
  2268. return Component(parsePage(vuePageOptions));
  2269. }
  2270. }
  2271. function createComponent(vueOptions) {
  2272. {
  2273. return Component(parseComponent(vueOptions));
  2274. }
  2275. }
  2276. function createSubpackageApp(vm) {
  2277. var appOptions = parseApp(vm);
  2278. var app = getApp({
  2279. allowDefault: true
  2280. });
  2281. vm.$scope = app;
  2282. var globalData = app.globalData;
  2283. if (globalData) {
  2284. Object.keys(appOptions.globalData).forEach(function (name) {
  2285. if (!hasOwn(globalData, name)) {
  2286. globalData[name] = appOptions.globalData[name];
  2287. }
  2288. });
  2289. }
  2290. Object.keys(appOptions).forEach(function (name) {
  2291. if (!hasOwn(app, name)) {
  2292. app[name] = appOptions[name];
  2293. }
  2294. });
  2295. if (isFn(appOptions.onShow) && wx.onAppShow) {
  2296. wx.onAppShow(function () {
  2297. for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
  2298. args[_key5] = arguments[_key5];
  2299. }
  2300. vm.__call_hook('onShow', args);
  2301. });
  2302. }
  2303. if (isFn(appOptions.onHide) && wx.onAppHide) {
  2304. wx.onAppHide(function () {
  2305. for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
  2306. args[_key6] = arguments[_key6];
  2307. }
  2308. vm.__call_hook('onHide', args);
  2309. });
  2310. }
  2311. if (isFn(appOptions.onLaunch)) {
  2312. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  2313. vm.__call_hook('onLaunch', args);
  2314. }
  2315. return vm;
  2316. }
  2317. function createPlugin(vm) {
  2318. var appOptions = parseApp(vm);
  2319. if (isFn(appOptions.onShow) && wx.onAppShow) {
  2320. wx.onAppShow(function () {
  2321. for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
  2322. args[_key7] = arguments[_key7];
  2323. }
  2324. vm.__call_hook('onShow', args);
  2325. });
  2326. }
  2327. if (isFn(appOptions.onHide) && wx.onAppHide) {
  2328. wx.onAppHide(function () {
  2329. for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
  2330. args[_key8] = arguments[_key8];
  2331. }
  2332. vm.__call_hook('onHide', args);
  2333. });
  2334. }
  2335. if (isFn(appOptions.onLaunch)) {
  2336. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  2337. vm.__call_hook('onLaunch', args);
  2338. }
  2339. return vm;
  2340. }
  2341. todos.forEach(function (todoApi) {
  2342. protocols[todoApi] = false;
  2343. });
  2344. canIUses.forEach(function (canIUseApi) {
  2345. var apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name : canIUseApi;
  2346. if (!wx.canIUse(apiName)) {
  2347. protocols[canIUseApi] = false;
  2348. }
  2349. });
  2350. var uni = {};
  2351. if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') {
  2352. uni = new Proxy({}, {
  2353. get: function get(target, name) {
  2354. if (hasOwn(target, name)) {
  2355. return target[name];
  2356. }
  2357. if (baseApi[name]) {
  2358. return baseApi[name];
  2359. }
  2360. if (api[name]) {
  2361. return promisify(name, api[name]);
  2362. }
  2363. {
  2364. if (extraApi[name]) {
  2365. return promisify(name, extraApi[name]);
  2366. }
  2367. if (todoApis[name]) {
  2368. return promisify(name, todoApis[name]);
  2369. }
  2370. }
  2371. if (eventApi[name]) {
  2372. return eventApi[name];
  2373. }
  2374. return promisify(name, wrapper(name, wx[name]));
  2375. },
  2376. set: function set(target, name, value) {
  2377. target[name] = value;
  2378. return true;
  2379. }
  2380. });
  2381. } else {
  2382. Object.keys(baseApi).forEach(function (name) {
  2383. uni[name] = baseApi[name];
  2384. });
  2385. {
  2386. Object.keys(todoApis).forEach(function (name) {
  2387. uni[name] = promisify(name, todoApis[name]);
  2388. });
  2389. Object.keys(extraApi).forEach(function (name) {
  2390. uni[name] = promisify(name, extraApi[name]);
  2391. });
  2392. }
  2393. Object.keys(eventApi).forEach(function (name) {
  2394. uni[name] = eventApi[name];
  2395. });
  2396. Object.keys(api).forEach(function (name) {
  2397. uni[name] = promisify(name, api[name]);
  2398. });
  2399. Object.keys(wx).forEach(function (name) {
  2400. if (hasOwn(wx, name) || hasOwn(protocols, name)) {
  2401. uni[name] = promisify(name, wrapper(name, wx[name]));
  2402. }
  2403. });
  2404. }
  2405. wx.createApp = createApp;
  2406. wx.createPage = createPage;
  2407. wx.createComponent = createComponent;
  2408. wx.createSubpackageApp = createSubpackageApp;
  2409. wx.createPlugin = createPlugin;
  2410. var uni$1 = uni;
  2411. var _default = uni$1;
  2412. exports.default = _default;
  2413. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"], __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 5)))
  2414. /***/ }),
  2415. /* 5 */
  2416. /*!***********************************!*\
  2417. !*** (webpack)/buildin/global.js ***!
  2418. \***********************************/
  2419. /*! no static exports found */
  2420. /***/ (function(module, exports) {
  2421. var g;
  2422. // This works in non-strict mode
  2423. g = (function() {
  2424. return this;
  2425. })();
  2426. try {
  2427. // This works if eval is allowed (see CSP)
  2428. g = g || new Function("return this")();
  2429. } catch (e) {
  2430. // This works if the window reference is available
  2431. if (typeof window === "object") g = window;
  2432. }
  2433. // g can still be undefined, but nothing to do about it...
  2434. // We return undefined, instead of nothing here, so it's
  2435. // easier to handle this case. if(!global) { ...}
  2436. module.exports = g;
  2437. /***/ }),
  2438. /* 6 */
  2439. /*!**********************************************************************!*\
  2440. !*** ./node_modules/@babel/runtime/helpers/interopRequireDefault.js ***!
  2441. \**********************************************************************/
  2442. /*! no static exports found */
  2443. /***/ (function(module, exports) {
  2444. function _interopRequireDefault(obj) {
  2445. return obj && obj.__esModule ? obj : {
  2446. "default": obj
  2447. };
  2448. }
  2449. module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2450. /***/ }),
  2451. /* 7 */
  2452. /*!**************************************************************!*\
  2453. !*** ./node_modules/@babel/runtime/helpers/slicedToArray.js ***!
  2454. \**************************************************************/
  2455. /*! no static exports found */
  2456. /***/ (function(module, exports, __webpack_require__) {
  2457. var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles.js */ 8);
  2458. var iterableToArrayLimit = __webpack_require__(/*! ./iterableToArrayLimit.js */ 9);
  2459. var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ 10);
  2460. var nonIterableRest = __webpack_require__(/*! ./nonIterableRest.js */ 12);
  2461. function _slicedToArray(arr, i) {
  2462. return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
  2463. }
  2464. module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2465. /***/ }),
  2466. /* 8 */
  2467. /*!***************************************************************!*\
  2468. !*** ./node_modules/@babel/runtime/helpers/arrayWithHoles.js ***!
  2469. \***************************************************************/
  2470. /*! no static exports found */
  2471. /***/ (function(module, exports) {
  2472. function _arrayWithHoles(arr) {
  2473. if (Array.isArray(arr)) return arr;
  2474. }
  2475. module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2476. /***/ }),
  2477. /* 9 */
  2478. /*!*********************************************************************!*\
  2479. !*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
  2480. \*********************************************************************/
  2481. /*! no static exports found */
  2482. /***/ (function(module, exports) {
  2483. function _iterableToArrayLimit(arr, i) {
  2484. var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
  2485. if (null != _i) {
  2486. var _s,
  2487. _e,
  2488. _x,
  2489. _r,
  2490. _arr = [],
  2491. _n = !0,
  2492. _d = !1;
  2493. try {
  2494. if (_x = (_i = _i.call(arr)).next, 0 === i) {
  2495. if (Object(_i) !== _i) return;
  2496. _n = !1;
  2497. } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) {
  2498. ;
  2499. }
  2500. } catch (err) {
  2501. _d = !0, _e = err;
  2502. } finally {
  2503. try {
  2504. if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
  2505. } finally {
  2506. if (_d) throw _e;
  2507. }
  2508. }
  2509. return _arr;
  2510. }
  2511. }
  2512. module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2513. /***/ }),
  2514. /* 10 */
  2515. /*!***************************************************************************!*\
  2516. !*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!
  2517. \***************************************************************************/
  2518. /*! no static exports found */
  2519. /***/ (function(module, exports, __webpack_require__) {
  2520. var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ 11);
  2521. function _unsupportedIterableToArray(o, minLen) {
  2522. if (!o) return;
  2523. if (typeof o === "string") return arrayLikeToArray(o, minLen);
  2524. var n = Object.prototype.toString.call(o).slice(8, -1);
  2525. if (n === "Object" && o.constructor) n = o.constructor.name;
  2526. if (n === "Map" || n === "Set") return Array.from(o);
  2527. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
  2528. }
  2529. module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2530. /***/ }),
  2531. /* 11 */
  2532. /*!*****************************************************************!*\
  2533. !*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***!
  2534. \*****************************************************************/
  2535. /*! no static exports found */
  2536. /***/ (function(module, exports) {
  2537. function _arrayLikeToArray(arr, len) {
  2538. if (len == null || len > arr.length) len = arr.length;
  2539. for (var i = 0, arr2 = new Array(len); i < len; i++) {
  2540. arr2[i] = arr[i];
  2541. }
  2542. return arr2;
  2543. }
  2544. module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2545. /***/ }),
  2546. /* 12 */
  2547. /*!****************************************************************!*\
  2548. !*** ./node_modules/@babel/runtime/helpers/nonIterableRest.js ***!
  2549. \****************************************************************/
  2550. /*! no static exports found */
  2551. /***/ (function(module, exports) {
  2552. function _nonIterableRest() {
  2553. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  2554. }
  2555. module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2556. /***/ }),
  2557. /* 13 */
  2558. /*!***************************************************************!*\
  2559. !*** ./node_modules/@babel/runtime/helpers/defineProperty.js ***!
  2560. \***************************************************************/
  2561. /*! no static exports found */
  2562. /***/ (function(module, exports, __webpack_require__) {
  2563. var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ 14);
  2564. function _defineProperty(obj, key, value) {
  2565. key = toPropertyKey(key);
  2566. if (key in obj) {
  2567. Object.defineProperty(obj, key, {
  2568. value: value,
  2569. enumerable: true,
  2570. configurable: true,
  2571. writable: true
  2572. });
  2573. } else {
  2574. obj[key] = value;
  2575. }
  2576. return obj;
  2577. }
  2578. module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2579. /***/ }),
  2580. /* 14 */
  2581. /*!**************************************************************!*\
  2582. !*** ./node_modules/@babel/runtime/helpers/toPropertyKey.js ***!
  2583. \**************************************************************/
  2584. /*! no static exports found */
  2585. /***/ (function(module, exports, __webpack_require__) {
  2586. var _typeof = __webpack_require__(/*! ./typeof.js */ 15)["default"];
  2587. var toPrimitive = __webpack_require__(/*! ./toPrimitive.js */ 16);
  2588. function _toPropertyKey(arg) {
  2589. var key = toPrimitive(arg, "string");
  2590. return _typeof(key) === "symbol" ? key : String(key);
  2591. }
  2592. module.exports = _toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2593. /***/ }),
  2594. /* 15 */
  2595. /*!*******************************************************!*\
  2596. !*** ./node_modules/@babel/runtime/helpers/typeof.js ***!
  2597. \*******************************************************/
  2598. /*! no static exports found */
  2599. /***/ (function(module, exports) {
  2600. function _typeof(obj) {
  2601. "@babel/helpers - typeof";
  2602. return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
  2603. return typeof obj;
  2604. } : function (obj) {
  2605. return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  2606. }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
  2607. }
  2608. module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2609. /***/ }),
  2610. /* 16 */
  2611. /*!************************************************************!*\
  2612. !*** ./node_modules/@babel/runtime/helpers/toPrimitive.js ***!
  2613. \************************************************************/
  2614. /*! no static exports found */
  2615. /***/ (function(module, exports, __webpack_require__) {
  2616. var _typeof = __webpack_require__(/*! ./typeof.js */ 15)["default"];
  2617. function _toPrimitive(input, hint) {
  2618. if (_typeof(input) !== "object" || input === null) return input;
  2619. var prim = input[Symbol.toPrimitive];
  2620. if (prim !== undefined) {
  2621. var res = prim.call(input, hint || "default");
  2622. if (_typeof(res) !== "object") return res;
  2623. throw new TypeError("@@toPrimitive must return a primitive value.");
  2624. }
  2625. return (hint === "string" ? String : Number)(input);
  2626. }
  2627. module.exports = _toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2628. /***/ }),
  2629. /* 17 */
  2630. /*!**********************************************************!*\
  2631. !*** ./node_modules/@babel/runtime/helpers/construct.js ***!
  2632. \**********************************************************/
  2633. /*! no static exports found */
  2634. /***/ (function(module, exports, __webpack_require__) {
  2635. var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ 18);
  2636. var isNativeReflectConstruct = __webpack_require__(/*! ./isNativeReflectConstruct.js */ 19);
  2637. function _construct(Parent, args, Class) {
  2638. if (isNativeReflectConstruct()) {
  2639. module.exports = _construct = Reflect.construct.bind(), module.exports.__esModule = true, module.exports["default"] = module.exports;
  2640. } else {
  2641. module.exports = _construct = function _construct(Parent, args, Class) {
  2642. var a = [null];
  2643. a.push.apply(a, args);
  2644. var Constructor = Function.bind.apply(Parent, a);
  2645. var instance = new Constructor();
  2646. if (Class) setPrototypeOf(instance, Class.prototype);
  2647. return instance;
  2648. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2649. }
  2650. return _construct.apply(null, arguments);
  2651. }
  2652. module.exports = _construct, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2653. /***/ }),
  2654. /* 18 */
  2655. /*!***************************************************************!*\
  2656. !*** ./node_modules/@babel/runtime/helpers/setPrototypeOf.js ***!
  2657. \***************************************************************/
  2658. /*! no static exports found */
  2659. /***/ (function(module, exports) {
  2660. function _setPrototypeOf(o, p) {
  2661. module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
  2662. o.__proto__ = p;
  2663. return o;
  2664. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2665. return _setPrototypeOf(o, p);
  2666. }
  2667. module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2668. /***/ }),
  2669. /* 19 */
  2670. /*!*************************************************************************!*\
  2671. !*** ./node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js ***!
  2672. \*************************************************************************/
  2673. /*! no static exports found */
  2674. /***/ (function(module, exports) {
  2675. function _isNativeReflectConstruct() {
  2676. if (typeof Reflect === "undefined" || !Reflect.construct) return false;
  2677. if (Reflect.construct.sham) return false;
  2678. if (typeof Proxy === "function") return true;
  2679. try {
  2680. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
  2681. return true;
  2682. } catch (e) {
  2683. return false;
  2684. }
  2685. }
  2686. module.exports = _isNativeReflectConstruct, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2687. /***/ }),
  2688. /* 20 */
  2689. /*!******************************************************************!*\
  2690. !*** ./node_modules/@babel/runtime/helpers/toConsumableArray.js ***!
  2691. \******************************************************************/
  2692. /*! no static exports found */
  2693. /***/ (function(module, exports, __webpack_require__) {
  2694. var arrayWithoutHoles = __webpack_require__(/*! ./arrayWithoutHoles.js */ 21);
  2695. var iterableToArray = __webpack_require__(/*! ./iterableToArray.js */ 22);
  2696. var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ 10);
  2697. var nonIterableSpread = __webpack_require__(/*! ./nonIterableSpread.js */ 23);
  2698. function _toConsumableArray(arr) {
  2699. return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
  2700. }
  2701. module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2702. /***/ }),
  2703. /* 21 */
  2704. /*!******************************************************************!*\
  2705. !*** ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***!
  2706. \******************************************************************/
  2707. /*! no static exports found */
  2708. /***/ (function(module, exports, __webpack_require__) {
  2709. var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ 11);
  2710. function _arrayWithoutHoles(arr) {
  2711. if (Array.isArray(arr)) return arrayLikeToArray(arr);
  2712. }
  2713. module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2714. /***/ }),
  2715. /* 22 */
  2716. /*!****************************************************************!*\
  2717. !*** ./node_modules/@babel/runtime/helpers/iterableToArray.js ***!
  2718. \****************************************************************/
  2719. /*! no static exports found */
  2720. /***/ (function(module, exports) {
  2721. function _iterableToArray(iter) {
  2722. if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
  2723. }
  2724. module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2725. /***/ }),
  2726. /* 23 */
  2727. /*!******************************************************************!*\
  2728. !*** ./node_modules/@babel/runtime/helpers/nonIterableSpread.js ***!
  2729. \******************************************************************/
  2730. /*! no static exports found */
  2731. /***/ (function(module, exports) {
  2732. function _nonIterableSpread() {
  2733. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  2734. }
  2735. module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2736. /***/ }),
  2737. /* 24 */
  2738. /*!*************************************************************!*\
  2739. !*** ./node_modules/@dcloudio/uni-i18n/dist/uni-i18n.es.js ***!
  2740. \*************************************************************/
  2741. /*! no static exports found */
  2742. /***/ (function(module, exports, __webpack_require__) {
  2743. "use strict";
  2744. /* WEBPACK VAR INJECTION */(function(uni, global) {
  2745. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 6);
  2746. Object.defineProperty(exports, "__esModule", {
  2747. value: true
  2748. });
  2749. exports.LOCALE_ZH_HANT = exports.LOCALE_ZH_HANS = exports.LOCALE_FR = exports.LOCALE_ES = exports.LOCALE_EN = exports.I18n = exports.Formatter = void 0;
  2750. exports.compileI18nJsonStr = compileI18nJsonStr;
  2751. exports.hasI18nJson = hasI18nJson;
  2752. exports.initVueI18n = initVueI18n;
  2753. exports.isI18nStr = isI18nStr;
  2754. exports.isString = void 0;
  2755. exports.normalizeLocale = normalizeLocale;
  2756. exports.parseI18nJson = parseI18nJson;
  2757. exports.resolveLocale = resolveLocale;
  2758. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 7));
  2759. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 25));
  2760. var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 26));
  2761. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 15));
  2762. var isObject = function isObject(val) {
  2763. return val !== null && (0, _typeof2.default)(val) === 'object';
  2764. };
  2765. var defaultDelimiters = ['{', '}'];
  2766. var BaseFormatter = /*#__PURE__*/function () {
  2767. function BaseFormatter() {
  2768. (0, _classCallCheck2.default)(this, BaseFormatter);
  2769. this._caches = Object.create(null);
  2770. }
  2771. (0, _createClass2.default)(BaseFormatter, [{
  2772. key: "interpolate",
  2773. value: function interpolate(message, values) {
  2774. var delimiters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultDelimiters;
  2775. if (!values) {
  2776. return [message];
  2777. }
  2778. var tokens = this._caches[message];
  2779. if (!tokens) {
  2780. tokens = parse(message, delimiters);
  2781. this._caches[message] = tokens;
  2782. }
  2783. return compile(tokens, values);
  2784. }
  2785. }]);
  2786. return BaseFormatter;
  2787. }();
  2788. exports.Formatter = BaseFormatter;
  2789. var RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
  2790. var RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
  2791. function parse(format, _ref) {
  2792. var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
  2793. startDelimiter = _ref2[0],
  2794. endDelimiter = _ref2[1];
  2795. var tokens = [];
  2796. var position = 0;
  2797. var text = '';
  2798. while (position < format.length) {
  2799. var char = format[position++];
  2800. if (char === startDelimiter) {
  2801. if (text) {
  2802. tokens.push({
  2803. type: 'text',
  2804. value: text
  2805. });
  2806. }
  2807. text = '';
  2808. var sub = '';
  2809. char = format[position++];
  2810. while (char !== undefined && char !== endDelimiter) {
  2811. sub += char;
  2812. char = format[position++];
  2813. }
  2814. var isClosed = char === endDelimiter;
  2815. var type = RE_TOKEN_LIST_VALUE.test(sub) ? 'list' : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ? 'named' : 'unknown';
  2816. tokens.push({
  2817. value: sub,
  2818. type: type
  2819. });
  2820. }
  2821. // else if (char === '%') {
  2822. // // when found rails i18n syntax, skip text capture
  2823. // if (format[position] !== '{') {
  2824. // text += char
  2825. // }
  2826. // }
  2827. else {
  2828. text += char;
  2829. }
  2830. }
  2831. text && tokens.push({
  2832. type: 'text',
  2833. value: text
  2834. });
  2835. return tokens;
  2836. }
  2837. function compile(tokens, values) {
  2838. var compiled = [];
  2839. var index = 0;
  2840. var mode = Array.isArray(values) ? 'list' : isObject(values) ? 'named' : 'unknown';
  2841. if (mode === 'unknown') {
  2842. return compiled;
  2843. }
  2844. while (index < tokens.length) {
  2845. var token = tokens[index];
  2846. switch (token.type) {
  2847. case 'text':
  2848. compiled.push(token.value);
  2849. break;
  2850. case 'list':
  2851. compiled.push(values[parseInt(token.value, 10)]);
  2852. break;
  2853. case 'named':
  2854. if (mode === 'named') {
  2855. compiled.push(values[token.value]);
  2856. } else {
  2857. if (true) {
  2858. console.warn("Type of token '".concat(token.type, "' and format of value '").concat(mode, "' don't match!"));
  2859. }
  2860. }
  2861. break;
  2862. case 'unknown':
  2863. if (true) {
  2864. console.warn("Detect 'unknown' type of token!");
  2865. }
  2866. break;
  2867. }
  2868. index++;
  2869. }
  2870. return compiled;
  2871. }
  2872. var LOCALE_ZH_HANS = 'zh-Hans';
  2873. exports.LOCALE_ZH_HANS = LOCALE_ZH_HANS;
  2874. var LOCALE_ZH_HANT = 'zh-Hant';
  2875. exports.LOCALE_ZH_HANT = LOCALE_ZH_HANT;
  2876. var LOCALE_EN = 'en';
  2877. exports.LOCALE_EN = LOCALE_EN;
  2878. var LOCALE_FR = 'fr';
  2879. exports.LOCALE_FR = LOCALE_FR;
  2880. var LOCALE_ES = 'es';
  2881. exports.LOCALE_ES = LOCALE_ES;
  2882. var hasOwnProperty = Object.prototype.hasOwnProperty;
  2883. var hasOwn = function hasOwn(val, key) {
  2884. return hasOwnProperty.call(val, key);
  2885. };
  2886. var defaultFormatter = new BaseFormatter();
  2887. function include(str, parts) {
  2888. return !!parts.find(function (part) {
  2889. return str.indexOf(part) !== -1;
  2890. });
  2891. }
  2892. function startsWith(str, parts) {
  2893. return parts.find(function (part) {
  2894. return str.indexOf(part) === 0;
  2895. });
  2896. }
  2897. function normalizeLocale(locale, messages) {
  2898. if (!locale) {
  2899. return;
  2900. }
  2901. locale = locale.trim().replace(/_/g, '-');
  2902. if (messages && messages[locale]) {
  2903. return locale;
  2904. }
  2905. locale = locale.toLowerCase();
  2906. if (locale === 'chinese') {
  2907. // 支付宝
  2908. return LOCALE_ZH_HANS;
  2909. }
  2910. if (locale.indexOf('zh') === 0) {
  2911. if (locale.indexOf('-hans') > -1) {
  2912. return LOCALE_ZH_HANS;
  2913. }
  2914. if (locale.indexOf('-hant') > -1) {
  2915. return LOCALE_ZH_HANT;
  2916. }
  2917. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  2918. return LOCALE_ZH_HANT;
  2919. }
  2920. return LOCALE_ZH_HANS;
  2921. }
  2922. var locales = [LOCALE_EN, LOCALE_FR, LOCALE_ES];
  2923. if (messages && Object.keys(messages).length > 0) {
  2924. locales = Object.keys(messages);
  2925. }
  2926. var lang = startsWith(locale, locales);
  2927. if (lang) {
  2928. return lang;
  2929. }
  2930. }
  2931. var I18n = /*#__PURE__*/function () {
  2932. function I18n(_ref3) {
  2933. var locale = _ref3.locale,
  2934. fallbackLocale = _ref3.fallbackLocale,
  2935. messages = _ref3.messages,
  2936. watcher = _ref3.watcher,
  2937. formater = _ref3.formater;
  2938. (0, _classCallCheck2.default)(this, I18n);
  2939. this.locale = LOCALE_EN;
  2940. this.fallbackLocale = LOCALE_EN;
  2941. this.message = {};
  2942. this.messages = {};
  2943. this.watchers = [];
  2944. if (fallbackLocale) {
  2945. this.fallbackLocale = fallbackLocale;
  2946. }
  2947. this.formater = formater || defaultFormatter;
  2948. this.messages = messages || {};
  2949. this.setLocale(locale || LOCALE_EN);
  2950. if (watcher) {
  2951. this.watchLocale(watcher);
  2952. }
  2953. }
  2954. (0, _createClass2.default)(I18n, [{
  2955. key: "setLocale",
  2956. value: function setLocale(locale) {
  2957. var _this = this;
  2958. var oldLocale = this.locale;
  2959. this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale;
  2960. if (!this.messages[this.locale]) {
  2961. // 可能初始化时不存在
  2962. this.messages[this.locale] = {};
  2963. }
  2964. this.message = this.messages[this.locale];
  2965. // 仅发生变化时,通知
  2966. if (oldLocale !== this.locale) {
  2967. this.watchers.forEach(function (watcher) {
  2968. watcher(_this.locale, oldLocale);
  2969. });
  2970. }
  2971. }
  2972. }, {
  2973. key: "getLocale",
  2974. value: function getLocale() {
  2975. return this.locale;
  2976. }
  2977. }, {
  2978. key: "watchLocale",
  2979. value: function watchLocale(fn) {
  2980. var _this2 = this;
  2981. var index = this.watchers.push(fn) - 1;
  2982. return function () {
  2983. _this2.watchers.splice(index, 1);
  2984. };
  2985. }
  2986. }, {
  2987. key: "add",
  2988. value: function add(locale, message) {
  2989. var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  2990. var curMessages = this.messages[locale];
  2991. if (curMessages) {
  2992. if (override) {
  2993. Object.assign(curMessages, message);
  2994. } else {
  2995. Object.keys(message).forEach(function (key) {
  2996. if (!hasOwn(curMessages, key)) {
  2997. curMessages[key] = message[key];
  2998. }
  2999. });
  3000. }
  3001. } else {
  3002. this.messages[locale] = message;
  3003. }
  3004. }
  3005. }, {
  3006. key: "f",
  3007. value: function f(message, values, delimiters) {
  3008. return this.formater.interpolate(message, values, delimiters).join('');
  3009. }
  3010. }, {
  3011. key: "t",
  3012. value: function t(key, locale, values) {
  3013. var message = this.message;
  3014. if (typeof locale === 'string') {
  3015. locale = normalizeLocale(locale, this.messages);
  3016. locale && (message = this.messages[locale]);
  3017. } else {
  3018. values = locale;
  3019. }
  3020. if (!hasOwn(message, key)) {
  3021. console.warn("Cannot translate the value of keypath ".concat(key, ". Use the value of keypath as default."));
  3022. return key;
  3023. }
  3024. return this.formater.interpolate(message[key], values).join('');
  3025. }
  3026. }]);
  3027. return I18n;
  3028. }();
  3029. exports.I18n = I18n;
  3030. function watchAppLocale(appVm, i18n) {
  3031. // 需要保证 watch 的触发在组件渲染之前
  3032. if (appVm.$watchLocale) {
  3033. // vue2
  3034. appVm.$watchLocale(function (newLocale) {
  3035. i18n.setLocale(newLocale);
  3036. });
  3037. } else {
  3038. appVm.$watch(function () {
  3039. return appVm.$locale;
  3040. }, function (newLocale) {
  3041. i18n.setLocale(newLocale);
  3042. });
  3043. }
  3044. }
  3045. function getDefaultLocale() {
  3046. if (typeof uni !== 'undefined' && uni.getLocale) {
  3047. return uni.getLocale();
  3048. }
  3049. // 小程序平台,uni 和 uni-i18n 互相引用,导致访问不到 uni,故在 global 上挂了 getLocale
  3050. if (typeof global !== 'undefined' && global.getLocale) {
  3051. return global.getLocale();
  3052. }
  3053. return LOCALE_EN;
  3054. }
  3055. function initVueI18n(locale) {
  3056. var messages = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  3057. var fallbackLocale = arguments.length > 2 ? arguments[2] : undefined;
  3058. var watcher = arguments.length > 3 ? arguments[3] : undefined;
  3059. // 兼容旧版本入参
  3060. if (typeof locale !== 'string') {
  3061. var _ref4 = [messages, locale];
  3062. locale = _ref4[0];
  3063. messages = _ref4[1];
  3064. }
  3065. if (typeof locale !== 'string') {
  3066. // 因为小程序平台,uni-i18n 和 uni 互相引用,导致此时访问 uni 时,为 undefined
  3067. locale = getDefaultLocale();
  3068. }
  3069. if (typeof fallbackLocale !== 'string') {
  3070. fallbackLocale = typeof __uniConfig !== 'undefined' && __uniConfig.fallbackLocale || LOCALE_EN;
  3071. }
  3072. var i18n = new I18n({
  3073. locale: locale,
  3074. fallbackLocale: fallbackLocale,
  3075. messages: messages,
  3076. watcher: watcher
  3077. });
  3078. var _t = function t(key, values) {
  3079. if (typeof getApp !== 'function') {
  3080. // app view
  3081. /* eslint-disable no-func-assign */
  3082. _t = function t(key, values) {
  3083. return i18n.t(key, values);
  3084. };
  3085. } else {
  3086. var isWatchedAppLocale = false;
  3087. _t = function t(key, values) {
  3088. var appVm = getApp().$vm;
  3089. // 可能$vm还不存在,比如在支付宝小程序中,组件定义较早,在props的default里使用了t()函数(如uni-goods-nav),此时app还未初始化
  3090. // options: {
  3091. // type: Array,
  3092. // default () {
  3093. // return [{
  3094. // icon: 'shop',
  3095. // text: t("uni-goods-nav.options.shop"),
  3096. // }, {
  3097. // icon: 'cart',
  3098. // text: t("uni-goods-nav.options.cart")
  3099. // }]
  3100. // }
  3101. // },
  3102. if (appVm) {
  3103. // 触发响应式
  3104. appVm.$locale;
  3105. if (!isWatchedAppLocale) {
  3106. isWatchedAppLocale = true;
  3107. watchAppLocale(appVm, i18n);
  3108. }
  3109. }
  3110. return i18n.t(key, values);
  3111. };
  3112. }
  3113. return _t(key, values);
  3114. };
  3115. return {
  3116. i18n: i18n,
  3117. f: function f(message, values, delimiters) {
  3118. return i18n.f(message, values, delimiters);
  3119. },
  3120. t: function t(key, values) {
  3121. return _t(key, values);
  3122. },
  3123. add: function add(locale, message) {
  3124. var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  3125. return i18n.add(locale, message, override);
  3126. },
  3127. watch: function watch(fn) {
  3128. return i18n.watchLocale(fn);
  3129. },
  3130. getLocale: function getLocale() {
  3131. return i18n.getLocale();
  3132. },
  3133. setLocale: function setLocale(newLocale) {
  3134. return i18n.setLocale(newLocale);
  3135. }
  3136. };
  3137. }
  3138. var isString = function isString(val) {
  3139. return typeof val === 'string';
  3140. };
  3141. exports.isString = isString;
  3142. var formater;
  3143. function hasI18nJson(jsonObj, delimiters) {
  3144. if (!formater) {
  3145. formater = new BaseFormatter();
  3146. }
  3147. return walkJsonObj(jsonObj, function (jsonObj, key) {
  3148. var value = jsonObj[key];
  3149. if (isString(value)) {
  3150. if (isI18nStr(value, delimiters)) {
  3151. return true;
  3152. }
  3153. } else {
  3154. return hasI18nJson(value, delimiters);
  3155. }
  3156. });
  3157. }
  3158. function parseI18nJson(jsonObj, values, delimiters) {
  3159. if (!formater) {
  3160. formater = new BaseFormatter();
  3161. }
  3162. walkJsonObj(jsonObj, function (jsonObj, key) {
  3163. var value = jsonObj[key];
  3164. if (isString(value)) {
  3165. if (isI18nStr(value, delimiters)) {
  3166. jsonObj[key] = compileStr(value, values, delimiters);
  3167. }
  3168. } else {
  3169. parseI18nJson(value, values, delimiters);
  3170. }
  3171. });
  3172. return jsonObj;
  3173. }
  3174. function compileI18nJsonStr(jsonStr, _ref5) {
  3175. var locale = _ref5.locale,
  3176. locales = _ref5.locales,
  3177. delimiters = _ref5.delimiters;
  3178. if (!isI18nStr(jsonStr, delimiters)) {
  3179. return jsonStr;
  3180. }
  3181. if (!formater) {
  3182. formater = new BaseFormatter();
  3183. }
  3184. var localeValues = [];
  3185. Object.keys(locales).forEach(function (name) {
  3186. if (name !== locale) {
  3187. localeValues.push({
  3188. locale: name,
  3189. values: locales[name]
  3190. });
  3191. }
  3192. });
  3193. localeValues.unshift({
  3194. locale: locale,
  3195. values: locales[locale]
  3196. });
  3197. try {
  3198. return JSON.stringify(compileJsonObj(JSON.parse(jsonStr), localeValues, delimiters), null, 2);
  3199. } catch (e) {}
  3200. return jsonStr;
  3201. }
  3202. function isI18nStr(value, delimiters) {
  3203. return value.indexOf(delimiters[0]) > -1;
  3204. }
  3205. function compileStr(value, values, delimiters) {
  3206. return formater.interpolate(value, values, delimiters).join('');
  3207. }
  3208. function compileValue(jsonObj, key, localeValues, delimiters) {
  3209. var value = jsonObj[key];
  3210. if (isString(value)) {
  3211. // 存在国际化
  3212. if (isI18nStr(value, delimiters)) {
  3213. jsonObj[key] = compileStr(value, localeValues[0].values, delimiters);
  3214. if (localeValues.length > 1) {
  3215. // 格式化国际化语言
  3216. var valueLocales = jsonObj[key + 'Locales'] = {};
  3217. localeValues.forEach(function (localValue) {
  3218. valueLocales[localValue.locale] = compileStr(value, localValue.values, delimiters);
  3219. });
  3220. }
  3221. }
  3222. } else {
  3223. compileJsonObj(value, localeValues, delimiters);
  3224. }
  3225. }
  3226. function compileJsonObj(jsonObj, localeValues, delimiters) {
  3227. walkJsonObj(jsonObj, function (jsonObj, key) {
  3228. compileValue(jsonObj, key, localeValues, delimiters);
  3229. });
  3230. return jsonObj;
  3231. }
  3232. function walkJsonObj(jsonObj, walk) {
  3233. if (Array.isArray(jsonObj)) {
  3234. for (var i = 0; i < jsonObj.length; i++) {
  3235. if (walk(jsonObj, i)) {
  3236. return true;
  3237. }
  3238. }
  3239. } else if (isObject(jsonObj)) {
  3240. for (var key in jsonObj) {
  3241. if (walk(jsonObj, key)) {
  3242. return true;
  3243. }
  3244. }
  3245. }
  3246. return false;
  3247. }
  3248. function resolveLocale(locales) {
  3249. return function (locale) {
  3250. if (!locale) {
  3251. return locale;
  3252. }
  3253. locale = normalizeLocale(locale) || locale;
  3254. return resolveLocaleChain(locale).find(function (locale) {
  3255. return locales.indexOf(locale) > -1;
  3256. });
  3257. };
  3258. }
  3259. function resolveLocaleChain(locale) {
  3260. var chain = [];
  3261. var tokens = locale.split('-');
  3262. while (tokens.length) {
  3263. chain.push(tokens.join('-'));
  3264. tokens.pop();
  3265. }
  3266. return chain;
  3267. }
  3268. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 4)["default"], __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 5)))
  3269. /***/ }),
  3270. /* 25 */
  3271. /*!***************************************************************!*\
  3272. !*** ./node_modules/@babel/runtime/helpers/classCallCheck.js ***!
  3273. \***************************************************************/
  3274. /*! no static exports found */
  3275. /***/ (function(module, exports) {
  3276. function _classCallCheck(instance, Constructor) {
  3277. if (!(instance instanceof Constructor)) {
  3278. throw new TypeError("Cannot call a class as a function");
  3279. }
  3280. }
  3281. module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3282. /***/ }),
  3283. /* 26 */
  3284. /*!************************************************************!*\
  3285. !*** ./node_modules/@babel/runtime/helpers/createClass.js ***!
  3286. \************************************************************/
  3287. /*! no static exports found */
  3288. /***/ (function(module, exports, __webpack_require__) {
  3289. var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ 14);
  3290. function _defineProperties(target, props) {
  3291. for (var i = 0; i < props.length; i++) {
  3292. var descriptor = props[i];
  3293. descriptor.enumerable = descriptor.enumerable || false;
  3294. descriptor.configurable = true;
  3295. if ("value" in descriptor) descriptor.writable = true;
  3296. Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
  3297. }
  3298. }
  3299. function _createClass(Constructor, protoProps, staticProps) {
  3300. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  3301. if (staticProps) _defineProperties(Constructor, staticProps);
  3302. Object.defineProperty(Constructor, "prototype", {
  3303. writable: false
  3304. });
  3305. return Constructor;
  3306. }
  3307. module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3308. /***/ }),
  3309. /* 27 */
  3310. /*!******************************************************************************************!*\
  3311. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js ***!
  3312. \******************************************************************************************/
  3313. /*! exports provided: default */
  3314. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3315. "use strict";
  3316. __webpack_require__.r(__webpack_exports__);
  3317. /* WEBPACK VAR INJECTION */(function(global) {/*!
  3318. * Vue.js v2.6.11
  3319. * (c) 2014-2023 Evan You
  3320. * Released under the MIT License.
  3321. */
  3322. /* */
  3323. var emptyObject = Object.freeze({});
  3324. // These helpers produce better VM code in JS engines due to their
  3325. // explicitness and function inlining.
  3326. function isUndef (v) {
  3327. return v === undefined || v === null
  3328. }
  3329. function isDef (v) {
  3330. return v !== undefined && v !== null
  3331. }
  3332. function isTrue (v) {
  3333. return v === true
  3334. }
  3335. function isFalse (v) {
  3336. return v === false
  3337. }
  3338. /**
  3339. * Check if value is primitive.
  3340. */
  3341. function isPrimitive (value) {
  3342. return (
  3343. typeof value === 'string' ||
  3344. typeof value === 'number' ||
  3345. // $flow-disable-line
  3346. typeof value === 'symbol' ||
  3347. typeof value === 'boolean'
  3348. )
  3349. }
  3350. /**
  3351. * Quick object check - this is primarily used to tell
  3352. * Objects from primitive values when we know the value
  3353. * is a JSON-compliant type.
  3354. */
  3355. function isObject (obj) {
  3356. return obj !== null && typeof obj === 'object'
  3357. }
  3358. /**
  3359. * Get the raw type string of a value, e.g., [object Object].
  3360. */
  3361. var _toString = Object.prototype.toString;
  3362. function toRawType (value) {
  3363. return _toString.call(value).slice(8, -1)
  3364. }
  3365. /**
  3366. * Strict object type check. Only returns true
  3367. * for plain JavaScript objects.
  3368. */
  3369. function isPlainObject (obj) {
  3370. return _toString.call(obj) === '[object Object]'
  3371. }
  3372. function isRegExp (v) {
  3373. return _toString.call(v) === '[object RegExp]'
  3374. }
  3375. /**
  3376. * Check if val is a valid array index.
  3377. */
  3378. function isValidArrayIndex (val) {
  3379. var n = parseFloat(String(val));
  3380. return n >= 0 && Math.floor(n) === n && isFinite(val)
  3381. }
  3382. function isPromise (val) {
  3383. return (
  3384. isDef(val) &&
  3385. typeof val.then === 'function' &&
  3386. typeof val.catch === 'function'
  3387. )
  3388. }
  3389. /**
  3390. * Convert a value to a string that is actually rendered.
  3391. */
  3392. function toString (val) {
  3393. return val == null
  3394. ? ''
  3395. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  3396. ? JSON.stringify(val, null, 2)
  3397. : String(val)
  3398. }
  3399. /**
  3400. * Convert an input value to a number for persistence.
  3401. * If the conversion fails, return original string.
  3402. */
  3403. function toNumber (val) {
  3404. var n = parseFloat(val);
  3405. return isNaN(n) ? val : n
  3406. }
  3407. /**
  3408. * Make a map and return a function for checking if a key
  3409. * is in that map.
  3410. */
  3411. function makeMap (
  3412. str,
  3413. expectsLowerCase
  3414. ) {
  3415. var map = Object.create(null);
  3416. var list = str.split(',');
  3417. for (var i = 0; i < list.length; i++) {
  3418. map[list[i]] = true;
  3419. }
  3420. return expectsLowerCase
  3421. ? function (val) { return map[val.toLowerCase()]; }
  3422. : function (val) { return map[val]; }
  3423. }
  3424. /**
  3425. * Check if a tag is a built-in tag.
  3426. */
  3427. var isBuiltInTag = makeMap('slot,component', true);
  3428. /**
  3429. * Check if an attribute is a reserved attribute.
  3430. */
  3431. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  3432. /**
  3433. * Remove an item from an array.
  3434. */
  3435. function remove (arr, item) {
  3436. if (arr.length) {
  3437. var index = arr.indexOf(item);
  3438. if (index > -1) {
  3439. return arr.splice(index, 1)
  3440. }
  3441. }
  3442. }
  3443. /**
  3444. * Check whether an object has the property.
  3445. */
  3446. var hasOwnProperty = Object.prototype.hasOwnProperty;
  3447. function hasOwn (obj, key) {
  3448. return hasOwnProperty.call(obj, key)
  3449. }
  3450. /**
  3451. * Create a cached version of a pure function.
  3452. */
  3453. function cached (fn) {
  3454. var cache = Object.create(null);
  3455. return (function cachedFn (str) {
  3456. var hit = cache[str];
  3457. return hit || (cache[str] = fn(str))
  3458. })
  3459. }
  3460. /**
  3461. * Camelize a hyphen-delimited string.
  3462. */
  3463. var camelizeRE = /-(\w)/g;
  3464. var camelize = cached(function (str) {
  3465. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  3466. });
  3467. /**
  3468. * Capitalize a string.
  3469. */
  3470. var capitalize = cached(function (str) {
  3471. return str.charAt(0).toUpperCase() + str.slice(1)
  3472. });
  3473. /**
  3474. * Hyphenate a camelCase string.
  3475. */
  3476. var hyphenateRE = /\B([A-Z])/g;
  3477. var hyphenate = cached(function (str) {
  3478. return str.replace(hyphenateRE, '-$1').toLowerCase()
  3479. });
  3480. /**
  3481. * Simple bind polyfill for environments that do not support it,
  3482. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  3483. * since native bind is now performant enough in most browsers.
  3484. * But removing it would mean breaking code that was able to run in
  3485. * PhantomJS 1.x, so this must be kept for backward compatibility.
  3486. */
  3487. /* istanbul ignore next */
  3488. function polyfillBind (fn, ctx) {
  3489. function boundFn (a) {
  3490. var l = arguments.length;
  3491. return l
  3492. ? l > 1
  3493. ? fn.apply(ctx, arguments)
  3494. : fn.call(ctx, a)
  3495. : fn.call(ctx)
  3496. }
  3497. boundFn._length = fn.length;
  3498. return boundFn
  3499. }
  3500. function nativeBind (fn, ctx) {
  3501. return fn.bind(ctx)
  3502. }
  3503. var bind = Function.prototype.bind
  3504. ? nativeBind
  3505. : polyfillBind;
  3506. /**
  3507. * Convert an Array-like object to a real Array.
  3508. */
  3509. function toArray (list, start) {
  3510. start = start || 0;
  3511. var i = list.length - start;
  3512. var ret = new Array(i);
  3513. while (i--) {
  3514. ret[i] = list[i + start];
  3515. }
  3516. return ret
  3517. }
  3518. /**
  3519. * Mix properties into target object.
  3520. */
  3521. function extend (to, _from) {
  3522. for (var key in _from) {
  3523. to[key] = _from[key];
  3524. }
  3525. return to
  3526. }
  3527. /**
  3528. * Merge an Array of Objects into a single Object.
  3529. */
  3530. function toObject (arr) {
  3531. var res = {};
  3532. for (var i = 0; i < arr.length; i++) {
  3533. if (arr[i]) {
  3534. extend(res, arr[i]);
  3535. }
  3536. }
  3537. return res
  3538. }
  3539. /* eslint-disable no-unused-vars */
  3540. /**
  3541. * Perform no operation.
  3542. * Stubbing args to make Flow happy without leaving useless transpiled code
  3543. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  3544. */
  3545. function noop (a, b, c) {}
  3546. /**
  3547. * Always return false.
  3548. */
  3549. var no = function (a, b, c) { return false; };
  3550. /* eslint-enable no-unused-vars */
  3551. /**
  3552. * Return the same value.
  3553. */
  3554. var identity = function (_) { return _; };
  3555. /**
  3556. * Check if two values are loosely equal - that is,
  3557. * if they are plain objects, do they have the same shape?
  3558. */
  3559. function looseEqual (a, b) {
  3560. if (a === b) { return true }
  3561. var isObjectA = isObject(a);
  3562. var isObjectB = isObject(b);
  3563. if (isObjectA && isObjectB) {
  3564. try {
  3565. var isArrayA = Array.isArray(a);
  3566. var isArrayB = Array.isArray(b);
  3567. if (isArrayA && isArrayB) {
  3568. return a.length === b.length && a.every(function (e, i) {
  3569. return looseEqual(e, b[i])
  3570. })
  3571. } else if (a instanceof Date && b instanceof Date) {
  3572. return a.getTime() === b.getTime()
  3573. } else if (!isArrayA && !isArrayB) {
  3574. var keysA = Object.keys(a);
  3575. var keysB = Object.keys(b);
  3576. return keysA.length === keysB.length && keysA.every(function (key) {
  3577. return looseEqual(a[key], b[key])
  3578. })
  3579. } else {
  3580. /* istanbul ignore next */
  3581. return false
  3582. }
  3583. } catch (e) {
  3584. /* istanbul ignore next */
  3585. return false
  3586. }
  3587. } else if (!isObjectA && !isObjectB) {
  3588. return String(a) === String(b)
  3589. } else {
  3590. return false
  3591. }
  3592. }
  3593. /**
  3594. * Return the first index at which a loosely equal value can be
  3595. * found in the array (if value is a plain object, the array must
  3596. * contain an object of the same shape), or -1 if it is not present.
  3597. */
  3598. function looseIndexOf (arr, val) {
  3599. for (var i = 0; i < arr.length; i++) {
  3600. if (looseEqual(arr[i], val)) { return i }
  3601. }
  3602. return -1
  3603. }
  3604. /**
  3605. * Ensure a function is called only once.
  3606. */
  3607. function once (fn) {
  3608. var called = false;
  3609. return function () {
  3610. if (!called) {
  3611. called = true;
  3612. fn.apply(this, arguments);
  3613. }
  3614. }
  3615. }
  3616. var ASSET_TYPES = [
  3617. 'component',
  3618. 'directive',
  3619. 'filter'
  3620. ];
  3621. var LIFECYCLE_HOOKS = [
  3622. 'beforeCreate',
  3623. 'created',
  3624. 'beforeMount',
  3625. 'mounted',
  3626. 'beforeUpdate',
  3627. 'updated',
  3628. 'beforeDestroy',
  3629. 'destroyed',
  3630. 'activated',
  3631. 'deactivated',
  3632. 'errorCaptured',
  3633. 'serverPrefetch'
  3634. ];
  3635. /* */
  3636. var config = ({
  3637. /**
  3638. * Option merge strategies (used in core/util/options)
  3639. */
  3640. // $flow-disable-line
  3641. optionMergeStrategies: Object.create(null),
  3642. /**
  3643. * Whether to suppress warnings.
  3644. */
  3645. silent: false,
  3646. /**
  3647. * Show production mode tip message on boot?
  3648. */
  3649. productionTip: "development" !== 'production',
  3650. /**
  3651. * Whether to enable devtools
  3652. */
  3653. devtools: "development" !== 'production',
  3654. /**
  3655. * Whether to record perf
  3656. */
  3657. performance: false,
  3658. /**
  3659. * Error handler for watcher errors
  3660. */
  3661. errorHandler: null,
  3662. /**
  3663. * Warn handler for watcher warns
  3664. */
  3665. warnHandler: null,
  3666. /**
  3667. * Ignore certain custom elements
  3668. */
  3669. ignoredElements: [],
  3670. /**
  3671. * Custom user key aliases for v-on
  3672. */
  3673. // $flow-disable-line
  3674. keyCodes: Object.create(null),
  3675. /**
  3676. * Check if a tag is reserved so that it cannot be registered as a
  3677. * component. This is platform-dependent and may be overwritten.
  3678. */
  3679. isReservedTag: no,
  3680. /**
  3681. * Check if an attribute is reserved so that it cannot be used as a component
  3682. * prop. This is platform-dependent and may be overwritten.
  3683. */
  3684. isReservedAttr: no,
  3685. /**
  3686. * Check if a tag is an unknown element.
  3687. * Platform-dependent.
  3688. */
  3689. isUnknownElement: no,
  3690. /**
  3691. * Get the namespace of an element
  3692. */
  3693. getTagNamespace: noop,
  3694. /**
  3695. * Parse the real tag name for the specific platform.
  3696. */
  3697. parsePlatformTagName: identity,
  3698. /**
  3699. * Check if an attribute must be bound using property, e.g. value
  3700. * Platform-dependent.
  3701. */
  3702. mustUseProp: no,
  3703. /**
  3704. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  3705. * This will significantly reduce performance if set to false.
  3706. */
  3707. async: true,
  3708. /**
  3709. * Exposed for legacy reasons
  3710. */
  3711. _lifecycleHooks: LIFECYCLE_HOOKS
  3712. });
  3713. /* */
  3714. /**
  3715. * unicode letters used for parsing html tags, component names and property paths.
  3716. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  3717. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  3718. */
  3719. 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/;
  3720. /**
  3721. * Check if a string starts with $ or _
  3722. */
  3723. function isReserved (str) {
  3724. var c = (str + '').charCodeAt(0);
  3725. return c === 0x24 || c === 0x5F
  3726. }
  3727. /**
  3728. * Define a property.
  3729. */
  3730. function def (obj, key, val, enumerable) {
  3731. Object.defineProperty(obj, key, {
  3732. value: val,
  3733. enumerable: !!enumerable,
  3734. writable: true,
  3735. configurable: true
  3736. });
  3737. }
  3738. /**
  3739. * Parse simple path.
  3740. */
  3741. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  3742. function parsePath (path) {
  3743. if (bailRE.test(path)) {
  3744. return
  3745. }
  3746. var segments = path.split('.');
  3747. return function (obj) {
  3748. for (var i = 0; i < segments.length; i++) {
  3749. if (!obj) { return }
  3750. obj = obj[segments[i]];
  3751. }
  3752. return obj
  3753. }
  3754. }
  3755. /* */
  3756. // can we use __proto__?
  3757. var hasProto = '__proto__' in {};
  3758. // Browser environment sniffing
  3759. var inBrowser = typeof window !== 'undefined';
  3760. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  3761. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  3762. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  3763. var isIE = UA && /msie|trident/.test(UA);
  3764. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  3765. var isEdge = UA && UA.indexOf('edge/') > 0;
  3766. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  3767. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  3768. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  3769. var isPhantomJS = UA && /phantomjs/.test(UA);
  3770. var isFF = UA && UA.match(/firefox\/(\d+)/);
  3771. // Firefox has a "watch" function on Object.prototype...
  3772. var nativeWatch = ({}).watch;
  3773. if (inBrowser) {
  3774. try {
  3775. var opts = {};
  3776. Object.defineProperty(opts, 'passive', ({
  3777. get: function get () {
  3778. }
  3779. })); // https://github.com/facebook/flow/issues/285
  3780. window.addEventListener('test-passive', null, opts);
  3781. } catch (e) {}
  3782. }
  3783. // this needs to be lazy-evaled because vue may be required before
  3784. // vue-server-renderer can set VUE_ENV
  3785. var _isServer;
  3786. var isServerRendering = function () {
  3787. if (_isServer === undefined) {
  3788. /* istanbul ignore if */
  3789. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  3790. // detect presence of vue-server-renderer and avoid
  3791. // Webpack shimming the process
  3792. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  3793. } else {
  3794. _isServer = false;
  3795. }
  3796. }
  3797. return _isServer
  3798. };
  3799. // detect devtools
  3800. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  3801. /* istanbul ignore next */
  3802. function isNative (Ctor) {
  3803. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  3804. }
  3805. var hasSymbol =
  3806. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  3807. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  3808. var _Set;
  3809. /* istanbul ignore if */ // $flow-disable-line
  3810. if (typeof Set !== 'undefined' && isNative(Set)) {
  3811. // use native Set when available.
  3812. _Set = Set;
  3813. } else {
  3814. // a non-standard Set polyfill that only works with primitive keys.
  3815. _Set = /*@__PURE__*/(function () {
  3816. function Set () {
  3817. this.set = Object.create(null);
  3818. }
  3819. Set.prototype.has = function has (key) {
  3820. return this.set[key] === true
  3821. };
  3822. Set.prototype.add = function add (key) {
  3823. this.set[key] = true;
  3824. };
  3825. Set.prototype.clear = function clear () {
  3826. this.set = Object.create(null);
  3827. };
  3828. return Set;
  3829. }());
  3830. }
  3831. /* */
  3832. var warn = noop;
  3833. var tip = noop;
  3834. var generateComponentTrace = (noop); // work around flow check
  3835. var formatComponentName = (noop);
  3836. if (true) {
  3837. var hasConsole = typeof console !== 'undefined';
  3838. var classifyRE = /(?:^|[-_])(\w)/g;
  3839. var classify = function (str) { return str
  3840. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  3841. .replace(/[-_]/g, ''); };
  3842. warn = function (msg, vm) {
  3843. var trace = vm ? generateComponentTrace(vm) : '';
  3844. if (config.warnHandler) {
  3845. config.warnHandler.call(null, msg, vm, trace);
  3846. } else if (hasConsole && (!config.silent)) {
  3847. console.error(("[Vue warn]: " + msg + trace));
  3848. }
  3849. };
  3850. tip = function (msg, vm) {
  3851. if (hasConsole && (!config.silent)) {
  3852. console.warn("[Vue tip]: " + msg + (
  3853. vm ? generateComponentTrace(vm) : ''
  3854. ));
  3855. }
  3856. };
  3857. formatComponentName = function (vm, includeFile) {
  3858. if (vm.$root === vm) {
  3859. if (vm.$options && vm.$options.__file) { // fixed by xxxxxx
  3860. return ('') + vm.$options.__file
  3861. }
  3862. return '<Root>'
  3863. }
  3864. var options = typeof vm === 'function' && vm.cid != null
  3865. ? vm.options
  3866. : vm._isVue
  3867. ? vm.$options || vm.constructor.options
  3868. : vm;
  3869. var name = options.name || options._componentTag;
  3870. var file = options.__file;
  3871. if (!name && file) {
  3872. var match = file.match(/([^/\\]+)\.vue$/);
  3873. name = match && match[1];
  3874. }
  3875. return (
  3876. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  3877. (file && includeFile !== false ? (" at " + file) : '')
  3878. )
  3879. };
  3880. var repeat = function (str, n) {
  3881. var res = '';
  3882. while (n) {
  3883. if (n % 2 === 1) { res += str; }
  3884. if (n > 1) { str += str; }
  3885. n >>= 1;
  3886. }
  3887. return res
  3888. };
  3889. generateComponentTrace = function (vm) {
  3890. if (vm._isVue && vm.$parent) {
  3891. var tree = [];
  3892. var currentRecursiveSequence = 0;
  3893. while (vm && vm.$options.name !== 'PageBody') {
  3894. if (tree.length > 0) {
  3895. var last = tree[tree.length - 1];
  3896. if (last.constructor === vm.constructor) {
  3897. currentRecursiveSequence++;
  3898. vm = vm.$parent;
  3899. continue
  3900. } else if (currentRecursiveSequence > 0) {
  3901. tree[tree.length - 1] = [last, currentRecursiveSequence];
  3902. currentRecursiveSequence = 0;
  3903. }
  3904. }
  3905. !vm.$options.isReserved && tree.push(vm);
  3906. vm = vm.$parent;
  3907. }
  3908. return '\n\nfound in\n\n' + tree
  3909. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  3910. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  3911. : formatComponentName(vm))); })
  3912. .join('\n')
  3913. } else {
  3914. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  3915. }
  3916. };
  3917. }
  3918. /* */
  3919. var uid = 0;
  3920. /**
  3921. * A dep is an observable that can have multiple
  3922. * directives subscribing to it.
  3923. */
  3924. var Dep = function Dep () {
  3925. this.id = uid++;
  3926. this.subs = [];
  3927. };
  3928. Dep.prototype.addSub = function addSub (sub) {
  3929. this.subs.push(sub);
  3930. };
  3931. Dep.prototype.removeSub = function removeSub (sub) {
  3932. remove(this.subs, sub);
  3933. };
  3934. Dep.prototype.depend = function depend () {
  3935. if (Dep.SharedObject.target) {
  3936. Dep.SharedObject.target.addDep(this);
  3937. }
  3938. };
  3939. Dep.prototype.notify = function notify () {
  3940. // stabilize the subscriber list first
  3941. var subs = this.subs.slice();
  3942. if ( true && !config.async) {
  3943. // subs aren't sorted in scheduler if not running async
  3944. // we need to sort them now to make sure they fire in correct
  3945. // order
  3946. subs.sort(function (a, b) { return a.id - b.id; });
  3947. }
  3948. for (var i = 0, l = subs.length; i < l; i++) {
  3949. subs[i].update();
  3950. }
  3951. };
  3952. // The current target watcher being evaluated.
  3953. // This is globally unique because only one watcher
  3954. // can be evaluated at a time.
  3955. // fixed by xxxxxx (nvue shared vuex)
  3956. /* eslint-disable no-undef */
  3957. Dep.SharedObject = {};
  3958. Dep.SharedObject.target = null;
  3959. Dep.SharedObject.targetStack = [];
  3960. function pushTarget (target) {
  3961. Dep.SharedObject.targetStack.push(target);
  3962. Dep.SharedObject.target = target;
  3963. Dep.target = target;
  3964. }
  3965. function popTarget () {
  3966. Dep.SharedObject.targetStack.pop();
  3967. Dep.SharedObject.target = Dep.SharedObject.targetStack[Dep.SharedObject.targetStack.length - 1];
  3968. Dep.target = Dep.SharedObject.target;
  3969. }
  3970. /* */
  3971. var VNode = function VNode (
  3972. tag,
  3973. data,
  3974. children,
  3975. text,
  3976. elm,
  3977. context,
  3978. componentOptions,
  3979. asyncFactory
  3980. ) {
  3981. this.tag = tag;
  3982. this.data = data;
  3983. this.children = children;
  3984. this.text = text;
  3985. this.elm = elm;
  3986. this.ns = undefined;
  3987. this.context = context;
  3988. this.fnContext = undefined;
  3989. this.fnOptions = undefined;
  3990. this.fnScopeId = undefined;
  3991. this.key = data && data.key;
  3992. this.componentOptions = componentOptions;
  3993. this.componentInstance = undefined;
  3994. this.parent = undefined;
  3995. this.raw = false;
  3996. this.isStatic = false;
  3997. this.isRootInsert = true;
  3998. this.isComment = false;
  3999. this.isCloned = false;
  4000. this.isOnce = false;
  4001. this.asyncFactory = asyncFactory;
  4002. this.asyncMeta = undefined;
  4003. this.isAsyncPlaceholder = false;
  4004. };
  4005. var prototypeAccessors = { child: { configurable: true } };
  4006. // DEPRECATED: alias for componentInstance for backwards compat.
  4007. /* istanbul ignore next */
  4008. prototypeAccessors.child.get = function () {
  4009. return this.componentInstance
  4010. };
  4011. Object.defineProperties( VNode.prototype, prototypeAccessors );
  4012. var createEmptyVNode = function (text) {
  4013. if ( text === void 0 ) text = '';
  4014. var node = new VNode();
  4015. node.text = text;
  4016. node.isComment = true;
  4017. return node
  4018. };
  4019. function createTextVNode (val) {
  4020. return new VNode(undefined, undefined, undefined, String(val))
  4021. }
  4022. // optimized shallow clone
  4023. // used for static nodes and slot nodes because they may be reused across
  4024. // multiple renders, cloning them avoids errors when DOM manipulations rely
  4025. // on their elm reference.
  4026. function cloneVNode (vnode) {
  4027. var cloned = new VNode(
  4028. vnode.tag,
  4029. vnode.data,
  4030. // #7975
  4031. // clone children array to avoid mutating original in case of cloning
  4032. // a child.
  4033. vnode.children && vnode.children.slice(),
  4034. vnode.text,
  4035. vnode.elm,
  4036. vnode.context,
  4037. vnode.componentOptions,
  4038. vnode.asyncFactory
  4039. );
  4040. cloned.ns = vnode.ns;
  4041. cloned.isStatic = vnode.isStatic;
  4042. cloned.key = vnode.key;
  4043. cloned.isComment = vnode.isComment;
  4044. cloned.fnContext = vnode.fnContext;
  4045. cloned.fnOptions = vnode.fnOptions;
  4046. cloned.fnScopeId = vnode.fnScopeId;
  4047. cloned.asyncMeta = vnode.asyncMeta;
  4048. cloned.isCloned = true;
  4049. return cloned
  4050. }
  4051. /*
  4052. * not type checking this file because flow doesn't play well with
  4053. * dynamically accessing methods on Array prototype
  4054. */
  4055. var arrayProto = Array.prototype;
  4056. var arrayMethods = Object.create(arrayProto);
  4057. var methodsToPatch = [
  4058. 'push',
  4059. 'pop',
  4060. 'shift',
  4061. 'unshift',
  4062. 'splice',
  4063. 'sort',
  4064. 'reverse'
  4065. ];
  4066. /**
  4067. * Intercept mutating methods and emit events
  4068. */
  4069. methodsToPatch.forEach(function (method) {
  4070. // cache original method
  4071. var original = arrayProto[method];
  4072. def(arrayMethods, method, function mutator () {
  4073. var args = [], len = arguments.length;
  4074. while ( len-- ) args[ len ] = arguments[ len ];
  4075. var result = original.apply(this, args);
  4076. var ob = this.__ob__;
  4077. var inserted;
  4078. switch (method) {
  4079. case 'push':
  4080. case 'unshift':
  4081. inserted = args;
  4082. break
  4083. case 'splice':
  4084. inserted = args.slice(2);
  4085. break
  4086. }
  4087. if (inserted) { ob.observeArray(inserted); }
  4088. // notify change
  4089. ob.dep.notify();
  4090. return result
  4091. });
  4092. });
  4093. /* */
  4094. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  4095. /**
  4096. * In some cases we may want to disable observation inside a component's
  4097. * update computation.
  4098. */
  4099. var shouldObserve = true;
  4100. function toggleObserving (value) {
  4101. shouldObserve = value;
  4102. }
  4103. /**
  4104. * Observer class that is attached to each observed
  4105. * object. Once attached, the observer converts the target
  4106. * object's property keys into getter/setters that
  4107. * collect dependencies and dispatch updates.
  4108. */
  4109. var Observer = function Observer (value) {
  4110. this.value = value;
  4111. this.dep = new Dep();
  4112. this.vmCount = 0;
  4113. def(value, '__ob__', this);
  4114. if (Array.isArray(value)) {
  4115. if (hasProto) {
  4116. {// fixed by xxxxxx 微信小程序使用 plugins 之后,数组方法被直接挂载到了数组对象上,需要执行 copyAugment 逻辑
  4117. if(value.push !== value.__proto__.push){
  4118. copyAugment(value, arrayMethods, arrayKeys);
  4119. } else {
  4120. protoAugment(value, arrayMethods);
  4121. }
  4122. }
  4123. } else {
  4124. copyAugment(value, arrayMethods, arrayKeys);
  4125. }
  4126. this.observeArray(value);
  4127. } else {
  4128. this.walk(value);
  4129. }
  4130. };
  4131. /**
  4132. * Walk through all properties and convert them into
  4133. * getter/setters. This method should only be called when
  4134. * value type is Object.
  4135. */
  4136. Observer.prototype.walk = function walk (obj) {
  4137. var keys = Object.keys(obj);
  4138. for (var i = 0; i < keys.length; i++) {
  4139. defineReactive$$1(obj, keys[i]);
  4140. }
  4141. };
  4142. /**
  4143. * Observe a list of Array items.
  4144. */
  4145. Observer.prototype.observeArray = function observeArray (items) {
  4146. for (var i = 0, l = items.length; i < l; i++) {
  4147. observe(items[i]);
  4148. }
  4149. };
  4150. // helpers
  4151. /**
  4152. * Augment a target Object or Array by intercepting
  4153. * the prototype chain using __proto__
  4154. */
  4155. function protoAugment (target, src) {
  4156. /* eslint-disable no-proto */
  4157. target.__proto__ = src;
  4158. /* eslint-enable no-proto */
  4159. }
  4160. /**
  4161. * Augment a target Object or Array by defining
  4162. * hidden properties.
  4163. */
  4164. /* istanbul ignore next */
  4165. function copyAugment (target, src, keys) {
  4166. for (var i = 0, l = keys.length; i < l; i++) {
  4167. var key = keys[i];
  4168. def(target, key, src[key]);
  4169. }
  4170. }
  4171. /**
  4172. * Attempt to create an observer instance for a value,
  4173. * returns the new observer if successfully observed,
  4174. * or the existing observer if the value already has one.
  4175. */
  4176. function observe (value, asRootData) {
  4177. if (!isObject(value) || value instanceof VNode) {
  4178. return
  4179. }
  4180. var ob;
  4181. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  4182. ob = value.__ob__;
  4183. } else if (
  4184. shouldObserve &&
  4185. !isServerRendering() &&
  4186. (Array.isArray(value) || isPlainObject(value)) &&
  4187. Object.isExtensible(value) &&
  4188. !value._isVue &&
  4189. !value.__v_isMPComponent
  4190. ) {
  4191. ob = new Observer(value);
  4192. }
  4193. if (asRootData && ob) {
  4194. ob.vmCount++;
  4195. }
  4196. return ob
  4197. }
  4198. /**
  4199. * Define a reactive property on an Object.
  4200. */
  4201. function defineReactive$$1 (
  4202. obj,
  4203. key,
  4204. val,
  4205. customSetter,
  4206. shallow
  4207. ) {
  4208. var dep = new Dep();
  4209. var property = Object.getOwnPropertyDescriptor(obj, key);
  4210. if (property && property.configurable === false) {
  4211. return
  4212. }
  4213. // cater for pre-defined getter/setters
  4214. var getter = property && property.get;
  4215. var setter = property && property.set;
  4216. if ((!getter || setter) && arguments.length === 2) {
  4217. val = obj[key];
  4218. }
  4219. var childOb = !shallow && observe(val);
  4220. Object.defineProperty(obj, key, {
  4221. enumerable: true,
  4222. configurable: true,
  4223. get: function reactiveGetter () {
  4224. var value = getter ? getter.call(obj) : val;
  4225. if (Dep.SharedObject.target) { // fixed by xxxxxx
  4226. dep.depend();
  4227. if (childOb) {
  4228. childOb.dep.depend();
  4229. if (Array.isArray(value)) {
  4230. dependArray(value);
  4231. }
  4232. }
  4233. }
  4234. return value
  4235. },
  4236. set: function reactiveSetter (newVal) {
  4237. var value = getter ? getter.call(obj) : val;
  4238. /* eslint-disable no-self-compare */
  4239. if (newVal === value || (newVal !== newVal && value !== value)) {
  4240. return
  4241. }
  4242. /* eslint-enable no-self-compare */
  4243. if ( true && customSetter) {
  4244. customSetter();
  4245. }
  4246. // #7981: for accessor properties without setter
  4247. if (getter && !setter) { return }
  4248. if (setter) {
  4249. setter.call(obj, newVal);
  4250. } else {
  4251. val = newVal;
  4252. }
  4253. childOb = !shallow && observe(newVal);
  4254. dep.notify();
  4255. }
  4256. });
  4257. }
  4258. /**
  4259. * Set a property on an object. Adds the new property and
  4260. * triggers change notification if the property doesn't
  4261. * already exist.
  4262. */
  4263. function set (target, key, val) {
  4264. if ( true &&
  4265. (isUndef(target) || isPrimitive(target))
  4266. ) {
  4267. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  4268. }
  4269. if (Array.isArray(target) && isValidArrayIndex(key)) {
  4270. target.length = Math.max(target.length, key);
  4271. target.splice(key, 1, val);
  4272. return val
  4273. }
  4274. if (key in target && !(key in Object.prototype)) {
  4275. target[key] = val;
  4276. return val
  4277. }
  4278. var ob = (target).__ob__;
  4279. if (target._isVue || (ob && ob.vmCount)) {
  4280. true && warn(
  4281. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  4282. 'at runtime - declare it upfront in the data option.'
  4283. );
  4284. return val
  4285. }
  4286. if (!ob) {
  4287. target[key] = val;
  4288. return val
  4289. }
  4290. defineReactive$$1(ob.value, key, val);
  4291. ob.dep.notify();
  4292. return val
  4293. }
  4294. /**
  4295. * Delete a property and trigger change if necessary.
  4296. */
  4297. function del (target, key) {
  4298. if ( true &&
  4299. (isUndef(target) || isPrimitive(target))
  4300. ) {
  4301. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  4302. }
  4303. if (Array.isArray(target) && isValidArrayIndex(key)) {
  4304. target.splice(key, 1);
  4305. return
  4306. }
  4307. var ob = (target).__ob__;
  4308. if (target._isVue || (ob && ob.vmCount)) {
  4309. true && warn(
  4310. 'Avoid deleting properties on a Vue instance or its root $data ' +
  4311. '- just set it to null.'
  4312. );
  4313. return
  4314. }
  4315. if (!hasOwn(target, key)) {
  4316. return
  4317. }
  4318. delete target[key];
  4319. if (!ob) {
  4320. return
  4321. }
  4322. ob.dep.notify();
  4323. }
  4324. /**
  4325. * Collect dependencies on array elements when the array is touched, since
  4326. * we cannot intercept array element access like property getters.
  4327. */
  4328. function dependArray (value) {
  4329. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  4330. e = value[i];
  4331. e && e.__ob__ && e.__ob__.dep.depend();
  4332. if (Array.isArray(e)) {
  4333. dependArray(e);
  4334. }
  4335. }
  4336. }
  4337. /* */
  4338. /**
  4339. * Option overwriting strategies are functions that handle
  4340. * how to merge a parent option value and a child option
  4341. * value into the final value.
  4342. */
  4343. var strats = config.optionMergeStrategies;
  4344. /**
  4345. * Options with restrictions
  4346. */
  4347. if (true) {
  4348. strats.el = strats.propsData = function (parent, child, vm, key) {
  4349. if (!vm) {
  4350. warn(
  4351. "option \"" + key + "\" can only be used during instance " +
  4352. 'creation with the `new` keyword.'
  4353. );
  4354. }
  4355. return defaultStrat(parent, child)
  4356. };
  4357. }
  4358. /**
  4359. * Helper that recursively merges two data objects together.
  4360. */
  4361. function mergeData (to, from) {
  4362. if (!from) { return to }
  4363. var key, toVal, fromVal;
  4364. var keys = hasSymbol
  4365. ? Reflect.ownKeys(from)
  4366. : Object.keys(from);
  4367. for (var i = 0; i < keys.length; i++) {
  4368. key = keys[i];
  4369. // in case the object is already observed...
  4370. if (key === '__ob__') { continue }
  4371. toVal = to[key];
  4372. fromVal = from[key];
  4373. if (!hasOwn(to, key)) {
  4374. set(to, key, fromVal);
  4375. } else if (
  4376. toVal !== fromVal &&
  4377. isPlainObject(toVal) &&
  4378. isPlainObject(fromVal)
  4379. ) {
  4380. mergeData(toVal, fromVal);
  4381. }
  4382. }
  4383. return to
  4384. }
  4385. /**
  4386. * Data
  4387. */
  4388. function mergeDataOrFn (
  4389. parentVal,
  4390. childVal,
  4391. vm
  4392. ) {
  4393. if (!vm) {
  4394. // in a Vue.extend merge, both should be functions
  4395. if (!childVal) {
  4396. return parentVal
  4397. }
  4398. if (!parentVal) {
  4399. return childVal
  4400. }
  4401. // when parentVal & childVal are both present,
  4402. // we need to return a function that returns the
  4403. // merged result of both functions... no need to
  4404. // check if parentVal is a function here because
  4405. // it has to be a function to pass previous merges.
  4406. return function mergedDataFn () {
  4407. return mergeData(
  4408. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  4409. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  4410. )
  4411. }
  4412. } else {
  4413. return function mergedInstanceDataFn () {
  4414. // instance merge
  4415. var instanceData = typeof childVal === 'function'
  4416. ? childVal.call(vm, vm)
  4417. : childVal;
  4418. var defaultData = typeof parentVal === 'function'
  4419. ? parentVal.call(vm, vm)
  4420. : parentVal;
  4421. if (instanceData) {
  4422. return mergeData(instanceData, defaultData)
  4423. } else {
  4424. return defaultData
  4425. }
  4426. }
  4427. }
  4428. }
  4429. strats.data = function (
  4430. parentVal,
  4431. childVal,
  4432. vm
  4433. ) {
  4434. if (!vm) {
  4435. if (childVal && typeof childVal !== 'function') {
  4436. true && warn(
  4437. 'The "data" option should be a function ' +
  4438. 'that returns a per-instance value in component ' +
  4439. 'definitions.',
  4440. vm
  4441. );
  4442. return parentVal
  4443. }
  4444. return mergeDataOrFn(parentVal, childVal)
  4445. }
  4446. return mergeDataOrFn(parentVal, childVal, vm)
  4447. };
  4448. /**
  4449. * Hooks and props are merged as arrays.
  4450. */
  4451. function mergeHook (
  4452. parentVal,
  4453. childVal
  4454. ) {
  4455. var res = childVal
  4456. ? parentVal
  4457. ? parentVal.concat(childVal)
  4458. : Array.isArray(childVal)
  4459. ? childVal
  4460. : [childVal]
  4461. : parentVal;
  4462. return res
  4463. ? dedupeHooks(res)
  4464. : res
  4465. }
  4466. function dedupeHooks (hooks) {
  4467. var res = [];
  4468. for (var i = 0; i < hooks.length; i++) {
  4469. if (res.indexOf(hooks[i]) === -1) {
  4470. res.push(hooks[i]);
  4471. }
  4472. }
  4473. return res
  4474. }
  4475. LIFECYCLE_HOOKS.forEach(function (hook) {
  4476. strats[hook] = mergeHook;
  4477. });
  4478. /**
  4479. * Assets
  4480. *
  4481. * When a vm is present (instance creation), we need to do
  4482. * a three-way merge between constructor options, instance
  4483. * options and parent options.
  4484. */
  4485. function mergeAssets (
  4486. parentVal,
  4487. childVal,
  4488. vm,
  4489. key
  4490. ) {
  4491. var res = Object.create(parentVal || null);
  4492. if (childVal) {
  4493. true && assertObjectType(key, childVal, vm);
  4494. return extend(res, childVal)
  4495. } else {
  4496. return res
  4497. }
  4498. }
  4499. ASSET_TYPES.forEach(function (type) {
  4500. strats[type + 's'] = mergeAssets;
  4501. });
  4502. /**
  4503. * Watchers.
  4504. *
  4505. * Watchers hashes should not overwrite one
  4506. * another, so we merge them as arrays.
  4507. */
  4508. strats.watch = function (
  4509. parentVal,
  4510. childVal,
  4511. vm,
  4512. key
  4513. ) {
  4514. // work around Firefox's Object.prototype.watch...
  4515. if (parentVal === nativeWatch) { parentVal = undefined; }
  4516. if (childVal === nativeWatch) { childVal = undefined; }
  4517. /* istanbul ignore if */
  4518. if (!childVal) { return Object.create(parentVal || null) }
  4519. if (true) {
  4520. assertObjectType(key, childVal, vm);
  4521. }
  4522. if (!parentVal) { return childVal }
  4523. var ret = {};
  4524. extend(ret, parentVal);
  4525. for (var key$1 in childVal) {
  4526. var parent = ret[key$1];
  4527. var child = childVal[key$1];
  4528. if (parent && !Array.isArray(parent)) {
  4529. parent = [parent];
  4530. }
  4531. ret[key$1] = parent
  4532. ? parent.concat(child)
  4533. : Array.isArray(child) ? child : [child];
  4534. }
  4535. return ret
  4536. };
  4537. /**
  4538. * Other object hashes.
  4539. */
  4540. strats.props =
  4541. strats.methods =
  4542. strats.inject =
  4543. strats.computed = function (
  4544. parentVal,
  4545. childVal,
  4546. vm,
  4547. key
  4548. ) {
  4549. if (childVal && "development" !== 'production') {
  4550. assertObjectType(key, childVal, vm);
  4551. }
  4552. if (!parentVal) { return childVal }
  4553. var ret = Object.create(null);
  4554. extend(ret, parentVal);
  4555. if (childVal) { extend(ret, childVal); }
  4556. return ret
  4557. };
  4558. strats.provide = mergeDataOrFn;
  4559. /**
  4560. * Default strategy.
  4561. */
  4562. var defaultStrat = function (parentVal, childVal) {
  4563. return childVal === undefined
  4564. ? parentVal
  4565. : childVal
  4566. };
  4567. /**
  4568. * Validate component names
  4569. */
  4570. function checkComponents (options) {
  4571. for (var key in options.components) {
  4572. validateComponentName(key);
  4573. }
  4574. }
  4575. function validateComponentName (name) {
  4576. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  4577. warn(
  4578. 'Invalid component name: "' + name + '". Component names ' +
  4579. 'should conform to valid custom element name in html5 specification.'
  4580. );
  4581. }
  4582. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  4583. warn(
  4584. 'Do not use built-in or reserved HTML elements as component ' +
  4585. 'id: ' + name
  4586. );
  4587. }
  4588. }
  4589. /**
  4590. * Ensure all props option syntax are normalized into the
  4591. * Object-based format.
  4592. */
  4593. function normalizeProps (options, vm) {
  4594. var props = options.props;
  4595. if (!props) { return }
  4596. var res = {};
  4597. var i, val, name;
  4598. if (Array.isArray(props)) {
  4599. i = props.length;
  4600. while (i--) {
  4601. val = props[i];
  4602. if (typeof val === 'string') {
  4603. name = camelize(val);
  4604. res[name] = { type: null };
  4605. } else if (true) {
  4606. warn('props must be strings when using array syntax.');
  4607. }
  4608. }
  4609. } else if (isPlainObject(props)) {
  4610. for (var key in props) {
  4611. val = props[key];
  4612. name = camelize(key);
  4613. res[name] = isPlainObject(val)
  4614. ? val
  4615. : { type: val };
  4616. }
  4617. } else if (true) {
  4618. warn(
  4619. "Invalid value for option \"props\": expected an Array or an Object, " +
  4620. "but got " + (toRawType(props)) + ".",
  4621. vm
  4622. );
  4623. }
  4624. options.props = res;
  4625. }
  4626. /**
  4627. * Normalize all injections into Object-based format
  4628. */
  4629. function normalizeInject (options, vm) {
  4630. var inject = options.inject;
  4631. if (!inject) { return }
  4632. var normalized = options.inject = {};
  4633. if (Array.isArray(inject)) {
  4634. for (var i = 0; i < inject.length; i++) {
  4635. normalized[inject[i]] = { from: inject[i] };
  4636. }
  4637. } else if (isPlainObject(inject)) {
  4638. for (var key in inject) {
  4639. var val = inject[key];
  4640. normalized[key] = isPlainObject(val)
  4641. ? extend({ from: key }, val)
  4642. : { from: val };
  4643. }
  4644. } else if (true) {
  4645. warn(
  4646. "Invalid value for option \"inject\": expected an Array or an Object, " +
  4647. "but got " + (toRawType(inject)) + ".",
  4648. vm
  4649. );
  4650. }
  4651. }
  4652. /**
  4653. * Normalize raw function directives into object format.
  4654. */
  4655. function normalizeDirectives (options) {
  4656. var dirs = options.directives;
  4657. if (dirs) {
  4658. for (var key in dirs) {
  4659. var def$$1 = dirs[key];
  4660. if (typeof def$$1 === 'function') {
  4661. dirs[key] = { bind: def$$1, update: def$$1 };
  4662. }
  4663. }
  4664. }
  4665. }
  4666. function assertObjectType (name, value, vm) {
  4667. if (!isPlainObject(value)) {
  4668. warn(
  4669. "Invalid value for option \"" + name + "\": expected an Object, " +
  4670. "but got " + (toRawType(value)) + ".",
  4671. vm
  4672. );
  4673. }
  4674. }
  4675. /**
  4676. * Merge two option objects into a new one.
  4677. * Core utility used in both instantiation and inheritance.
  4678. */
  4679. function mergeOptions (
  4680. parent,
  4681. child,
  4682. vm
  4683. ) {
  4684. if (true) {
  4685. checkComponents(child);
  4686. }
  4687. if (typeof child === 'function') {
  4688. child = child.options;
  4689. }
  4690. normalizeProps(child, vm);
  4691. normalizeInject(child, vm);
  4692. normalizeDirectives(child);
  4693. // Apply extends and mixins on the child options,
  4694. // but only if it is a raw options object that isn't
  4695. // the result of another mergeOptions call.
  4696. // Only merged options has the _base property.
  4697. if (!child._base) {
  4698. if (child.extends) {
  4699. parent = mergeOptions(parent, child.extends, vm);
  4700. }
  4701. if (child.mixins) {
  4702. for (var i = 0, l = child.mixins.length; i < l; i++) {
  4703. parent = mergeOptions(parent, child.mixins[i], vm);
  4704. }
  4705. }
  4706. }
  4707. var options = {};
  4708. var key;
  4709. for (key in parent) {
  4710. mergeField(key);
  4711. }
  4712. for (key in child) {
  4713. if (!hasOwn(parent, key)) {
  4714. mergeField(key);
  4715. }
  4716. }
  4717. function mergeField (key) {
  4718. var strat = strats[key] || defaultStrat;
  4719. options[key] = strat(parent[key], child[key], vm, key);
  4720. }
  4721. return options
  4722. }
  4723. /**
  4724. * Resolve an asset.
  4725. * This function is used because child instances need access
  4726. * to assets defined in its ancestor chain.
  4727. */
  4728. function resolveAsset (
  4729. options,
  4730. type,
  4731. id,
  4732. warnMissing
  4733. ) {
  4734. /* istanbul ignore if */
  4735. if (typeof id !== 'string') {
  4736. return
  4737. }
  4738. var assets = options[type];
  4739. // check local registration variations first
  4740. if (hasOwn(assets, id)) { return assets[id] }
  4741. var camelizedId = camelize(id);
  4742. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  4743. var PascalCaseId = capitalize(camelizedId);
  4744. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  4745. // fallback to prototype chain
  4746. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  4747. if ( true && warnMissing && !res) {
  4748. warn(
  4749. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  4750. options
  4751. );
  4752. }
  4753. return res
  4754. }
  4755. /* */
  4756. function validateProp (
  4757. key,
  4758. propOptions,
  4759. propsData,
  4760. vm
  4761. ) {
  4762. var prop = propOptions[key];
  4763. var absent = !hasOwn(propsData, key);
  4764. var value = propsData[key];
  4765. // boolean casting
  4766. var booleanIndex = getTypeIndex(Boolean, prop.type);
  4767. if (booleanIndex > -1) {
  4768. if (absent && !hasOwn(prop, 'default')) {
  4769. value = false;
  4770. } else if (value === '' || value === hyphenate(key)) {
  4771. // only cast empty string / same name to boolean if
  4772. // boolean has higher priority
  4773. var stringIndex = getTypeIndex(String, prop.type);
  4774. if (stringIndex < 0 || booleanIndex < stringIndex) {
  4775. value = true;
  4776. }
  4777. }
  4778. }
  4779. // check default value
  4780. if (value === undefined) {
  4781. value = getPropDefaultValue(vm, prop, key);
  4782. // since the default value is a fresh copy,
  4783. // make sure to observe it.
  4784. var prevShouldObserve = shouldObserve;
  4785. toggleObserving(true);
  4786. observe(value);
  4787. toggleObserving(prevShouldObserve);
  4788. }
  4789. if (
  4790. true
  4791. ) {
  4792. assertProp(prop, key, value, vm, absent);
  4793. }
  4794. return value
  4795. }
  4796. /**
  4797. * Get the default value of a prop.
  4798. */
  4799. function getPropDefaultValue (vm, prop, key) {
  4800. // no default, return undefined
  4801. if (!hasOwn(prop, 'default')) {
  4802. return undefined
  4803. }
  4804. var def = prop.default;
  4805. // warn against non-factory defaults for Object & Array
  4806. if ( true && isObject(def)) {
  4807. warn(
  4808. 'Invalid default value for prop "' + key + '": ' +
  4809. 'Props with type Object/Array must use a factory function ' +
  4810. 'to return the default value.',
  4811. vm
  4812. );
  4813. }
  4814. // the raw prop value was also undefined from previous render,
  4815. // return previous default value to avoid unnecessary watcher trigger
  4816. if (vm && vm.$options.propsData &&
  4817. vm.$options.propsData[key] === undefined &&
  4818. vm._props[key] !== undefined
  4819. ) {
  4820. return vm._props[key]
  4821. }
  4822. // call factory function for non-Function types
  4823. // a value is Function if its prototype is function even across different execution context
  4824. return typeof def === 'function' && getType(prop.type) !== 'Function'
  4825. ? def.call(vm)
  4826. : def
  4827. }
  4828. /**
  4829. * Assert whether a prop is valid.
  4830. */
  4831. function assertProp (
  4832. prop,
  4833. name,
  4834. value,
  4835. vm,
  4836. absent
  4837. ) {
  4838. if (prop.required && absent) {
  4839. warn(
  4840. 'Missing required prop: "' + name + '"',
  4841. vm
  4842. );
  4843. return
  4844. }
  4845. if (value == null && !prop.required) {
  4846. return
  4847. }
  4848. var type = prop.type;
  4849. var valid = !type || type === true;
  4850. var expectedTypes = [];
  4851. if (type) {
  4852. if (!Array.isArray(type)) {
  4853. type = [type];
  4854. }
  4855. for (var i = 0; i < type.length && !valid; i++) {
  4856. var assertedType = assertType(value, type[i]);
  4857. expectedTypes.push(assertedType.expectedType || '');
  4858. valid = assertedType.valid;
  4859. }
  4860. }
  4861. if (!valid) {
  4862. warn(
  4863. getInvalidTypeMessage(name, value, expectedTypes),
  4864. vm
  4865. );
  4866. return
  4867. }
  4868. var validator = prop.validator;
  4869. if (validator) {
  4870. if (!validator(value)) {
  4871. warn(
  4872. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  4873. vm
  4874. );
  4875. }
  4876. }
  4877. }
  4878. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  4879. function assertType (value, type) {
  4880. var valid;
  4881. var expectedType = getType(type);
  4882. if (simpleCheckRE.test(expectedType)) {
  4883. var t = typeof value;
  4884. valid = t === expectedType.toLowerCase();
  4885. // for primitive wrapper objects
  4886. if (!valid && t === 'object') {
  4887. valid = value instanceof type;
  4888. }
  4889. } else if (expectedType === 'Object') {
  4890. valid = isPlainObject(value);
  4891. } else if (expectedType === 'Array') {
  4892. valid = Array.isArray(value);
  4893. } else {
  4894. valid = value instanceof type;
  4895. }
  4896. return {
  4897. valid: valid,
  4898. expectedType: expectedType
  4899. }
  4900. }
  4901. /**
  4902. * Use function string name to check built-in types,
  4903. * because a simple equality check will fail when running
  4904. * across different vms / iframes.
  4905. */
  4906. function getType (fn) {
  4907. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  4908. return match ? match[1] : ''
  4909. }
  4910. function isSameType (a, b) {
  4911. return getType(a) === getType(b)
  4912. }
  4913. function getTypeIndex (type, expectedTypes) {
  4914. if (!Array.isArray(expectedTypes)) {
  4915. return isSameType(expectedTypes, type) ? 0 : -1
  4916. }
  4917. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  4918. if (isSameType(expectedTypes[i], type)) {
  4919. return i
  4920. }
  4921. }
  4922. return -1
  4923. }
  4924. function getInvalidTypeMessage (name, value, expectedTypes) {
  4925. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  4926. " Expected " + (expectedTypes.map(capitalize).join(', '));
  4927. var expectedType = expectedTypes[0];
  4928. var receivedType = toRawType(value);
  4929. var expectedValue = styleValue(value, expectedType);
  4930. var receivedValue = styleValue(value, receivedType);
  4931. // check if we need to specify expected value
  4932. if (expectedTypes.length === 1 &&
  4933. isExplicable(expectedType) &&
  4934. !isBoolean(expectedType, receivedType)) {
  4935. message += " with value " + expectedValue;
  4936. }
  4937. message += ", got " + receivedType + " ";
  4938. // check if we need to specify received value
  4939. if (isExplicable(receivedType)) {
  4940. message += "with value " + receivedValue + ".";
  4941. }
  4942. return message
  4943. }
  4944. function styleValue (value, type) {
  4945. if (type === 'String') {
  4946. return ("\"" + value + "\"")
  4947. } else if (type === 'Number') {
  4948. return ("" + (Number(value)))
  4949. } else {
  4950. return ("" + value)
  4951. }
  4952. }
  4953. function isExplicable (value) {
  4954. var explicitTypes = ['string', 'number', 'boolean'];
  4955. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  4956. }
  4957. function isBoolean () {
  4958. var args = [], len = arguments.length;
  4959. while ( len-- ) args[ len ] = arguments[ len ];
  4960. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  4961. }
  4962. /* */
  4963. function handleError (err, vm, info) {
  4964. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  4965. // See: https://github.com/vuejs/vuex/issues/1505
  4966. pushTarget();
  4967. try {
  4968. if (vm) {
  4969. var cur = vm;
  4970. while ((cur = cur.$parent)) {
  4971. var hooks = cur.$options.errorCaptured;
  4972. if (hooks) {
  4973. for (var i = 0; i < hooks.length; i++) {
  4974. try {
  4975. var capture = hooks[i].call(cur, err, vm, info) === false;
  4976. if (capture) { return }
  4977. } catch (e) {
  4978. globalHandleError(e, cur, 'errorCaptured hook');
  4979. }
  4980. }
  4981. }
  4982. }
  4983. }
  4984. globalHandleError(err, vm, info);
  4985. } finally {
  4986. popTarget();
  4987. }
  4988. }
  4989. function invokeWithErrorHandling (
  4990. handler,
  4991. context,
  4992. args,
  4993. vm,
  4994. info
  4995. ) {
  4996. var res;
  4997. try {
  4998. res = args ? handler.apply(context, args) : handler.call(context);
  4999. if (res && !res._isVue && isPromise(res) && !res._handled) {
  5000. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  5001. // issue #9511
  5002. // avoid catch triggering multiple times when nested calls
  5003. res._handled = true;
  5004. }
  5005. } catch (e) {
  5006. handleError(e, vm, info);
  5007. }
  5008. return res
  5009. }
  5010. function globalHandleError (err, vm, info) {
  5011. if (config.errorHandler) {
  5012. try {
  5013. return config.errorHandler.call(null, err, vm, info)
  5014. } catch (e) {
  5015. // if the user intentionally throws the original error in the handler,
  5016. // do not log it twice
  5017. if (e !== err) {
  5018. logError(e, null, 'config.errorHandler');
  5019. }
  5020. }
  5021. }
  5022. logError(err, vm, info);
  5023. }
  5024. function logError (err, vm, info) {
  5025. if (true) {
  5026. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  5027. }
  5028. /* istanbul ignore else */
  5029. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  5030. console.error(err);
  5031. } else {
  5032. throw err
  5033. }
  5034. }
  5035. /* */
  5036. var callbacks = [];
  5037. var pending = false;
  5038. function flushCallbacks () {
  5039. pending = false;
  5040. var copies = callbacks.slice(0);
  5041. callbacks.length = 0;
  5042. for (var i = 0; i < copies.length; i++) {
  5043. copies[i]();
  5044. }
  5045. }
  5046. // Here we have async deferring wrappers using microtasks.
  5047. // In 2.5 we used (macro) tasks (in combination with microtasks).
  5048. // However, it has subtle problems when state is changed right before repaint
  5049. // (e.g. #6813, out-in transitions).
  5050. // Also, using (macro) tasks in event handler would cause some weird behaviors
  5051. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  5052. // So we now use microtasks everywhere, again.
  5053. // A major drawback of this tradeoff is that there are some scenarios
  5054. // where microtasks have too high a priority and fire in between supposedly
  5055. // sequential events (e.g. #4521, #6690, which have workarounds)
  5056. // or even between bubbling of the same event (#6566).
  5057. var timerFunc;
  5058. // The nextTick behavior leverages the microtask queue, which can be accessed
  5059. // via either native Promise.then or MutationObserver.
  5060. // MutationObserver has wider support, however it is seriously bugged in
  5061. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  5062. // completely stops working after triggering a few times... so, if native
  5063. // Promise is available, we will use it:
  5064. /* istanbul ignore next, $flow-disable-line */
  5065. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  5066. var p = Promise.resolve();
  5067. timerFunc = function () {
  5068. p.then(flushCallbacks);
  5069. // In problematic UIWebViews, Promise.then doesn't completely break, but
  5070. // it can get stuck in a weird state where callbacks are pushed into the
  5071. // microtask queue but the queue isn't being flushed, until the browser
  5072. // needs to do some other work, e.g. handle a timer. Therefore we can
  5073. // "force" the microtask queue to be flushed by adding an empty timer.
  5074. if (isIOS) { setTimeout(noop); }
  5075. };
  5076. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  5077. isNative(MutationObserver) ||
  5078. // PhantomJS and iOS 7.x
  5079. MutationObserver.toString() === '[object MutationObserverConstructor]'
  5080. )) {
  5081. // Use MutationObserver where native Promise is not available,
  5082. // e.g. PhantomJS, iOS7, Android 4.4
  5083. // (#6466 MutationObserver is unreliable in IE11)
  5084. var counter = 1;
  5085. var observer = new MutationObserver(flushCallbacks);
  5086. var textNode = document.createTextNode(String(counter));
  5087. observer.observe(textNode, {
  5088. characterData: true
  5089. });
  5090. timerFunc = function () {
  5091. counter = (counter + 1) % 2;
  5092. textNode.data = String(counter);
  5093. };
  5094. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  5095. // Fallback to setImmediate.
  5096. // Technically it leverages the (macro) task queue,
  5097. // but it is still a better choice than setTimeout.
  5098. timerFunc = function () {
  5099. setImmediate(flushCallbacks);
  5100. };
  5101. } else {
  5102. // Fallback to setTimeout.
  5103. timerFunc = function () {
  5104. setTimeout(flushCallbacks, 0);
  5105. };
  5106. }
  5107. function nextTick (cb, ctx) {
  5108. var _resolve;
  5109. callbacks.push(function () {
  5110. if (cb) {
  5111. try {
  5112. cb.call(ctx);
  5113. } catch (e) {
  5114. handleError(e, ctx, 'nextTick');
  5115. }
  5116. } else if (_resolve) {
  5117. _resolve(ctx);
  5118. }
  5119. });
  5120. if (!pending) {
  5121. pending = true;
  5122. timerFunc();
  5123. }
  5124. // $flow-disable-line
  5125. if (!cb && typeof Promise !== 'undefined') {
  5126. return new Promise(function (resolve) {
  5127. _resolve = resolve;
  5128. })
  5129. }
  5130. }
  5131. /* */
  5132. /* not type checking this file because flow doesn't play well with Proxy */
  5133. var initProxy;
  5134. if (true) {
  5135. var allowedGlobals = makeMap(
  5136. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  5137. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  5138. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  5139. 'require' // for Webpack/Browserify
  5140. );
  5141. var warnNonPresent = function (target, key) {
  5142. warn(
  5143. "Property or method \"" + key + "\" is not defined on the instance but " +
  5144. 'referenced during render. Make sure that this property is reactive, ' +
  5145. 'either in the data option, or for class-based components, by ' +
  5146. 'initializing the property. ' +
  5147. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  5148. target
  5149. );
  5150. };
  5151. var warnReservedPrefix = function (target, key) {
  5152. warn(
  5153. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  5154. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  5155. 'prevent conflicts with Vue internals. ' +
  5156. 'See: https://vuejs.org/v2/api/#data',
  5157. target
  5158. );
  5159. };
  5160. var hasProxy =
  5161. typeof Proxy !== 'undefined' && isNative(Proxy);
  5162. if (hasProxy) {
  5163. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  5164. config.keyCodes = new Proxy(config.keyCodes, {
  5165. set: function set (target, key, value) {
  5166. if (isBuiltInModifier(key)) {
  5167. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  5168. return false
  5169. } else {
  5170. target[key] = value;
  5171. return true
  5172. }
  5173. }
  5174. });
  5175. }
  5176. var hasHandler = {
  5177. has: function has (target, key) {
  5178. var has = key in target;
  5179. var isAllowed = allowedGlobals(key) ||
  5180. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  5181. if (!has && !isAllowed) {
  5182. if (key in target.$data) { warnReservedPrefix(target, key); }
  5183. else { warnNonPresent(target, key); }
  5184. }
  5185. return has || !isAllowed
  5186. }
  5187. };
  5188. var getHandler = {
  5189. get: function get (target, key) {
  5190. if (typeof key === 'string' && !(key in target)) {
  5191. if (key in target.$data) { warnReservedPrefix(target, key); }
  5192. else { warnNonPresent(target, key); }
  5193. }
  5194. return target[key]
  5195. }
  5196. };
  5197. initProxy = function initProxy (vm) {
  5198. if (hasProxy) {
  5199. // determine which proxy handler to use
  5200. var options = vm.$options;
  5201. var handlers = options.render && options.render._withStripped
  5202. ? getHandler
  5203. : hasHandler;
  5204. vm._renderProxy = new Proxy(vm, handlers);
  5205. } else {
  5206. vm._renderProxy = vm;
  5207. }
  5208. };
  5209. }
  5210. /* */
  5211. var seenObjects = new _Set();
  5212. /**
  5213. * Recursively traverse an object to evoke all converted
  5214. * getters, so that every nested property inside the object
  5215. * is collected as a "deep" dependency.
  5216. */
  5217. function traverse (val) {
  5218. _traverse(val, seenObjects);
  5219. seenObjects.clear();
  5220. }
  5221. function _traverse (val, seen) {
  5222. var i, keys;
  5223. var isA = Array.isArray(val);
  5224. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  5225. return
  5226. }
  5227. if (val.__ob__) {
  5228. var depId = val.__ob__.dep.id;
  5229. if (seen.has(depId)) {
  5230. return
  5231. }
  5232. seen.add(depId);
  5233. }
  5234. if (isA) {
  5235. i = val.length;
  5236. while (i--) { _traverse(val[i], seen); }
  5237. } else {
  5238. keys = Object.keys(val);
  5239. i = keys.length;
  5240. while (i--) { _traverse(val[keys[i]], seen); }
  5241. }
  5242. }
  5243. var mark;
  5244. var measure;
  5245. if (true) {
  5246. var perf = inBrowser && window.performance;
  5247. /* istanbul ignore if */
  5248. if (
  5249. perf &&
  5250. perf.mark &&
  5251. perf.measure &&
  5252. perf.clearMarks &&
  5253. perf.clearMeasures
  5254. ) {
  5255. mark = function (tag) { return perf.mark(tag); };
  5256. measure = function (name, startTag, endTag) {
  5257. perf.measure(name, startTag, endTag);
  5258. perf.clearMarks(startTag);
  5259. perf.clearMarks(endTag);
  5260. // perf.clearMeasures(name)
  5261. };
  5262. }
  5263. }
  5264. /* */
  5265. var normalizeEvent = cached(function (name) {
  5266. var passive = name.charAt(0) === '&';
  5267. name = passive ? name.slice(1) : name;
  5268. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  5269. name = once$$1 ? name.slice(1) : name;
  5270. var capture = name.charAt(0) === '!';
  5271. name = capture ? name.slice(1) : name;
  5272. return {
  5273. name: name,
  5274. once: once$$1,
  5275. capture: capture,
  5276. passive: passive
  5277. }
  5278. });
  5279. function createFnInvoker (fns, vm) {
  5280. function invoker () {
  5281. var arguments$1 = arguments;
  5282. var fns = invoker.fns;
  5283. if (Array.isArray(fns)) {
  5284. var cloned = fns.slice();
  5285. for (var i = 0; i < cloned.length; i++) {
  5286. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  5287. }
  5288. } else {
  5289. // return handler return value for single handlers
  5290. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  5291. }
  5292. }
  5293. invoker.fns = fns;
  5294. return invoker
  5295. }
  5296. function updateListeners (
  5297. on,
  5298. oldOn,
  5299. add,
  5300. remove$$1,
  5301. createOnceHandler,
  5302. vm
  5303. ) {
  5304. var name, def$$1, cur, old, event;
  5305. for (name in on) {
  5306. def$$1 = cur = on[name];
  5307. old = oldOn[name];
  5308. event = normalizeEvent(name);
  5309. if (isUndef(cur)) {
  5310. true && warn(
  5311. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  5312. vm
  5313. );
  5314. } else if (isUndef(old)) {
  5315. if (isUndef(cur.fns)) {
  5316. cur = on[name] = createFnInvoker(cur, vm);
  5317. }
  5318. if (isTrue(event.once)) {
  5319. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  5320. }
  5321. add(event.name, cur, event.capture, event.passive, event.params);
  5322. } else if (cur !== old) {
  5323. old.fns = cur;
  5324. on[name] = old;
  5325. }
  5326. }
  5327. for (name in oldOn) {
  5328. if (isUndef(on[name])) {
  5329. event = normalizeEvent(name);
  5330. remove$$1(event.name, oldOn[name], event.capture);
  5331. }
  5332. }
  5333. }
  5334. /* */
  5335. /* */
  5336. // fixed by xxxxxx (mp properties)
  5337. function extractPropertiesFromVNodeData(data, Ctor, res, context) {
  5338. var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties;
  5339. if (isUndef(propOptions)) {
  5340. return res
  5341. }
  5342. var externalClasses = Ctor.options.mpOptions.externalClasses || [];
  5343. var attrs = data.attrs;
  5344. var props = data.props;
  5345. if (isDef(attrs) || isDef(props)) {
  5346. for (var key in propOptions) {
  5347. var altKey = hyphenate(key);
  5348. var result = checkProp(res, props, key, altKey, true) ||
  5349. checkProp(res, attrs, key, altKey, false);
  5350. // externalClass
  5351. if (
  5352. result &&
  5353. res[key] &&
  5354. externalClasses.indexOf(altKey) !== -1 &&
  5355. context[camelize(res[key])]
  5356. ) {
  5357. // 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串)
  5358. res[key] = context[camelize(res[key])];
  5359. }
  5360. }
  5361. }
  5362. return res
  5363. }
  5364. function extractPropsFromVNodeData (
  5365. data,
  5366. Ctor,
  5367. tag,
  5368. context// fixed by xxxxxx
  5369. ) {
  5370. // we are only extracting raw values here.
  5371. // validation and default values are handled in the child
  5372. // component itself.
  5373. var propOptions = Ctor.options.props;
  5374. if (isUndef(propOptions)) {
  5375. // fixed by xxxxxx
  5376. return extractPropertiesFromVNodeData(data, Ctor, {}, context)
  5377. }
  5378. var res = {};
  5379. var attrs = data.attrs;
  5380. var props = data.props;
  5381. if (isDef(attrs) || isDef(props)) {
  5382. for (var key in propOptions) {
  5383. var altKey = hyphenate(key);
  5384. if (true) {
  5385. var keyInLowerCase = key.toLowerCase();
  5386. if (
  5387. key !== keyInLowerCase &&
  5388. attrs && hasOwn(attrs, keyInLowerCase)
  5389. ) {
  5390. tip(
  5391. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  5392. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  5393. " \"" + key + "\". " +
  5394. "Note that HTML attributes are case-insensitive and camelCased " +
  5395. "props need to use their kebab-case equivalents when using in-DOM " +
  5396. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  5397. );
  5398. }
  5399. }
  5400. checkProp(res, props, key, altKey, true) ||
  5401. checkProp(res, attrs, key, altKey, false);
  5402. }
  5403. }
  5404. // fixed by xxxxxx
  5405. return extractPropertiesFromVNodeData(data, Ctor, res, context)
  5406. }
  5407. function checkProp (
  5408. res,
  5409. hash,
  5410. key,
  5411. altKey,
  5412. preserve
  5413. ) {
  5414. if (isDef(hash)) {
  5415. if (hasOwn(hash, key)) {
  5416. res[key] = hash[key];
  5417. if (!preserve) {
  5418. delete hash[key];
  5419. }
  5420. return true
  5421. } else if (hasOwn(hash, altKey)) {
  5422. res[key] = hash[altKey];
  5423. if (!preserve) {
  5424. delete hash[altKey];
  5425. }
  5426. return true
  5427. }
  5428. }
  5429. return false
  5430. }
  5431. /* */
  5432. // The template compiler attempts to minimize the need for normalization by
  5433. // statically analyzing the template at compile time.
  5434. //
  5435. // For plain HTML markup, normalization can be completely skipped because the
  5436. // generated render function is guaranteed to return Array<VNode>. There are
  5437. // two cases where extra normalization is needed:
  5438. // 1. When the children contains components - because a functional component
  5439. // may return an Array instead of a single root. In this case, just a simple
  5440. // normalization is needed - if any child is an Array, we flatten the whole
  5441. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  5442. // because functional components already normalize their own children.
  5443. function simpleNormalizeChildren (children) {
  5444. for (var i = 0; i < children.length; i++) {
  5445. if (Array.isArray(children[i])) {
  5446. return Array.prototype.concat.apply([], children)
  5447. }
  5448. }
  5449. return children
  5450. }
  5451. // 2. When the children contains constructs that always generated nested Arrays,
  5452. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  5453. // with hand-written render functions / JSX. In such cases a full normalization
  5454. // is needed to cater to all possible types of children values.
  5455. function normalizeChildren (children) {
  5456. return isPrimitive(children)
  5457. ? [createTextVNode(children)]
  5458. : Array.isArray(children)
  5459. ? normalizeArrayChildren(children)
  5460. : undefined
  5461. }
  5462. function isTextNode (node) {
  5463. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  5464. }
  5465. function normalizeArrayChildren (children, nestedIndex) {
  5466. var res = [];
  5467. var i, c, lastIndex, last;
  5468. for (i = 0; i < children.length; i++) {
  5469. c = children[i];
  5470. if (isUndef(c) || typeof c === 'boolean') { continue }
  5471. lastIndex = res.length - 1;
  5472. last = res[lastIndex];
  5473. // nested
  5474. if (Array.isArray(c)) {
  5475. if (c.length > 0) {
  5476. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  5477. // merge adjacent text nodes
  5478. if (isTextNode(c[0]) && isTextNode(last)) {
  5479. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  5480. c.shift();
  5481. }
  5482. res.push.apply(res, c);
  5483. }
  5484. } else if (isPrimitive(c)) {
  5485. if (isTextNode(last)) {
  5486. // merge adjacent text nodes
  5487. // this is necessary for SSR hydration because text nodes are
  5488. // essentially merged when rendered to HTML strings
  5489. res[lastIndex] = createTextVNode(last.text + c);
  5490. } else if (c !== '') {
  5491. // convert primitive to vnode
  5492. res.push(createTextVNode(c));
  5493. }
  5494. } else {
  5495. if (isTextNode(c) && isTextNode(last)) {
  5496. // merge adjacent text nodes
  5497. res[lastIndex] = createTextVNode(last.text + c.text);
  5498. } else {
  5499. // default key for nested array children (likely generated by v-for)
  5500. if (isTrue(children._isVList) &&
  5501. isDef(c.tag) &&
  5502. isUndef(c.key) &&
  5503. isDef(nestedIndex)) {
  5504. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  5505. }
  5506. res.push(c);
  5507. }
  5508. }
  5509. }
  5510. return res
  5511. }
  5512. /* */
  5513. function initProvide (vm) {
  5514. var provide = vm.$options.provide;
  5515. if (provide) {
  5516. vm._provided = typeof provide === 'function'
  5517. ? provide.call(vm)
  5518. : provide;
  5519. }
  5520. }
  5521. function initInjections (vm) {
  5522. var result = resolveInject(vm.$options.inject, vm);
  5523. if (result) {
  5524. toggleObserving(false);
  5525. Object.keys(result).forEach(function (key) {
  5526. /* istanbul ignore else */
  5527. if (true) {
  5528. defineReactive$$1(vm, key, result[key], function () {
  5529. warn(
  5530. "Avoid mutating an injected value directly since the changes will be " +
  5531. "overwritten whenever the provided component re-renders. " +
  5532. "injection being mutated: \"" + key + "\"",
  5533. vm
  5534. );
  5535. });
  5536. } else {}
  5537. });
  5538. toggleObserving(true);
  5539. }
  5540. }
  5541. function resolveInject (inject, vm) {
  5542. if (inject) {
  5543. // inject is :any because flow is not smart enough to figure out cached
  5544. var result = Object.create(null);
  5545. var keys = hasSymbol
  5546. ? Reflect.ownKeys(inject)
  5547. : Object.keys(inject);
  5548. for (var i = 0; i < keys.length; i++) {
  5549. var key = keys[i];
  5550. // #6574 in case the inject object is observed...
  5551. if (key === '__ob__') { continue }
  5552. var provideKey = inject[key].from;
  5553. var source = vm;
  5554. while (source) {
  5555. if (source._provided && hasOwn(source._provided, provideKey)) {
  5556. result[key] = source._provided[provideKey];
  5557. break
  5558. }
  5559. source = source.$parent;
  5560. }
  5561. if (!source) {
  5562. if ('default' in inject[key]) {
  5563. var provideDefault = inject[key].default;
  5564. result[key] = typeof provideDefault === 'function'
  5565. ? provideDefault.call(vm)
  5566. : provideDefault;
  5567. } else if (true) {
  5568. warn(("Injection \"" + key + "\" not found"), vm);
  5569. }
  5570. }
  5571. }
  5572. return result
  5573. }
  5574. }
  5575. /* */
  5576. /**
  5577. * Runtime helper for resolving raw children VNodes into a slot object.
  5578. */
  5579. function resolveSlots (
  5580. children,
  5581. context
  5582. ) {
  5583. if (!children || !children.length) {
  5584. return {}
  5585. }
  5586. var slots = {};
  5587. for (var i = 0, l = children.length; i < l; i++) {
  5588. var child = children[i];
  5589. var data = child.data;
  5590. // remove slot attribute if the node is resolved as a Vue slot node
  5591. if (data && data.attrs && data.attrs.slot) {
  5592. delete data.attrs.slot;
  5593. }
  5594. // named slots should only be respected if the vnode was rendered in the
  5595. // same context.
  5596. if ((child.context === context || child.fnContext === context) &&
  5597. data && data.slot != null
  5598. ) {
  5599. var name = data.slot;
  5600. var slot = (slots[name] || (slots[name] = []));
  5601. if (child.tag === 'template') {
  5602. slot.push.apply(slot, child.children || []);
  5603. } else {
  5604. slot.push(child);
  5605. }
  5606. } else {
  5607. // fixed by xxxxxx 临时 hack 掉 uni-app 中的异步 name slot page
  5608. if(child.asyncMeta && child.asyncMeta.data && child.asyncMeta.data.slot === 'page'){
  5609. (slots['page'] || (slots['page'] = [])).push(child);
  5610. }else{
  5611. (slots.default || (slots.default = [])).push(child);
  5612. }
  5613. }
  5614. }
  5615. // ignore slots that contains only whitespace
  5616. for (var name$1 in slots) {
  5617. if (slots[name$1].every(isWhitespace)) {
  5618. delete slots[name$1];
  5619. }
  5620. }
  5621. return slots
  5622. }
  5623. function isWhitespace (node) {
  5624. return (node.isComment && !node.asyncFactory) || node.text === ' '
  5625. }
  5626. /* */
  5627. function normalizeScopedSlots (
  5628. slots,
  5629. normalSlots,
  5630. prevSlots
  5631. ) {
  5632. var res;
  5633. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  5634. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  5635. var key = slots && slots.$key;
  5636. if (!slots) {
  5637. res = {};
  5638. } else if (slots._normalized) {
  5639. // fast path 1: child component re-render only, parent did not change
  5640. return slots._normalized
  5641. } else if (
  5642. isStable &&
  5643. prevSlots &&
  5644. prevSlots !== emptyObject &&
  5645. key === prevSlots.$key &&
  5646. !hasNormalSlots &&
  5647. !prevSlots.$hasNormal
  5648. ) {
  5649. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  5650. // only need to normalize once
  5651. return prevSlots
  5652. } else {
  5653. res = {};
  5654. for (var key$1 in slots) {
  5655. if (slots[key$1] && key$1[0] !== '$') {
  5656. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  5657. }
  5658. }
  5659. }
  5660. // expose normal slots on scopedSlots
  5661. for (var key$2 in normalSlots) {
  5662. if (!(key$2 in res)) {
  5663. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  5664. }
  5665. }
  5666. // avoriaz seems to mock a non-extensible $scopedSlots object
  5667. // and when that is passed down this would cause an error
  5668. if (slots && Object.isExtensible(slots)) {
  5669. (slots)._normalized = res;
  5670. }
  5671. def(res, '$stable', isStable);
  5672. def(res, '$key', key);
  5673. def(res, '$hasNormal', hasNormalSlots);
  5674. return res
  5675. }
  5676. function normalizeScopedSlot(normalSlots, key, fn) {
  5677. var normalized = function () {
  5678. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  5679. res = res && typeof res === 'object' && !Array.isArray(res)
  5680. ? [res] // single vnode
  5681. : normalizeChildren(res);
  5682. return res && (
  5683. res.length === 0 ||
  5684. (res.length === 1 && res[0].isComment) // #9658
  5685. ) ? undefined
  5686. : res
  5687. };
  5688. // this is a slot using the new v-slot syntax without scope. although it is
  5689. // compiled as a scoped slot, render fn users would expect it to be present
  5690. // on this.$slots because the usage is semantically a normal slot.
  5691. if (fn.proxy) {
  5692. Object.defineProperty(normalSlots, key, {
  5693. get: normalized,
  5694. enumerable: true,
  5695. configurable: true
  5696. });
  5697. }
  5698. return normalized
  5699. }
  5700. function proxyNormalSlot(slots, key) {
  5701. return function () { return slots[key]; }
  5702. }
  5703. /* */
  5704. /**
  5705. * Runtime helper for rendering v-for lists.
  5706. */
  5707. function renderList (
  5708. val,
  5709. render
  5710. ) {
  5711. var ret, i, l, keys, key;
  5712. if (Array.isArray(val) || typeof val === 'string') {
  5713. ret = new Array(val.length);
  5714. for (i = 0, l = val.length; i < l; i++) {
  5715. ret[i] = render(val[i], i, i, i); // fixed by xxxxxx
  5716. }
  5717. } else if (typeof val === 'number') {
  5718. ret = new Array(val);
  5719. for (i = 0; i < val; i++) {
  5720. ret[i] = render(i + 1, i, i, i); // fixed by xxxxxx
  5721. }
  5722. } else if (isObject(val)) {
  5723. if (hasSymbol && val[Symbol.iterator]) {
  5724. ret = [];
  5725. var iterator = val[Symbol.iterator]();
  5726. var result = iterator.next();
  5727. while (!result.done) {
  5728. ret.push(render(result.value, ret.length, i, i++)); // fixed by xxxxxx
  5729. result = iterator.next();
  5730. }
  5731. } else {
  5732. keys = Object.keys(val);
  5733. ret = new Array(keys.length);
  5734. for (i = 0, l = keys.length; i < l; i++) {
  5735. key = keys[i];
  5736. ret[i] = render(val[key], key, i, i); // fixed by xxxxxx
  5737. }
  5738. }
  5739. }
  5740. if (!isDef(ret)) {
  5741. ret = [];
  5742. }
  5743. (ret)._isVList = true;
  5744. return ret
  5745. }
  5746. /* */
  5747. /**
  5748. * Runtime helper for rendering <slot>
  5749. */
  5750. function renderSlot (
  5751. name,
  5752. fallback,
  5753. props,
  5754. bindObject
  5755. ) {
  5756. var scopedSlotFn = this.$scopedSlots[name];
  5757. var nodes;
  5758. if (scopedSlotFn) { // scoped slot
  5759. props = props || {};
  5760. if (bindObject) {
  5761. if ( true && !isObject(bindObject)) {
  5762. warn(
  5763. 'slot v-bind without argument expects an Object',
  5764. this
  5765. );
  5766. }
  5767. props = extend(extend({}, bindObject), props);
  5768. }
  5769. // fixed by xxxxxx app-plus scopedSlot
  5770. nodes = scopedSlotFn(props, this, props._i) || fallback;
  5771. } else {
  5772. nodes = this.$slots[name] || fallback;
  5773. }
  5774. var target = props && props.slot;
  5775. if (target) {
  5776. return this.$createElement('template', { slot: target }, nodes)
  5777. } else {
  5778. return nodes
  5779. }
  5780. }
  5781. /* */
  5782. /**
  5783. * Runtime helper for resolving filters
  5784. */
  5785. function resolveFilter (id) {
  5786. return resolveAsset(this.$options, 'filters', id, true) || identity
  5787. }
  5788. /* */
  5789. function isKeyNotMatch (expect, actual) {
  5790. if (Array.isArray(expect)) {
  5791. return expect.indexOf(actual) === -1
  5792. } else {
  5793. return expect !== actual
  5794. }
  5795. }
  5796. /**
  5797. * Runtime helper for checking keyCodes from config.
  5798. * exposed as Vue.prototype._k
  5799. * passing in eventKeyName as last argument separately for backwards compat
  5800. */
  5801. function checkKeyCodes (
  5802. eventKeyCode,
  5803. key,
  5804. builtInKeyCode,
  5805. eventKeyName,
  5806. builtInKeyName
  5807. ) {
  5808. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  5809. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  5810. return isKeyNotMatch(builtInKeyName, eventKeyName)
  5811. } else if (mappedKeyCode) {
  5812. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  5813. } else if (eventKeyName) {
  5814. return hyphenate(eventKeyName) !== key
  5815. }
  5816. }
  5817. /* */
  5818. /**
  5819. * Runtime helper for merging v-bind="object" into a VNode's data.
  5820. */
  5821. function bindObjectProps (
  5822. data,
  5823. tag,
  5824. value,
  5825. asProp,
  5826. isSync
  5827. ) {
  5828. if (value) {
  5829. if (!isObject(value)) {
  5830. true && warn(
  5831. 'v-bind without argument expects an Object or Array value',
  5832. this
  5833. );
  5834. } else {
  5835. if (Array.isArray(value)) {
  5836. value = toObject(value);
  5837. }
  5838. var hash;
  5839. var loop = function ( key ) {
  5840. if (
  5841. key === 'class' ||
  5842. key === 'style' ||
  5843. isReservedAttribute(key)
  5844. ) {
  5845. hash = data;
  5846. } else {
  5847. var type = data.attrs && data.attrs.type;
  5848. hash = asProp || config.mustUseProp(tag, type, key)
  5849. ? data.domProps || (data.domProps = {})
  5850. : data.attrs || (data.attrs = {});
  5851. }
  5852. var camelizedKey = camelize(key);
  5853. var hyphenatedKey = hyphenate(key);
  5854. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  5855. hash[key] = value[key];
  5856. if (isSync) {
  5857. var on = data.on || (data.on = {});
  5858. on[("update:" + key)] = function ($event) {
  5859. value[key] = $event;
  5860. };
  5861. }
  5862. }
  5863. };
  5864. for (var key in value) loop( key );
  5865. }
  5866. }
  5867. return data
  5868. }
  5869. /* */
  5870. /**
  5871. * Runtime helper for rendering static trees.
  5872. */
  5873. function renderStatic (
  5874. index,
  5875. isInFor
  5876. ) {
  5877. var cached = this._staticTrees || (this._staticTrees = []);
  5878. var tree = cached[index];
  5879. // if has already-rendered static tree and not inside v-for,
  5880. // we can reuse the same tree.
  5881. if (tree && !isInFor) {
  5882. return tree
  5883. }
  5884. // otherwise, render a fresh tree.
  5885. tree = cached[index] = this.$options.staticRenderFns[index].call(
  5886. this._renderProxy,
  5887. null,
  5888. this // for render fns generated for functional component templates
  5889. );
  5890. markStatic(tree, ("__static__" + index), false);
  5891. return tree
  5892. }
  5893. /**
  5894. * Runtime helper for v-once.
  5895. * Effectively it means marking the node as static with a unique key.
  5896. */
  5897. function markOnce (
  5898. tree,
  5899. index,
  5900. key
  5901. ) {
  5902. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  5903. return tree
  5904. }
  5905. function markStatic (
  5906. tree,
  5907. key,
  5908. isOnce
  5909. ) {
  5910. if (Array.isArray(tree)) {
  5911. for (var i = 0; i < tree.length; i++) {
  5912. if (tree[i] && typeof tree[i] !== 'string') {
  5913. markStaticNode(tree[i], (key + "_" + i), isOnce);
  5914. }
  5915. }
  5916. } else {
  5917. markStaticNode(tree, key, isOnce);
  5918. }
  5919. }
  5920. function markStaticNode (node, key, isOnce) {
  5921. node.isStatic = true;
  5922. node.key = key;
  5923. node.isOnce = isOnce;
  5924. }
  5925. /* */
  5926. function bindObjectListeners (data, value) {
  5927. if (value) {
  5928. if (!isPlainObject(value)) {
  5929. true && warn(
  5930. 'v-on without argument expects an Object value',
  5931. this
  5932. );
  5933. } else {
  5934. var on = data.on = data.on ? extend({}, data.on) : {};
  5935. for (var key in value) {
  5936. var existing = on[key];
  5937. var ours = value[key];
  5938. on[key] = existing ? [].concat(existing, ours) : ours;
  5939. }
  5940. }
  5941. }
  5942. return data
  5943. }
  5944. /* */
  5945. function resolveScopedSlots (
  5946. fns, // see flow/vnode
  5947. res,
  5948. // the following are added in 2.6
  5949. hasDynamicKeys,
  5950. contentHashKey
  5951. ) {
  5952. res = res || { $stable: !hasDynamicKeys };
  5953. for (var i = 0; i < fns.length; i++) {
  5954. var slot = fns[i];
  5955. if (Array.isArray(slot)) {
  5956. resolveScopedSlots(slot, res, hasDynamicKeys);
  5957. } else if (slot) {
  5958. // marker for reverse proxying v-slot without scope on this.$slots
  5959. if (slot.proxy) {
  5960. slot.fn.proxy = true;
  5961. }
  5962. res[slot.key] = slot.fn;
  5963. }
  5964. }
  5965. if (contentHashKey) {
  5966. (res).$key = contentHashKey;
  5967. }
  5968. return res
  5969. }
  5970. /* */
  5971. function bindDynamicKeys (baseObj, values) {
  5972. for (var i = 0; i < values.length; i += 2) {
  5973. var key = values[i];
  5974. if (typeof key === 'string' && key) {
  5975. baseObj[values[i]] = values[i + 1];
  5976. } else if ( true && key !== '' && key !== null) {
  5977. // null is a special value for explicitly removing a binding
  5978. warn(
  5979. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  5980. this
  5981. );
  5982. }
  5983. }
  5984. return baseObj
  5985. }
  5986. // helper to dynamically append modifier runtime markers to event names.
  5987. // ensure only append when value is already string, otherwise it will be cast
  5988. // to string and cause the type check to miss.
  5989. function prependModifier (value, symbol) {
  5990. return typeof value === 'string' ? symbol + value : value
  5991. }
  5992. /* */
  5993. function installRenderHelpers (target) {
  5994. target._o = markOnce;
  5995. target._n = toNumber;
  5996. target._s = toString;
  5997. target._l = renderList;
  5998. target._t = renderSlot;
  5999. target._q = looseEqual;
  6000. target._i = looseIndexOf;
  6001. target._m = renderStatic;
  6002. target._f = resolveFilter;
  6003. target._k = checkKeyCodes;
  6004. target._b = bindObjectProps;
  6005. target._v = createTextVNode;
  6006. target._e = createEmptyVNode;
  6007. target._u = resolveScopedSlots;
  6008. target._g = bindObjectListeners;
  6009. target._d = bindDynamicKeys;
  6010. target._p = prependModifier;
  6011. }
  6012. /* */
  6013. function FunctionalRenderContext (
  6014. data,
  6015. props,
  6016. children,
  6017. parent,
  6018. Ctor
  6019. ) {
  6020. var this$1 = this;
  6021. var options = Ctor.options;
  6022. // ensure the createElement function in functional components
  6023. // gets a unique context - this is necessary for correct named slot check
  6024. var contextVm;
  6025. if (hasOwn(parent, '_uid')) {
  6026. contextVm = Object.create(parent);
  6027. // $flow-disable-line
  6028. contextVm._original = parent;
  6029. } else {
  6030. // the context vm passed in is a functional context as well.
  6031. // in this case we want to make sure we are able to get a hold to the
  6032. // real context instance.
  6033. contextVm = parent;
  6034. // $flow-disable-line
  6035. parent = parent._original;
  6036. }
  6037. var isCompiled = isTrue(options._compiled);
  6038. var needNormalization = !isCompiled;
  6039. this.data = data;
  6040. this.props = props;
  6041. this.children = children;
  6042. this.parent = parent;
  6043. this.listeners = data.on || emptyObject;
  6044. this.injections = resolveInject(options.inject, parent);
  6045. this.slots = function () {
  6046. if (!this$1.$slots) {
  6047. normalizeScopedSlots(
  6048. data.scopedSlots,
  6049. this$1.$slots = resolveSlots(children, parent)
  6050. );
  6051. }
  6052. return this$1.$slots
  6053. };
  6054. Object.defineProperty(this, 'scopedSlots', ({
  6055. enumerable: true,
  6056. get: function get () {
  6057. return normalizeScopedSlots(data.scopedSlots, this.slots())
  6058. }
  6059. }));
  6060. // support for compiled functional template
  6061. if (isCompiled) {
  6062. // exposing $options for renderStatic()
  6063. this.$options = options;
  6064. // pre-resolve slots for renderSlot()
  6065. this.$slots = this.slots();
  6066. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  6067. }
  6068. if (options._scopeId) {
  6069. this._c = function (a, b, c, d) {
  6070. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  6071. if (vnode && !Array.isArray(vnode)) {
  6072. vnode.fnScopeId = options._scopeId;
  6073. vnode.fnContext = parent;
  6074. }
  6075. return vnode
  6076. };
  6077. } else {
  6078. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  6079. }
  6080. }
  6081. installRenderHelpers(FunctionalRenderContext.prototype);
  6082. function createFunctionalComponent (
  6083. Ctor,
  6084. propsData,
  6085. data,
  6086. contextVm,
  6087. children
  6088. ) {
  6089. var options = Ctor.options;
  6090. var props = {};
  6091. var propOptions = options.props;
  6092. if (isDef(propOptions)) {
  6093. for (var key in propOptions) {
  6094. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  6095. }
  6096. } else {
  6097. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  6098. if (isDef(data.props)) { mergeProps(props, data.props); }
  6099. }
  6100. var renderContext = new FunctionalRenderContext(
  6101. data,
  6102. props,
  6103. children,
  6104. contextVm,
  6105. Ctor
  6106. );
  6107. var vnode = options.render.call(null, renderContext._c, renderContext);
  6108. if (vnode instanceof VNode) {
  6109. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  6110. } else if (Array.isArray(vnode)) {
  6111. var vnodes = normalizeChildren(vnode) || [];
  6112. var res = new Array(vnodes.length);
  6113. for (var i = 0; i < vnodes.length; i++) {
  6114. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  6115. }
  6116. return res
  6117. }
  6118. }
  6119. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  6120. // #7817 clone node before setting fnContext, otherwise if the node is reused
  6121. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  6122. // that should not be matched to match.
  6123. var clone = cloneVNode(vnode);
  6124. clone.fnContext = contextVm;
  6125. clone.fnOptions = options;
  6126. if (true) {
  6127. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  6128. }
  6129. if (data.slot) {
  6130. (clone.data || (clone.data = {})).slot = data.slot;
  6131. }
  6132. return clone
  6133. }
  6134. function mergeProps (to, from) {
  6135. for (var key in from) {
  6136. to[camelize(key)] = from[key];
  6137. }
  6138. }
  6139. /* */
  6140. /* */
  6141. /* */
  6142. /* */
  6143. // inline hooks to be invoked on component VNodes during patch
  6144. var componentVNodeHooks = {
  6145. init: function init (vnode, hydrating) {
  6146. if (
  6147. vnode.componentInstance &&
  6148. !vnode.componentInstance._isDestroyed &&
  6149. vnode.data.keepAlive
  6150. ) {
  6151. // kept-alive components, treat as a patch
  6152. var mountedNode = vnode; // work around flow
  6153. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  6154. } else {
  6155. var child = vnode.componentInstance = createComponentInstanceForVnode(
  6156. vnode,
  6157. activeInstance
  6158. );
  6159. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  6160. }
  6161. },
  6162. prepatch: function prepatch (oldVnode, vnode) {
  6163. var options = vnode.componentOptions;
  6164. var child = vnode.componentInstance = oldVnode.componentInstance;
  6165. updateChildComponent(
  6166. child,
  6167. options.propsData, // updated props
  6168. options.listeners, // updated listeners
  6169. vnode, // new parent vnode
  6170. options.children // new children
  6171. );
  6172. },
  6173. insert: function insert (vnode) {
  6174. var context = vnode.context;
  6175. var componentInstance = vnode.componentInstance;
  6176. if (!componentInstance._isMounted) {
  6177. callHook(componentInstance, 'onServiceCreated');
  6178. callHook(componentInstance, 'onServiceAttached');
  6179. componentInstance._isMounted = true;
  6180. callHook(componentInstance, 'mounted');
  6181. }
  6182. if (vnode.data.keepAlive) {
  6183. if (context._isMounted) {
  6184. // vue-router#1212
  6185. // During updates, a kept-alive component's child components may
  6186. // change, so directly walking the tree here may call activated hooks
  6187. // on incorrect children. Instead we push them into a queue which will
  6188. // be processed after the whole patch process ended.
  6189. queueActivatedComponent(componentInstance);
  6190. } else {
  6191. activateChildComponent(componentInstance, true /* direct */);
  6192. }
  6193. }
  6194. },
  6195. destroy: function destroy (vnode) {
  6196. var componentInstance = vnode.componentInstance;
  6197. if (!componentInstance._isDestroyed) {
  6198. if (!vnode.data.keepAlive) {
  6199. componentInstance.$destroy();
  6200. } else {
  6201. deactivateChildComponent(componentInstance, true /* direct */);
  6202. }
  6203. }
  6204. }
  6205. };
  6206. var hooksToMerge = Object.keys(componentVNodeHooks);
  6207. function createComponent (
  6208. Ctor,
  6209. data,
  6210. context,
  6211. children,
  6212. tag
  6213. ) {
  6214. if (isUndef(Ctor)) {
  6215. return
  6216. }
  6217. var baseCtor = context.$options._base;
  6218. // plain options object: turn it into a constructor
  6219. if (isObject(Ctor)) {
  6220. Ctor = baseCtor.extend(Ctor);
  6221. }
  6222. // if at this stage it's not a constructor or an async component factory,
  6223. // reject.
  6224. if (typeof Ctor !== 'function') {
  6225. if (true) {
  6226. warn(("Invalid Component definition: " + (String(Ctor))), context);
  6227. }
  6228. return
  6229. }
  6230. // async component
  6231. var asyncFactory;
  6232. if (isUndef(Ctor.cid)) {
  6233. asyncFactory = Ctor;
  6234. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  6235. if (Ctor === undefined) {
  6236. // return a placeholder node for async component, which is rendered
  6237. // as a comment node but preserves all the raw information for the node.
  6238. // the information will be used for async server-rendering and hydration.
  6239. return createAsyncPlaceholder(
  6240. asyncFactory,
  6241. data,
  6242. context,
  6243. children,
  6244. tag
  6245. )
  6246. }
  6247. }
  6248. data = data || {};
  6249. // resolve constructor options in case global mixins are applied after
  6250. // component constructor creation
  6251. resolveConstructorOptions(Ctor);
  6252. // transform component v-model data into props & events
  6253. if (isDef(data.model)) {
  6254. transformModel(Ctor.options, data);
  6255. }
  6256. // extract props
  6257. var propsData = extractPropsFromVNodeData(data, Ctor, tag, context); // fixed by xxxxxx
  6258. // functional component
  6259. if (isTrue(Ctor.options.functional)) {
  6260. return createFunctionalComponent(Ctor, propsData, data, context, children)
  6261. }
  6262. // extract listeners, since these needs to be treated as
  6263. // child component listeners instead of DOM listeners
  6264. var listeners = data.on;
  6265. // replace with listeners with .native modifier
  6266. // so it gets processed during parent component patch.
  6267. data.on = data.nativeOn;
  6268. if (isTrue(Ctor.options.abstract)) {
  6269. // abstract components do not keep anything
  6270. // other than props & listeners & slot
  6271. // work around flow
  6272. var slot = data.slot;
  6273. data = {};
  6274. if (slot) {
  6275. data.slot = slot;
  6276. }
  6277. }
  6278. // install component management hooks onto the placeholder node
  6279. installComponentHooks(data);
  6280. // return a placeholder vnode
  6281. var name = Ctor.options.name || tag;
  6282. var vnode = new VNode(
  6283. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  6284. data, undefined, undefined, undefined, context,
  6285. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  6286. asyncFactory
  6287. );
  6288. return vnode
  6289. }
  6290. function createComponentInstanceForVnode (
  6291. vnode, // we know it's MountedComponentVNode but flow doesn't
  6292. parent // activeInstance in lifecycle state
  6293. ) {
  6294. var options = {
  6295. _isComponent: true,
  6296. _parentVnode: vnode,
  6297. parent: parent
  6298. };
  6299. // check inline-template render functions
  6300. var inlineTemplate = vnode.data.inlineTemplate;
  6301. if (isDef(inlineTemplate)) {
  6302. options.render = inlineTemplate.render;
  6303. options.staticRenderFns = inlineTemplate.staticRenderFns;
  6304. }
  6305. return new vnode.componentOptions.Ctor(options)
  6306. }
  6307. function installComponentHooks (data) {
  6308. var hooks = data.hook || (data.hook = {});
  6309. for (var i = 0; i < hooksToMerge.length; i++) {
  6310. var key = hooksToMerge[i];
  6311. var existing = hooks[key];
  6312. var toMerge = componentVNodeHooks[key];
  6313. if (existing !== toMerge && !(existing && existing._merged)) {
  6314. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  6315. }
  6316. }
  6317. }
  6318. function mergeHook$1 (f1, f2) {
  6319. var merged = function (a, b) {
  6320. // flow complains about extra args which is why we use any
  6321. f1(a, b);
  6322. f2(a, b);
  6323. };
  6324. merged._merged = true;
  6325. return merged
  6326. }
  6327. // transform component v-model info (value and callback) into
  6328. // prop and event handler respectively.
  6329. function transformModel (options, data) {
  6330. var prop = (options.model && options.model.prop) || 'value';
  6331. var event = (options.model && options.model.event) || 'input'
  6332. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  6333. var on = data.on || (data.on = {});
  6334. var existing = on[event];
  6335. var callback = data.model.callback;
  6336. if (isDef(existing)) {
  6337. if (
  6338. Array.isArray(existing)
  6339. ? existing.indexOf(callback) === -1
  6340. : existing !== callback
  6341. ) {
  6342. on[event] = [callback].concat(existing);
  6343. }
  6344. } else {
  6345. on[event] = callback;
  6346. }
  6347. }
  6348. /* */
  6349. var SIMPLE_NORMALIZE = 1;
  6350. var ALWAYS_NORMALIZE = 2;
  6351. // wrapper function for providing a more flexible interface
  6352. // without getting yelled at by flow
  6353. function createElement (
  6354. context,
  6355. tag,
  6356. data,
  6357. children,
  6358. normalizationType,
  6359. alwaysNormalize
  6360. ) {
  6361. if (Array.isArray(data) || isPrimitive(data)) {
  6362. normalizationType = children;
  6363. children = data;
  6364. data = undefined;
  6365. }
  6366. if (isTrue(alwaysNormalize)) {
  6367. normalizationType = ALWAYS_NORMALIZE;
  6368. }
  6369. return _createElement(context, tag, data, children, normalizationType)
  6370. }
  6371. function _createElement (
  6372. context,
  6373. tag,
  6374. data,
  6375. children,
  6376. normalizationType
  6377. ) {
  6378. if (isDef(data) && isDef((data).__ob__)) {
  6379. true && warn(
  6380. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  6381. 'Always create fresh vnode data objects in each render!',
  6382. context
  6383. );
  6384. return createEmptyVNode()
  6385. }
  6386. // object syntax in v-bind
  6387. if (isDef(data) && isDef(data.is)) {
  6388. tag = data.is;
  6389. }
  6390. if (!tag) {
  6391. // in case of component :is set to falsy value
  6392. return createEmptyVNode()
  6393. }
  6394. // warn against non-primitive key
  6395. if ( true &&
  6396. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  6397. ) {
  6398. {
  6399. warn(
  6400. 'Avoid using non-primitive value as key, ' +
  6401. 'use string/number value instead.',
  6402. context
  6403. );
  6404. }
  6405. }
  6406. // support single function children as default scoped slot
  6407. if (Array.isArray(children) &&
  6408. typeof children[0] === 'function'
  6409. ) {
  6410. data = data || {};
  6411. data.scopedSlots = { default: children[0] };
  6412. children.length = 0;
  6413. }
  6414. if (normalizationType === ALWAYS_NORMALIZE) {
  6415. children = normalizeChildren(children);
  6416. } else if (normalizationType === SIMPLE_NORMALIZE) {
  6417. children = simpleNormalizeChildren(children);
  6418. }
  6419. var vnode, ns;
  6420. if (typeof tag === 'string') {
  6421. var Ctor;
  6422. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  6423. if (config.isReservedTag(tag)) {
  6424. // platform built-in elements
  6425. if ( true && isDef(data) && isDef(data.nativeOn)) {
  6426. warn(
  6427. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  6428. context
  6429. );
  6430. }
  6431. vnode = new VNode(
  6432. config.parsePlatformTagName(tag), data, children,
  6433. undefined, undefined, context
  6434. );
  6435. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  6436. // component
  6437. vnode = createComponent(Ctor, data, context, children, tag);
  6438. } else {
  6439. // unknown or unlisted namespaced elements
  6440. // check at runtime because it may get assigned a namespace when its
  6441. // parent normalizes children
  6442. vnode = new VNode(
  6443. tag, data, children,
  6444. undefined, undefined, context
  6445. );
  6446. }
  6447. } else {
  6448. // direct component options / constructor
  6449. vnode = createComponent(tag, data, context, children);
  6450. }
  6451. if (Array.isArray(vnode)) {
  6452. return vnode
  6453. } else if (isDef(vnode)) {
  6454. if (isDef(ns)) { applyNS(vnode, ns); }
  6455. if (isDef(data)) { registerDeepBindings(data); }
  6456. return vnode
  6457. } else {
  6458. return createEmptyVNode()
  6459. }
  6460. }
  6461. function applyNS (vnode, ns, force) {
  6462. vnode.ns = ns;
  6463. if (vnode.tag === 'foreignObject') {
  6464. // use default namespace inside foreignObject
  6465. ns = undefined;
  6466. force = true;
  6467. }
  6468. if (isDef(vnode.children)) {
  6469. for (var i = 0, l = vnode.children.length; i < l; i++) {
  6470. var child = vnode.children[i];
  6471. if (isDef(child.tag) && (
  6472. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  6473. applyNS(child, ns, force);
  6474. }
  6475. }
  6476. }
  6477. }
  6478. // ref #5318
  6479. // necessary to ensure parent re-render when deep bindings like :style and
  6480. // :class are used on slot nodes
  6481. function registerDeepBindings (data) {
  6482. if (isObject(data.style)) {
  6483. traverse(data.style);
  6484. }
  6485. if (isObject(data.class)) {
  6486. traverse(data.class);
  6487. }
  6488. }
  6489. /* */
  6490. function initRender (vm) {
  6491. vm._vnode = null; // the root of the child tree
  6492. vm._staticTrees = null; // v-once cached trees
  6493. var options = vm.$options;
  6494. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  6495. var renderContext = parentVnode && parentVnode.context;
  6496. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  6497. vm.$scopedSlots = emptyObject;
  6498. // bind the createElement fn to this instance
  6499. // so that we get proper render context inside it.
  6500. // args order: tag, data, children, normalizationType, alwaysNormalize
  6501. // internal version is used by render functions compiled from templates
  6502. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  6503. // normalization is always applied for the public version, used in
  6504. // user-written render functions.
  6505. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  6506. // $attrs & $listeners are exposed for easier HOC creation.
  6507. // they need to be reactive so that HOCs using them are always updated
  6508. var parentData = parentVnode && parentVnode.data;
  6509. /* istanbul ignore else */
  6510. if (true) {
  6511. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  6512. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  6513. }, true);
  6514. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  6515. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  6516. }, true);
  6517. } else {}
  6518. }
  6519. var currentRenderingInstance = null;
  6520. function renderMixin (Vue) {
  6521. // install runtime convenience helpers
  6522. installRenderHelpers(Vue.prototype);
  6523. Vue.prototype.$nextTick = function (fn) {
  6524. return nextTick(fn, this)
  6525. };
  6526. Vue.prototype._render = function () {
  6527. var vm = this;
  6528. var ref = vm.$options;
  6529. var render = ref.render;
  6530. var _parentVnode = ref._parentVnode;
  6531. if (_parentVnode) {
  6532. vm.$scopedSlots = normalizeScopedSlots(
  6533. _parentVnode.data.scopedSlots,
  6534. vm.$slots,
  6535. vm.$scopedSlots
  6536. );
  6537. }
  6538. // set parent vnode. this allows render functions to have access
  6539. // to the data on the placeholder node.
  6540. vm.$vnode = _parentVnode;
  6541. // render self
  6542. var vnode;
  6543. try {
  6544. // There's no need to maintain a stack because all render fns are called
  6545. // separately from one another. Nested component's render fns are called
  6546. // when parent component is patched.
  6547. currentRenderingInstance = vm;
  6548. vnode = render.call(vm._renderProxy, vm.$createElement);
  6549. } catch (e) {
  6550. handleError(e, vm, "render");
  6551. // return error render result,
  6552. // or previous vnode to prevent render error causing blank component
  6553. /* istanbul ignore else */
  6554. if ( true && vm.$options.renderError) {
  6555. try {
  6556. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  6557. } catch (e) {
  6558. handleError(e, vm, "renderError");
  6559. vnode = vm._vnode;
  6560. }
  6561. } else {
  6562. vnode = vm._vnode;
  6563. }
  6564. } finally {
  6565. currentRenderingInstance = null;
  6566. }
  6567. // if the returned array contains only a single node, allow it
  6568. if (Array.isArray(vnode) && vnode.length === 1) {
  6569. vnode = vnode[0];
  6570. }
  6571. // return empty vnode in case the render function errored out
  6572. if (!(vnode instanceof VNode)) {
  6573. if ( true && Array.isArray(vnode)) {
  6574. warn(
  6575. 'Multiple root nodes returned from render function. Render function ' +
  6576. 'should return a single root node.',
  6577. vm
  6578. );
  6579. }
  6580. vnode = createEmptyVNode();
  6581. }
  6582. // set parent
  6583. vnode.parent = _parentVnode;
  6584. return vnode
  6585. };
  6586. }
  6587. /* */
  6588. function ensureCtor (comp, base) {
  6589. if (
  6590. comp.__esModule ||
  6591. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  6592. ) {
  6593. comp = comp.default;
  6594. }
  6595. return isObject(comp)
  6596. ? base.extend(comp)
  6597. : comp
  6598. }
  6599. function createAsyncPlaceholder (
  6600. factory,
  6601. data,
  6602. context,
  6603. children,
  6604. tag
  6605. ) {
  6606. var node = createEmptyVNode();
  6607. node.asyncFactory = factory;
  6608. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  6609. return node
  6610. }
  6611. function resolveAsyncComponent (
  6612. factory,
  6613. baseCtor
  6614. ) {
  6615. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  6616. return factory.errorComp
  6617. }
  6618. if (isDef(factory.resolved)) {
  6619. return factory.resolved
  6620. }
  6621. var owner = currentRenderingInstance;
  6622. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  6623. // already pending
  6624. factory.owners.push(owner);
  6625. }
  6626. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  6627. return factory.loadingComp
  6628. }
  6629. if (owner && !isDef(factory.owners)) {
  6630. var owners = factory.owners = [owner];
  6631. var sync = true;
  6632. var timerLoading = null;
  6633. var timerTimeout = null
  6634. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  6635. var forceRender = function (renderCompleted) {
  6636. for (var i = 0, l = owners.length; i < l; i++) {
  6637. (owners[i]).$forceUpdate();
  6638. }
  6639. if (renderCompleted) {
  6640. owners.length = 0;
  6641. if (timerLoading !== null) {
  6642. clearTimeout(timerLoading);
  6643. timerLoading = null;
  6644. }
  6645. if (timerTimeout !== null) {
  6646. clearTimeout(timerTimeout);
  6647. timerTimeout = null;
  6648. }
  6649. }
  6650. };
  6651. var resolve = once(function (res) {
  6652. // cache resolved
  6653. factory.resolved = ensureCtor(res, baseCtor);
  6654. // invoke callbacks only if this is not a synchronous resolve
  6655. // (async resolves are shimmed as synchronous during SSR)
  6656. if (!sync) {
  6657. forceRender(true);
  6658. } else {
  6659. owners.length = 0;
  6660. }
  6661. });
  6662. var reject = once(function (reason) {
  6663. true && warn(
  6664. "Failed to resolve async component: " + (String(factory)) +
  6665. (reason ? ("\nReason: " + reason) : '')
  6666. );
  6667. if (isDef(factory.errorComp)) {
  6668. factory.error = true;
  6669. forceRender(true);
  6670. }
  6671. });
  6672. var res = factory(resolve, reject);
  6673. if (isObject(res)) {
  6674. if (isPromise(res)) {
  6675. // () => Promise
  6676. if (isUndef(factory.resolved)) {
  6677. res.then(resolve, reject);
  6678. }
  6679. } else if (isPromise(res.component)) {
  6680. res.component.then(resolve, reject);
  6681. if (isDef(res.error)) {
  6682. factory.errorComp = ensureCtor(res.error, baseCtor);
  6683. }
  6684. if (isDef(res.loading)) {
  6685. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  6686. if (res.delay === 0) {
  6687. factory.loading = true;
  6688. } else {
  6689. timerLoading = setTimeout(function () {
  6690. timerLoading = null;
  6691. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  6692. factory.loading = true;
  6693. forceRender(false);
  6694. }
  6695. }, res.delay || 200);
  6696. }
  6697. }
  6698. if (isDef(res.timeout)) {
  6699. timerTimeout = setTimeout(function () {
  6700. timerTimeout = null;
  6701. if (isUndef(factory.resolved)) {
  6702. reject(
  6703. true
  6704. ? ("timeout (" + (res.timeout) + "ms)")
  6705. : undefined
  6706. );
  6707. }
  6708. }, res.timeout);
  6709. }
  6710. }
  6711. }
  6712. sync = false;
  6713. // return in case resolved synchronously
  6714. return factory.loading
  6715. ? factory.loadingComp
  6716. : factory.resolved
  6717. }
  6718. }
  6719. /* */
  6720. function isAsyncPlaceholder (node) {
  6721. return node.isComment && node.asyncFactory
  6722. }
  6723. /* */
  6724. function getFirstComponentChild (children) {
  6725. if (Array.isArray(children)) {
  6726. for (var i = 0; i < children.length; i++) {
  6727. var c = children[i];
  6728. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  6729. return c
  6730. }
  6731. }
  6732. }
  6733. }
  6734. /* */
  6735. /* */
  6736. function initEvents (vm) {
  6737. vm._events = Object.create(null);
  6738. vm._hasHookEvent = false;
  6739. // init parent attached events
  6740. var listeners = vm.$options._parentListeners;
  6741. if (listeners) {
  6742. updateComponentListeners(vm, listeners);
  6743. }
  6744. }
  6745. var target;
  6746. function add (event, fn) {
  6747. target.$on(event, fn);
  6748. }
  6749. function remove$1 (event, fn) {
  6750. target.$off(event, fn);
  6751. }
  6752. function createOnceHandler (event, fn) {
  6753. var _target = target;
  6754. return function onceHandler () {
  6755. var res = fn.apply(null, arguments);
  6756. if (res !== null) {
  6757. _target.$off(event, onceHandler);
  6758. }
  6759. }
  6760. }
  6761. function updateComponentListeners (
  6762. vm,
  6763. listeners,
  6764. oldListeners
  6765. ) {
  6766. target = vm;
  6767. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  6768. target = undefined;
  6769. }
  6770. function eventsMixin (Vue) {
  6771. var hookRE = /^hook:/;
  6772. Vue.prototype.$on = function (event, fn) {
  6773. var vm = this;
  6774. if (Array.isArray(event)) {
  6775. for (var i = 0, l = event.length; i < l; i++) {
  6776. vm.$on(event[i], fn);
  6777. }
  6778. } else {
  6779. (vm._events[event] || (vm._events[event] = [])).push(fn);
  6780. // optimize hook:event cost by using a boolean flag marked at registration
  6781. // instead of a hash lookup
  6782. if (hookRE.test(event)) {
  6783. vm._hasHookEvent = true;
  6784. }
  6785. }
  6786. return vm
  6787. };
  6788. Vue.prototype.$once = function (event, fn) {
  6789. var vm = this;
  6790. function on () {
  6791. vm.$off(event, on);
  6792. fn.apply(vm, arguments);
  6793. }
  6794. on.fn = fn;
  6795. vm.$on(event, on);
  6796. return vm
  6797. };
  6798. Vue.prototype.$off = function (event, fn) {
  6799. var vm = this;
  6800. // all
  6801. if (!arguments.length) {
  6802. vm._events = Object.create(null);
  6803. return vm
  6804. }
  6805. // array of events
  6806. if (Array.isArray(event)) {
  6807. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  6808. vm.$off(event[i$1], fn);
  6809. }
  6810. return vm
  6811. }
  6812. // specific event
  6813. var cbs = vm._events[event];
  6814. if (!cbs) {
  6815. return vm
  6816. }
  6817. if (!fn) {
  6818. vm._events[event] = null;
  6819. return vm
  6820. }
  6821. // specific handler
  6822. var cb;
  6823. var i = cbs.length;
  6824. while (i--) {
  6825. cb = cbs[i];
  6826. if (cb === fn || cb.fn === fn) {
  6827. cbs.splice(i, 1);
  6828. break
  6829. }
  6830. }
  6831. return vm
  6832. };
  6833. Vue.prototype.$emit = function (event) {
  6834. var vm = this;
  6835. if (true) {
  6836. var lowerCaseEvent = event.toLowerCase();
  6837. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  6838. tip(
  6839. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  6840. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  6841. "Note that HTML attributes are case-insensitive and you cannot use " +
  6842. "v-on to listen to camelCase events when using in-DOM templates. " +
  6843. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  6844. );
  6845. }
  6846. }
  6847. var cbs = vm._events[event];
  6848. if (cbs) {
  6849. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  6850. var args = toArray(arguments, 1);
  6851. var info = "event handler for \"" + event + "\"";
  6852. for (var i = 0, l = cbs.length; i < l; i++) {
  6853. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  6854. }
  6855. }
  6856. return vm
  6857. };
  6858. }
  6859. /* */
  6860. var activeInstance = null;
  6861. var isUpdatingChildComponent = false;
  6862. function setActiveInstance(vm) {
  6863. var prevActiveInstance = activeInstance;
  6864. activeInstance = vm;
  6865. return function () {
  6866. activeInstance = prevActiveInstance;
  6867. }
  6868. }
  6869. function initLifecycle (vm) {
  6870. var options = vm.$options;
  6871. // locate first non-abstract parent
  6872. var parent = options.parent;
  6873. if (parent && !options.abstract) {
  6874. while (parent.$options.abstract && parent.$parent) {
  6875. parent = parent.$parent;
  6876. }
  6877. parent.$children.push(vm);
  6878. }
  6879. vm.$parent = parent;
  6880. vm.$root = parent ? parent.$root : vm;
  6881. vm.$children = [];
  6882. vm.$refs = {};
  6883. vm._watcher = null;
  6884. vm._inactive = null;
  6885. vm._directInactive = false;
  6886. vm._isMounted = false;
  6887. vm._isDestroyed = false;
  6888. vm._isBeingDestroyed = false;
  6889. }
  6890. function lifecycleMixin (Vue) {
  6891. Vue.prototype._update = function (vnode, hydrating) {
  6892. var vm = this;
  6893. var prevEl = vm.$el;
  6894. var prevVnode = vm._vnode;
  6895. var restoreActiveInstance = setActiveInstance(vm);
  6896. vm._vnode = vnode;
  6897. // Vue.prototype.__patch__ is injected in entry points
  6898. // based on the rendering backend used.
  6899. if (!prevVnode) {
  6900. // initial render
  6901. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  6902. } else {
  6903. // updates
  6904. vm.$el = vm.__patch__(prevVnode, vnode);
  6905. }
  6906. restoreActiveInstance();
  6907. // update __vue__ reference
  6908. if (prevEl) {
  6909. prevEl.__vue__ = null;
  6910. }
  6911. if (vm.$el) {
  6912. vm.$el.__vue__ = vm;
  6913. }
  6914. // if parent is an HOC, update its $el as well
  6915. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  6916. vm.$parent.$el = vm.$el;
  6917. }
  6918. // updated hook is called by the scheduler to ensure that children are
  6919. // updated in a parent's updated hook.
  6920. };
  6921. Vue.prototype.$forceUpdate = function () {
  6922. var vm = this;
  6923. if (vm._watcher) {
  6924. vm._watcher.update();
  6925. }
  6926. };
  6927. Vue.prototype.$destroy = function () {
  6928. var vm = this;
  6929. if (vm._isBeingDestroyed) {
  6930. return
  6931. }
  6932. callHook(vm, 'beforeDestroy');
  6933. vm._isBeingDestroyed = true;
  6934. // remove self from parent
  6935. var parent = vm.$parent;
  6936. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  6937. remove(parent.$children, vm);
  6938. }
  6939. // teardown watchers
  6940. if (vm._watcher) {
  6941. vm._watcher.teardown();
  6942. }
  6943. var i = vm._watchers.length;
  6944. while (i--) {
  6945. vm._watchers[i].teardown();
  6946. }
  6947. // remove reference from data ob
  6948. // frozen object may not have observer.
  6949. if (vm._data.__ob__) {
  6950. vm._data.__ob__.vmCount--;
  6951. }
  6952. // call the last hook...
  6953. vm._isDestroyed = true;
  6954. // invoke destroy hooks on current rendered tree
  6955. vm.__patch__(vm._vnode, null);
  6956. // fire destroyed hook
  6957. callHook(vm, 'destroyed');
  6958. // turn off all instance listeners.
  6959. vm.$off();
  6960. // remove __vue__ reference
  6961. if (vm.$el) {
  6962. vm.$el.__vue__ = null;
  6963. }
  6964. // release circular reference (#6759)
  6965. if (vm.$vnode) {
  6966. vm.$vnode.parent = null;
  6967. }
  6968. };
  6969. }
  6970. function updateChildComponent (
  6971. vm,
  6972. propsData,
  6973. listeners,
  6974. parentVnode,
  6975. renderChildren
  6976. ) {
  6977. if (true) {
  6978. isUpdatingChildComponent = true;
  6979. }
  6980. // determine whether component has slot children
  6981. // we need to do this before overwriting $options._renderChildren.
  6982. // check if there are dynamic scopedSlots (hand-written or compiled but with
  6983. // dynamic slot names). Static scoped slots compiled from template has the
  6984. // "$stable" marker.
  6985. var newScopedSlots = parentVnode.data.scopedSlots;
  6986. var oldScopedSlots = vm.$scopedSlots;
  6987. var hasDynamicScopedSlot = !!(
  6988. (newScopedSlots && !newScopedSlots.$stable) ||
  6989. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  6990. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  6991. );
  6992. // Any static slot children from the parent may have changed during parent's
  6993. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  6994. // update is necessary to ensure correctness.
  6995. var needsForceUpdate = !!(
  6996. renderChildren || // has new static slots
  6997. vm.$options._renderChildren || // has old static slots
  6998. hasDynamicScopedSlot
  6999. );
  7000. vm.$options._parentVnode = parentVnode;
  7001. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  7002. if (vm._vnode) { // update child tree's parent
  7003. vm._vnode.parent = parentVnode;
  7004. }
  7005. vm.$options._renderChildren = renderChildren;
  7006. // update $attrs and $listeners hash
  7007. // these are also reactive so they may trigger child update if the child
  7008. // used them during render
  7009. vm.$attrs = parentVnode.data.attrs || emptyObject;
  7010. vm.$listeners = listeners || emptyObject;
  7011. // update props
  7012. if (propsData && vm.$options.props) {
  7013. toggleObserving(false);
  7014. var props = vm._props;
  7015. var propKeys = vm.$options._propKeys || [];
  7016. for (var i = 0; i < propKeys.length; i++) {
  7017. var key = propKeys[i];
  7018. var propOptions = vm.$options.props; // wtf flow?
  7019. props[key] = validateProp(key, propOptions, propsData, vm);
  7020. }
  7021. toggleObserving(true);
  7022. // keep a copy of raw propsData
  7023. vm.$options.propsData = propsData;
  7024. }
  7025. // fixed by xxxxxx update properties(mp runtime)
  7026. vm._$updateProperties && vm._$updateProperties(vm);
  7027. // update listeners
  7028. listeners = listeners || emptyObject;
  7029. var oldListeners = vm.$options._parentListeners;
  7030. vm.$options._parentListeners = listeners;
  7031. updateComponentListeners(vm, listeners, oldListeners);
  7032. // resolve slots + force update if has children
  7033. if (needsForceUpdate) {
  7034. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  7035. vm.$forceUpdate();
  7036. }
  7037. if (true) {
  7038. isUpdatingChildComponent = false;
  7039. }
  7040. }
  7041. function isInInactiveTree (vm) {
  7042. while (vm && (vm = vm.$parent)) {
  7043. if (vm._inactive) { return true }
  7044. }
  7045. return false
  7046. }
  7047. function activateChildComponent (vm, direct) {
  7048. if (direct) {
  7049. vm._directInactive = false;
  7050. if (isInInactiveTree(vm)) {
  7051. return
  7052. }
  7053. } else if (vm._directInactive) {
  7054. return
  7055. }
  7056. if (vm._inactive || vm._inactive === null) {
  7057. vm._inactive = false;
  7058. for (var i = 0; i < vm.$children.length; i++) {
  7059. activateChildComponent(vm.$children[i]);
  7060. }
  7061. callHook(vm, 'activated');
  7062. }
  7063. }
  7064. function deactivateChildComponent (vm, direct) {
  7065. if (direct) {
  7066. vm._directInactive = true;
  7067. if (isInInactiveTree(vm)) {
  7068. return
  7069. }
  7070. }
  7071. if (!vm._inactive) {
  7072. vm._inactive = true;
  7073. for (var i = 0; i < vm.$children.length; i++) {
  7074. deactivateChildComponent(vm.$children[i]);
  7075. }
  7076. callHook(vm, 'deactivated');
  7077. }
  7078. }
  7079. function callHook (vm, hook) {
  7080. // #7573 disable dep collection when invoking lifecycle hooks
  7081. pushTarget();
  7082. var handlers = vm.$options[hook];
  7083. var info = hook + " hook";
  7084. if (handlers) {
  7085. for (var i = 0, j = handlers.length; i < j; i++) {
  7086. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  7087. }
  7088. }
  7089. if (vm._hasHookEvent) {
  7090. vm.$emit('hook:' + hook);
  7091. }
  7092. popTarget();
  7093. }
  7094. /* */
  7095. var MAX_UPDATE_COUNT = 100;
  7096. var queue = [];
  7097. var activatedChildren = [];
  7098. var has = {};
  7099. var circular = {};
  7100. var waiting = false;
  7101. var flushing = false;
  7102. var index = 0;
  7103. /**
  7104. * Reset the scheduler's state.
  7105. */
  7106. function resetSchedulerState () {
  7107. index = queue.length = activatedChildren.length = 0;
  7108. has = {};
  7109. if (true) {
  7110. circular = {};
  7111. }
  7112. waiting = flushing = false;
  7113. }
  7114. // Async edge case #6566 requires saving the timestamp when event listeners are
  7115. // attached. However, calling performance.now() has a perf overhead especially
  7116. // if the page has thousands of event listeners. Instead, we take a timestamp
  7117. // every time the scheduler flushes and use that for all event listeners
  7118. // attached during that flush.
  7119. var currentFlushTimestamp = 0;
  7120. // Async edge case fix requires storing an event listener's attach timestamp.
  7121. var getNow = Date.now;
  7122. // Determine what event timestamp the browser is using. Annoyingly, the
  7123. // timestamp can either be hi-res (relative to page load) or low-res
  7124. // (relative to UNIX epoch), so in order to compare time we have to use the
  7125. // same timestamp type when saving the flush timestamp.
  7126. // All IE versions use low-res event timestamps, and have problematic clock
  7127. // implementations (#9632)
  7128. if (inBrowser && !isIE) {
  7129. var performance = window.performance;
  7130. if (
  7131. performance &&
  7132. typeof performance.now === 'function' &&
  7133. getNow() > document.createEvent('Event').timeStamp
  7134. ) {
  7135. // if the event timestamp, although evaluated AFTER the Date.now(), is
  7136. // smaller than it, it means the event is using a hi-res timestamp,
  7137. // and we need to use the hi-res version for event listener timestamps as
  7138. // well.
  7139. getNow = function () { return performance.now(); };
  7140. }
  7141. }
  7142. /**
  7143. * Flush both queues and run the watchers.
  7144. */
  7145. function flushSchedulerQueue () {
  7146. currentFlushTimestamp = getNow();
  7147. flushing = true;
  7148. var watcher, id;
  7149. // Sort queue before flush.
  7150. // This ensures that:
  7151. // 1. Components are updated from parent to child. (because parent is always
  7152. // created before the child)
  7153. // 2. A component's user watchers are run before its render watcher (because
  7154. // user watchers are created before the render watcher)
  7155. // 3. If a component is destroyed during a parent component's watcher run,
  7156. // its watchers can be skipped.
  7157. queue.sort(function (a, b) { return a.id - b.id; });
  7158. // do not cache length because more watchers might be pushed
  7159. // as we run existing watchers
  7160. for (index = 0; index < queue.length; index++) {
  7161. watcher = queue[index];
  7162. if (watcher.before) {
  7163. watcher.before();
  7164. }
  7165. id = watcher.id;
  7166. has[id] = null;
  7167. watcher.run();
  7168. // in dev build, check and stop circular updates.
  7169. if ( true && has[id] != null) {
  7170. circular[id] = (circular[id] || 0) + 1;
  7171. if (circular[id] > MAX_UPDATE_COUNT) {
  7172. warn(
  7173. 'You may have an infinite update loop ' + (
  7174. watcher.user
  7175. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  7176. : "in a component render function."
  7177. ),
  7178. watcher.vm
  7179. );
  7180. break
  7181. }
  7182. }
  7183. }
  7184. // keep copies of post queues before resetting state
  7185. var activatedQueue = activatedChildren.slice();
  7186. var updatedQueue = queue.slice();
  7187. resetSchedulerState();
  7188. // call component updated and activated hooks
  7189. callActivatedHooks(activatedQueue);
  7190. callUpdatedHooks(updatedQueue);
  7191. // devtool hook
  7192. /* istanbul ignore if */
  7193. if (devtools && config.devtools) {
  7194. devtools.emit('flush');
  7195. }
  7196. }
  7197. function callUpdatedHooks (queue) {
  7198. var i = queue.length;
  7199. while (i--) {
  7200. var watcher = queue[i];
  7201. var vm = watcher.vm;
  7202. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  7203. callHook(vm, 'updated');
  7204. }
  7205. }
  7206. }
  7207. /**
  7208. * Queue a kept-alive component that was activated during patch.
  7209. * The queue will be processed after the entire tree has been patched.
  7210. */
  7211. function queueActivatedComponent (vm) {
  7212. // setting _inactive to false here so that a render function can
  7213. // rely on checking whether it's in an inactive tree (e.g. router-view)
  7214. vm._inactive = false;
  7215. activatedChildren.push(vm);
  7216. }
  7217. function callActivatedHooks (queue) {
  7218. for (var i = 0; i < queue.length; i++) {
  7219. queue[i]._inactive = true;
  7220. activateChildComponent(queue[i], true /* true */);
  7221. }
  7222. }
  7223. /**
  7224. * Push a watcher into the watcher queue.
  7225. * Jobs with duplicate IDs will be skipped unless it's
  7226. * pushed when the queue is being flushed.
  7227. */
  7228. function queueWatcher (watcher) {
  7229. var id = watcher.id;
  7230. if (has[id] == null) {
  7231. has[id] = true;
  7232. if (!flushing) {
  7233. queue.push(watcher);
  7234. } else {
  7235. // if already flushing, splice the watcher based on its id
  7236. // if already past its id, it will be run next immediately.
  7237. var i = queue.length - 1;
  7238. while (i > index && queue[i].id > watcher.id) {
  7239. i--;
  7240. }
  7241. queue.splice(i + 1, 0, watcher);
  7242. }
  7243. // queue the flush
  7244. if (!waiting) {
  7245. waiting = true;
  7246. if ( true && !config.async) {
  7247. flushSchedulerQueue();
  7248. return
  7249. }
  7250. nextTick(flushSchedulerQueue);
  7251. }
  7252. }
  7253. }
  7254. /* */
  7255. var uid$2 = 0;
  7256. /**
  7257. * A watcher parses an expression, collects dependencies,
  7258. * and fires callback when the expression value changes.
  7259. * This is used for both the $watch() api and directives.
  7260. */
  7261. var Watcher = function Watcher (
  7262. vm,
  7263. expOrFn,
  7264. cb,
  7265. options,
  7266. isRenderWatcher
  7267. ) {
  7268. this.vm = vm;
  7269. if (isRenderWatcher) {
  7270. vm._watcher = this;
  7271. }
  7272. vm._watchers.push(this);
  7273. // options
  7274. if (options) {
  7275. this.deep = !!options.deep;
  7276. this.user = !!options.user;
  7277. this.lazy = !!options.lazy;
  7278. this.sync = !!options.sync;
  7279. this.before = options.before;
  7280. } else {
  7281. this.deep = this.user = this.lazy = this.sync = false;
  7282. }
  7283. this.cb = cb;
  7284. this.id = ++uid$2; // uid for batching
  7285. this.active = true;
  7286. this.dirty = this.lazy; // for lazy watchers
  7287. this.deps = [];
  7288. this.newDeps = [];
  7289. this.depIds = new _Set();
  7290. this.newDepIds = new _Set();
  7291. this.expression = true
  7292. ? expOrFn.toString()
  7293. : undefined;
  7294. // parse expression for getter
  7295. if (typeof expOrFn === 'function') {
  7296. this.getter = expOrFn;
  7297. } else {
  7298. this.getter = parsePath(expOrFn);
  7299. if (!this.getter) {
  7300. this.getter = noop;
  7301. true && warn(
  7302. "Failed watching path: \"" + expOrFn + "\" " +
  7303. 'Watcher only accepts simple dot-delimited paths. ' +
  7304. 'For full control, use a function instead.',
  7305. vm
  7306. );
  7307. }
  7308. }
  7309. this.value = this.lazy
  7310. ? undefined
  7311. : this.get();
  7312. };
  7313. /**
  7314. * Evaluate the getter, and re-collect dependencies.
  7315. */
  7316. Watcher.prototype.get = function get () {
  7317. pushTarget(this);
  7318. var value;
  7319. var vm = this.vm;
  7320. try {
  7321. value = this.getter.call(vm, vm);
  7322. } catch (e) {
  7323. if (this.user) {
  7324. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  7325. } else {
  7326. throw e
  7327. }
  7328. } finally {
  7329. // "touch" every property so they are all tracked as
  7330. // dependencies for deep watching
  7331. if (this.deep) {
  7332. traverse(value);
  7333. }
  7334. popTarget();
  7335. this.cleanupDeps();
  7336. }
  7337. return value
  7338. };
  7339. /**
  7340. * Add a dependency to this directive.
  7341. */
  7342. Watcher.prototype.addDep = function addDep (dep) {
  7343. var id = dep.id;
  7344. if (!this.newDepIds.has(id)) {
  7345. this.newDepIds.add(id);
  7346. this.newDeps.push(dep);
  7347. if (!this.depIds.has(id)) {
  7348. dep.addSub(this);
  7349. }
  7350. }
  7351. };
  7352. /**
  7353. * Clean up for dependency collection.
  7354. */
  7355. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  7356. var i = this.deps.length;
  7357. while (i--) {
  7358. var dep = this.deps[i];
  7359. if (!this.newDepIds.has(dep.id)) {
  7360. dep.removeSub(this);
  7361. }
  7362. }
  7363. var tmp = this.depIds;
  7364. this.depIds = this.newDepIds;
  7365. this.newDepIds = tmp;
  7366. this.newDepIds.clear();
  7367. tmp = this.deps;
  7368. this.deps = this.newDeps;
  7369. this.newDeps = tmp;
  7370. this.newDeps.length = 0;
  7371. };
  7372. /**
  7373. * Subscriber interface.
  7374. * Will be called when a dependency changes.
  7375. */
  7376. Watcher.prototype.update = function update () {
  7377. /* istanbul ignore else */
  7378. if (this.lazy) {
  7379. this.dirty = true;
  7380. } else if (this.sync) {
  7381. this.run();
  7382. } else {
  7383. queueWatcher(this);
  7384. }
  7385. };
  7386. /**
  7387. * Scheduler job interface.
  7388. * Will be called by the scheduler.
  7389. */
  7390. Watcher.prototype.run = function run () {
  7391. if (this.active) {
  7392. var value = this.get();
  7393. if (
  7394. value !== this.value ||
  7395. // Deep watchers and watchers on Object/Arrays should fire even
  7396. // when the value is the same, because the value may
  7397. // have mutated.
  7398. isObject(value) ||
  7399. this.deep
  7400. ) {
  7401. // set new value
  7402. var oldValue = this.value;
  7403. this.value = value;
  7404. if (this.user) {
  7405. try {
  7406. this.cb.call(this.vm, value, oldValue);
  7407. } catch (e) {
  7408. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  7409. }
  7410. } else {
  7411. this.cb.call(this.vm, value, oldValue);
  7412. }
  7413. }
  7414. }
  7415. };
  7416. /**
  7417. * Evaluate the value of the watcher.
  7418. * This only gets called for lazy watchers.
  7419. */
  7420. Watcher.prototype.evaluate = function evaluate () {
  7421. this.value = this.get();
  7422. this.dirty = false;
  7423. };
  7424. /**
  7425. * Depend on all deps collected by this watcher.
  7426. */
  7427. Watcher.prototype.depend = function depend () {
  7428. var i = this.deps.length;
  7429. while (i--) {
  7430. this.deps[i].depend();
  7431. }
  7432. };
  7433. /**
  7434. * Remove self from all dependencies' subscriber list.
  7435. */
  7436. Watcher.prototype.teardown = function teardown () {
  7437. if (this.active) {
  7438. // remove self from vm's watcher list
  7439. // this is a somewhat expensive operation so we skip it
  7440. // if the vm is being destroyed.
  7441. if (!this.vm._isBeingDestroyed) {
  7442. remove(this.vm._watchers, this);
  7443. }
  7444. var i = this.deps.length;
  7445. while (i--) {
  7446. this.deps[i].removeSub(this);
  7447. }
  7448. this.active = false;
  7449. }
  7450. };
  7451. /* */
  7452. var sharedPropertyDefinition = {
  7453. enumerable: true,
  7454. configurable: true,
  7455. get: noop,
  7456. set: noop
  7457. };
  7458. function proxy (target, sourceKey, key) {
  7459. sharedPropertyDefinition.get = function proxyGetter () {
  7460. return this[sourceKey][key]
  7461. };
  7462. sharedPropertyDefinition.set = function proxySetter (val) {
  7463. this[sourceKey][key] = val;
  7464. };
  7465. Object.defineProperty(target, key, sharedPropertyDefinition);
  7466. }
  7467. function initState (vm) {
  7468. vm._watchers = [];
  7469. var opts = vm.$options;
  7470. if (opts.props) { initProps(vm, opts.props); }
  7471. if (opts.methods) { initMethods(vm, opts.methods); }
  7472. if (opts.data) {
  7473. initData(vm);
  7474. } else {
  7475. observe(vm._data = {}, true /* asRootData */);
  7476. }
  7477. if (opts.computed) { initComputed(vm, opts.computed); }
  7478. if (opts.watch && opts.watch !== nativeWatch) {
  7479. initWatch(vm, opts.watch);
  7480. }
  7481. }
  7482. function initProps (vm, propsOptions) {
  7483. var propsData = vm.$options.propsData || {};
  7484. var props = vm._props = {};
  7485. // cache prop keys so that future props updates can iterate using Array
  7486. // instead of dynamic object key enumeration.
  7487. var keys = vm.$options._propKeys = [];
  7488. var isRoot = !vm.$parent;
  7489. // root instance props should be converted
  7490. if (!isRoot) {
  7491. toggleObserving(false);
  7492. }
  7493. var loop = function ( key ) {
  7494. keys.push(key);
  7495. var value = validateProp(key, propsOptions, propsData, vm);
  7496. /* istanbul ignore else */
  7497. if (true) {
  7498. var hyphenatedKey = hyphenate(key);
  7499. if (isReservedAttribute(hyphenatedKey) ||
  7500. config.isReservedAttr(hyphenatedKey)) {
  7501. warn(
  7502. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  7503. vm
  7504. );
  7505. }
  7506. defineReactive$$1(props, key, value, function () {
  7507. if (!isRoot && !isUpdatingChildComponent) {
  7508. {
  7509. if(vm.mpHost === 'mp-baidu' || vm.mpHost === 'mp-kuaishou' || vm.mpHost === 'mp-xhs'){//百度、快手、小红书 observer 在 setData callback 之后触发,直接忽略该 warn
  7510. return
  7511. }
  7512. //fixed by xxxxxx __next_tick_pending,uni://form-field 时不告警
  7513. if(
  7514. key === 'value' &&
  7515. Array.isArray(vm.$options.behaviors) &&
  7516. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  7517. ){
  7518. return
  7519. }
  7520. if(vm._getFormData){
  7521. return
  7522. }
  7523. var $parent = vm.$parent;
  7524. while($parent){
  7525. if($parent.__next_tick_pending){
  7526. return
  7527. }
  7528. $parent = $parent.$parent;
  7529. }
  7530. }
  7531. warn(
  7532. "Avoid mutating a prop directly since the value will be " +
  7533. "overwritten whenever the parent component re-renders. " +
  7534. "Instead, use a data or computed property based on the prop's " +
  7535. "value. Prop being mutated: \"" + key + "\"",
  7536. vm
  7537. );
  7538. }
  7539. });
  7540. } else {}
  7541. // static props are already proxied on the component's prototype
  7542. // during Vue.extend(). We only need to proxy props defined at
  7543. // instantiation here.
  7544. if (!(key in vm)) {
  7545. proxy(vm, "_props", key);
  7546. }
  7547. };
  7548. for (var key in propsOptions) loop( key );
  7549. toggleObserving(true);
  7550. }
  7551. function initData (vm) {
  7552. var data = vm.$options.data;
  7553. data = vm._data = typeof data === 'function'
  7554. ? getData(data, vm)
  7555. : data || {};
  7556. if (!isPlainObject(data)) {
  7557. data = {};
  7558. true && warn(
  7559. 'data functions should return an object:\n' +
  7560. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  7561. vm
  7562. );
  7563. }
  7564. // proxy data on instance
  7565. var keys = Object.keys(data);
  7566. var props = vm.$options.props;
  7567. var methods = vm.$options.methods;
  7568. var i = keys.length;
  7569. while (i--) {
  7570. var key = keys[i];
  7571. if (true) {
  7572. if (methods && hasOwn(methods, key)) {
  7573. warn(
  7574. ("Method \"" + key + "\" has already been defined as a data property."),
  7575. vm
  7576. );
  7577. }
  7578. }
  7579. if (props && hasOwn(props, key)) {
  7580. true && warn(
  7581. "The data property \"" + key + "\" is already declared as a prop. " +
  7582. "Use prop default value instead.",
  7583. vm
  7584. );
  7585. } else if (!isReserved(key)) {
  7586. proxy(vm, "_data", key);
  7587. }
  7588. }
  7589. // observe data
  7590. observe(data, true /* asRootData */);
  7591. }
  7592. function getData (data, vm) {
  7593. // #7573 disable dep collection when invoking data getters
  7594. pushTarget();
  7595. try {
  7596. return data.call(vm, vm)
  7597. } catch (e) {
  7598. handleError(e, vm, "data()");
  7599. return {}
  7600. } finally {
  7601. popTarget();
  7602. }
  7603. }
  7604. var computedWatcherOptions = { lazy: true };
  7605. function initComputed (vm, computed) {
  7606. // $flow-disable-line
  7607. var watchers = vm._computedWatchers = Object.create(null);
  7608. // computed properties are just getters during SSR
  7609. var isSSR = isServerRendering();
  7610. for (var key in computed) {
  7611. var userDef = computed[key];
  7612. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  7613. if ( true && getter == null) {
  7614. warn(
  7615. ("Getter is missing for computed property \"" + key + "\"."),
  7616. vm
  7617. );
  7618. }
  7619. if (!isSSR) {
  7620. // create internal watcher for the computed property.
  7621. watchers[key] = new Watcher(
  7622. vm,
  7623. getter || noop,
  7624. noop,
  7625. computedWatcherOptions
  7626. );
  7627. }
  7628. // component-defined computed properties are already defined on the
  7629. // component prototype. We only need to define computed properties defined
  7630. // at instantiation here.
  7631. if (!(key in vm)) {
  7632. defineComputed(vm, key, userDef);
  7633. } else if (true) {
  7634. if (key in vm.$data) {
  7635. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  7636. } else if (vm.$options.props && key in vm.$options.props) {
  7637. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  7638. }
  7639. }
  7640. }
  7641. }
  7642. function defineComputed (
  7643. target,
  7644. key,
  7645. userDef
  7646. ) {
  7647. var shouldCache = !isServerRendering();
  7648. if (typeof userDef === 'function') {
  7649. sharedPropertyDefinition.get = shouldCache
  7650. ? createComputedGetter(key)
  7651. : createGetterInvoker(userDef);
  7652. sharedPropertyDefinition.set = noop;
  7653. } else {
  7654. sharedPropertyDefinition.get = userDef.get
  7655. ? shouldCache && userDef.cache !== false
  7656. ? createComputedGetter(key)
  7657. : createGetterInvoker(userDef.get)
  7658. : noop;
  7659. sharedPropertyDefinition.set = userDef.set || noop;
  7660. }
  7661. if ( true &&
  7662. sharedPropertyDefinition.set === noop) {
  7663. sharedPropertyDefinition.set = function () {
  7664. warn(
  7665. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  7666. this
  7667. );
  7668. };
  7669. }
  7670. Object.defineProperty(target, key, sharedPropertyDefinition);
  7671. }
  7672. function createComputedGetter (key) {
  7673. return function computedGetter () {
  7674. var watcher = this._computedWatchers && this._computedWatchers[key];
  7675. if (watcher) {
  7676. if (watcher.dirty) {
  7677. watcher.evaluate();
  7678. }
  7679. if (Dep.SharedObject.target) {// fixed by xxxxxx
  7680. watcher.depend();
  7681. }
  7682. return watcher.value
  7683. }
  7684. }
  7685. }
  7686. function createGetterInvoker(fn) {
  7687. return function computedGetter () {
  7688. return fn.call(this, this)
  7689. }
  7690. }
  7691. function initMethods (vm, methods) {
  7692. var props = vm.$options.props;
  7693. for (var key in methods) {
  7694. if (true) {
  7695. if (typeof methods[key] !== 'function') {
  7696. warn(
  7697. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  7698. "Did you reference the function correctly?",
  7699. vm
  7700. );
  7701. }
  7702. if (props && hasOwn(props, key)) {
  7703. warn(
  7704. ("Method \"" + key + "\" has already been defined as a prop."),
  7705. vm
  7706. );
  7707. }
  7708. if ((key in vm) && isReserved(key)) {
  7709. warn(
  7710. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  7711. "Avoid defining component methods that start with _ or $."
  7712. );
  7713. }
  7714. }
  7715. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  7716. }
  7717. }
  7718. function initWatch (vm, watch) {
  7719. for (var key in watch) {
  7720. var handler = watch[key];
  7721. if (Array.isArray(handler)) {
  7722. for (var i = 0; i < handler.length; i++) {
  7723. createWatcher(vm, key, handler[i]);
  7724. }
  7725. } else {
  7726. createWatcher(vm, key, handler);
  7727. }
  7728. }
  7729. }
  7730. function createWatcher (
  7731. vm,
  7732. expOrFn,
  7733. handler,
  7734. options
  7735. ) {
  7736. if (isPlainObject(handler)) {
  7737. options = handler;
  7738. handler = handler.handler;
  7739. }
  7740. if (typeof handler === 'string') {
  7741. handler = vm[handler];
  7742. }
  7743. return vm.$watch(expOrFn, handler, options)
  7744. }
  7745. function stateMixin (Vue) {
  7746. // flow somehow has problems with directly declared definition object
  7747. // when using Object.defineProperty, so we have to procedurally build up
  7748. // the object here.
  7749. var dataDef = {};
  7750. dataDef.get = function () { return this._data };
  7751. var propsDef = {};
  7752. propsDef.get = function () { return this._props };
  7753. if (true) {
  7754. dataDef.set = function () {
  7755. warn(
  7756. 'Avoid replacing instance root $data. ' +
  7757. 'Use nested data properties instead.',
  7758. this
  7759. );
  7760. };
  7761. propsDef.set = function () {
  7762. warn("$props is readonly.", this);
  7763. };
  7764. }
  7765. Object.defineProperty(Vue.prototype, '$data', dataDef);
  7766. Object.defineProperty(Vue.prototype, '$props', propsDef);
  7767. Vue.prototype.$set = set;
  7768. Vue.prototype.$delete = del;
  7769. Vue.prototype.$watch = function (
  7770. expOrFn,
  7771. cb,
  7772. options
  7773. ) {
  7774. var vm = this;
  7775. if (isPlainObject(cb)) {
  7776. return createWatcher(vm, expOrFn, cb, options)
  7777. }
  7778. options = options || {};
  7779. options.user = true;
  7780. var watcher = new Watcher(vm, expOrFn, cb, options);
  7781. if (options.immediate) {
  7782. try {
  7783. cb.call(vm, watcher.value);
  7784. } catch (error) {
  7785. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  7786. }
  7787. }
  7788. return function unwatchFn () {
  7789. watcher.teardown();
  7790. }
  7791. };
  7792. }
  7793. /* */
  7794. var uid$3 = 0;
  7795. function initMixin (Vue) {
  7796. Vue.prototype._init = function (options) {
  7797. var vm = this;
  7798. // a uid
  7799. vm._uid = uid$3++;
  7800. var startTag, endTag;
  7801. /* istanbul ignore if */
  7802. if ( true && config.performance && mark) {
  7803. startTag = "vue-perf-start:" + (vm._uid);
  7804. endTag = "vue-perf-end:" + (vm._uid);
  7805. mark(startTag);
  7806. }
  7807. // a flag to avoid this being observed
  7808. vm._isVue = true;
  7809. // merge options
  7810. if (options && options._isComponent) {
  7811. // optimize internal component instantiation
  7812. // since dynamic options merging is pretty slow, and none of the
  7813. // internal component options needs special treatment.
  7814. initInternalComponent(vm, options);
  7815. } else {
  7816. vm.$options = mergeOptions(
  7817. resolveConstructorOptions(vm.constructor),
  7818. options || {},
  7819. vm
  7820. );
  7821. }
  7822. /* istanbul ignore else */
  7823. if (true) {
  7824. initProxy(vm);
  7825. } else {}
  7826. // expose real self
  7827. vm._self = vm;
  7828. initLifecycle(vm);
  7829. initEvents(vm);
  7830. initRender(vm);
  7831. callHook(vm, 'beforeCreate');
  7832. !vm._$fallback && initInjections(vm); // resolve injections before data/props
  7833. initState(vm);
  7834. !vm._$fallback && initProvide(vm); // resolve provide after data/props
  7835. !vm._$fallback && callHook(vm, 'created');
  7836. /* istanbul ignore if */
  7837. if ( true && config.performance && mark) {
  7838. vm._name = formatComponentName(vm, false);
  7839. mark(endTag);
  7840. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  7841. }
  7842. if (vm.$options.el) {
  7843. vm.$mount(vm.$options.el);
  7844. }
  7845. };
  7846. }
  7847. function initInternalComponent (vm, options) {
  7848. var opts = vm.$options = Object.create(vm.constructor.options);
  7849. // doing this because it's faster than dynamic enumeration.
  7850. var parentVnode = options._parentVnode;
  7851. opts.parent = options.parent;
  7852. opts._parentVnode = parentVnode;
  7853. var vnodeComponentOptions = parentVnode.componentOptions;
  7854. opts.propsData = vnodeComponentOptions.propsData;
  7855. opts._parentListeners = vnodeComponentOptions.listeners;
  7856. opts._renderChildren = vnodeComponentOptions.children;
  7857. opts._componentTag = vnodeComponentOptions.tag;
  7858. if (options.render) {
  7859. opts.render = options.render;
  7860. opts.staticRenderFns = options.staticRenderFns;
  7861. }
  7862. }
  7863. function resolveConstructorOptions (Ctor) {
  7864. var options = Ctor.options;
  7865. if (Ctor.super) {
  7866. var superOptions = resolveConstructorOptions(Ctor.super);
  7867. var cachedSuperOptions = Ctor.superOptions;
  7868. if (superOptions !== cachedSuperOptions) {
  7869. // super option changed,
  7870. // need to resolve new options.
  7871. Ctor.superOptions = superOptions;
  7872. // check if there are any late-modified/attached options (#4976)
  7873. var modifiedOptions = resolveModifiedOptions(Ctor);
  7874. // update base extend options
  7875. if (modifiedOptions) {
  7876. extend(Ctor.extendOptions, modifiedOptions);
  7877. }
  7878. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  7879. if (options.name) {
  7880. options.components[options.name] = Ctor;
  7881. }
  7882. }
  7883. }
  7884. return options
  7885. }
  7886. function resolveModifiedOptions (Ctor) {
  7887. var modified;
  7888. var latest = Ctor.options;
  7889. var sealed = Ctor.sealedOptions;
  7890. for (var key in latest) {
  7891. if (latest[key] !== sealed[key]) {
  7892. if (!modified) { modified = {}; }
  7893. modified[key] = latest[key];
  7894. }
  7895. }
  7896. return modified
  7897. }
  7898. function Vue (options) {
  7899. if ( true &&
  7900. !(this instanceof Vue)
  7901. ) {
  7902. warn('Vue is a constructor and should be called with the `new` keyword');
  7903. }
  7904. this._init(options);
  7905. }
  7906. initMixin(Vue);
  7907. stateMixin(Vue);
  7908. eventsMixin(Vue);
  7909. lifecycleMixin(Vue);
  7910. renderMixin(Vue);
  7911. /* */
  7912. function initUse (Vue) {
  7913. Vue.use = function (plugin) {
  7914. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  7915. if (installedPlugins.indexOf(plugin) > -1) {
  7916. return this
  7917. }
  7918. // additional parameters
  7919. var args = toArray(arguments, 1);
  7920. args.unshift(this);
  7921. if (typeof plugin.install === 'function') {
  7922. plugin.install.apply(plugin, args);
  7923. } else if (typeof plugin === 'function') {
  7924. plugin.apply(null, args);
  7925. }
  7926. installedPlugins.push(plugin);
  7927. return this
  7928. };
  7929. }
  7930. /* */
  7931. function initMixin$1 (Vue) {
  7932. Vue.mixin = function (mixin) {
  7933. this.options = mergeOptions(this.options, mixin);
  7934. return this
  7935. };
  7936. }
  7937. /* */
  7938. function initExtend (Vue) {
  7939. /**
  7940. * Each instance constructor, including Vue, has a unique
  7941. * cid. This enables us to create wrapped "child
  7942. * constructors" for prototypal inheritance and cache them.
  7943. */
  7944. Vue.cid = 0;
  7945. var cid = 1;
  7946. /**
  7947. * Class inheritance
  7948. */
  7949. Vue.extend = function (extendOptions) {
  7950. extendOptions = extendOptions || {};
  7951. var Super = this;
  7952. var SuperId = Super.cid;
  7953. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  7954. if (cachedCtors[SuperId]) {
  7955. return cachedCtors[SuperId]
  7956. }
  7957. var name = extendOptions.name || Super.options.name;
  7958. if ( true && name) {
  7959. validateComponentName(name);
  7960. }
  7961. var Sub = function VueComponent (options) {
  7962. this._init(options);
  7963. };
  7964. Sub.prototype = Object.create(Super.prototype);
  7965. Sub.prototype.constructor = Sub;
  7966. Sub.cid = cid++;
  7967. Sub.options = mergeOptions(
  7968. Super.options,
  7969. extendOptions
  7970. );
  7971. Sub['super'] = Super;
  7972. // For props and computed properties, we define the proxy getters on
  7973. // the Vue instances at extension time, on the extended prototype. This
  7974. // avoids Object.defineProperty calls for each instance created.
  7975. if (Sub.options.props) {
  7976. initProps$1(Sub);
  7977. }
  7978. if (Sub.options.computed) {
  7979. initComputed$1(Sub);
  7980. }
  7981. // allow further extension/mixin/plugin usage
  7982. Sub.extend = Super.extend;
  7983. Sub.mixin = Super.mixin;
  7984. Sub.use = Super.use;
  7985. // create asset registers, so extended classes
  7986. // can have their private assets too.
  7987. ASSET_TYPES.forEach(function (type) {
  7988. Sub[type] = Super[type];
  7989. });
  7990. // enable recursive self-lookup
  7991. if (name) {
  7992. Sub.options.components[name] = Sub;
  7993. }
  7994. // keep a reference to the super options at extension time.
  7995. // later at instantiation we can check if Super's options have
  7996. // been updated.
  7997. Sub.superOptions = Super.options;
  7998. Sub.extendOptions = extendOptions;
  7999. Sub.sealedOptions = extend({}, Sub.options);
  8000. // cache constructor
  8001. cachedCtors[SuperId] = Sub;
  8002. return Sub
  8003. };
  8004. }
  8005. function initProps$1 (Comp) {
  8006. var props = Comp.options.props;
  8007. for (var key in props) {
  8008. proxy(Comp.prototype, "_props", key);
  8009. }
  8010. }
  8011. function initComputed$1 (Comp) {
  8012. var computed = Comp.options.computed;
  8013. for (var key in computed) {
  8014. defineComputed(Comp.prototype, key, computed[key]);
  8015. }
  8016. }
  8017. /* */
  8018. function initAssetRegisters (Vue) {
  8019. /**
  8020. * Create asset registration methods.
  8021. */
  8022. ASSET_TYPES.forEach(function (type) {
  8023. Vue[type] = function (
  8024. id,
  8025. definition
  8026. ) {
  8027. if (!definition) {
  8028. return this.options[type + 's'][id]
  8029. } else {
  8030. /* istanbul ignore if */
  8031. if ( true && type === 'component') {
  8032. validateComponentName(id);
  8033. }
  8034. if (type === 'component' && isPlainObject(definition)) {
  8035. definition.name = definition.name || id;
  8036. definition = this.options._base.extend(definition);
  8037. }
  8038. if (type === 'directive' && typeof definition === 'function') {
  8039. definition = { bind: definition, update: definition };
  8040. }
  8041. this.options[type + 's'][id] = definition;
  8042. return definition
  8043. }
  8044. };
  8045. });
  8046. }
  8047. /* */
  8048. function getComponentName (opts) {
  8049. return opts && (opts.Ctor.options.name || opts.tag)
  8050. }
  8051. function matches (pattern, name) {
  8052. if (Array.isArray(pattern)) {
  8053. return pattern.indexOf(name) > -1
  8054. } else if (typeof pattern === 'string') {
  8055. return pattern.split(',').indexOf(name) > -1
  8056. } else if (isRegExp(pattern)) {
  8057. return pattern.test(name)
  8058. }
  8059. /* istanbul ignore next */
  8060. return false
  8061. }
  8062. function pruneCache (keepAliveInstance, filter) {
  8063. var cache = keepAliveInstance.cache;
  8064. var keys = keepAliveInstance.keys;
  8065. var _vnode = keepAliveInstance._vnode;
  8066. for (var key in cache) {
  8067. var cachedNode = cache[key];
  8068. if (cachedNode) {
  8069. var name = getComponentName(cachedNode.componentOptions);
  8070. if (name && !filter(name)) {
  8071. pruneCacheEntry(cache, key, keys, _vnode);
  8072. }
  8073. }
  8074. }
  8075. }
  8076. function pruneCacheEntry (
  8077. cache,
  8078. key,
  8079. keys,
  8080. current
  8081. ) {
  8082. var cached$$1 = cache[key];
  8083. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  8084. cached$$1.componentInstance.$destroy();
  8085. }
  8086. cache[key] = null;
  8087. remove(keys, key);
  8088. }
  8089. var patternTypes = [String, RegExp, Array];
  8090. var KeepAlive = {
  8091. name: 'keep-alive',
  8092. abstract: true,
  8093. props: {
  8094. include: patternTypes,
  8095. exclude: patternTypes,
  8096. max: [String, Number]
  8097. },
  8098. created: function created () {
  8099. this.cache = Object.create(null);
  8100. this.keys = [];
  8101. },
  8102. destroyed: function destroyed () {
  8103. for (var key in this.cache) {
  8104. pruneCacheEntry(this.cache, key, this.keys);
  8105. }
  8106. },
  8107. mounted: function mounted () {
  8108. var this$1 = this;
  8109. this.$watch('include', function (val) {
  8110. pruneCache(this$1, function (name) { return matches(val, name); });
  8111. });
  8112. this.$watch('exclude', function (val) {
  8113. pruneCache(this$1, function (name) { return !matches(val, name); });
  8114. });
  8115. },
  8116. render: function render () {
  8117. var slot = this.$slots.default;
  8118. var vnode = getFirstComponentChild(slot);
  8119. var componentOptions = vnode && vnode.componentOptions;
  8120. if (componentOptions) {
  8121. // check pattern
  8122. var name = getComponentName(componentOptions);
  8123. var ref = this;
  8124. var include = ref.include;
  8125. var exclude = ref.exclude;
  8126. if (
  8127. // not included
  8128. (include && (!name || !matches(include, name))) ||
  8129. // excluded
  8130. (exclude && name && matches(exclude, name))
  8131. ) {
  8132. return vnode
  8133. }
  8134. var ref$1 = this;
  8135. var cache = ref$1.cache;
  8136. var keys = ref$1.keys;
  8137. var key = vnode.key == null
  8138. // same constructor may get registered as different local components
  8139. // so cid alone is not enough (#3269)
  8140. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  8141. : vnode.key;
  8142. if (cache[key]) {
  8143. vnode.componentInstance = cache[key].componentInstance;
  8144. // make current key freshest
  8145. remove(keys, key);
  8146. keys.push(key);
  8147. } else {
  8148. cache[key] = vnode;
  8149. keys.push(key);
  8150. // prune oldest entry
  8151. if (this.max && keys.length > parseInt(this.max)) {
  8152. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  8153. }
  8154. }
  8155. vnode.data.keepAlive = true;
  8156. }
  8157. return vnode || (slot && slot[0])
  8158. }
  8159. };
  8160. var builtInComponents = {
  8161. KeepAlive: KeepAlive
  8162. };
  8163. /* */
  8164. function initGlobalAPI (Vue) {
  8165. // config
  8166. var configDef = {};
  8167. configDef.get = function () { return config; };
  8168. if (true) {
  8169. configDef.set = function () {
  8170. warn(
  8171. 'Do not replace the Vue.config object, set individual fields instead.'
  8172. );
  8173. };
  8174. }
  8175. Object.defineProperty(Vue, 'config', configDef);
  8176. // exposed util methods.
  8177. // NOTE: these are not considered part of the public API - avoid relying on
  8178. // them unless you are aware of the risk.
  8179. Vue.util = {
  8180. warn: warn,
  8181. extend: extend,
  8182. mergeOptions: mergeOptions,
  8183. defineReactive: defineReactive$$1
  8184. };
  8185. Vue.set = set;
  8186. Vue.delete = del;
  8187. Vue.nextTick = nextTick;
  8188. // 2.6 explicit observable API
  8189. Vue.observable = function (obj) {
  8190. observe(obj);
  8191. return obj
  8192. };
  8193. Vue.options = Object.create(null);
  8194. ASSET_TYPES.forEach(function (type) {
  8195. Vue.options[type + 's'] = Object.create(null);
  8196. });
  8197. // this is used to identify the "base" constructor to extend all plain-object
  8198. // components with in Weex's multi-instance scenarios.
  8199. Vue.options._base = Vue;
  8200. extend(Vue.options.components, builtInComponents);
  8201. initUse(Vue);
  8202. initMixin$1(Vue);
  8203. initExtend(Vue);
  8204. initAssetRegisters(Vue);
  8205. }
  8206. initGlobalAPI(Vue);
  8207. Object.defineProperty(Vue.prototype, '$isServer', {
  8208. get: isServerRendering
  8209. });
  8210. Object.defineProperty(Vue.prototype, '$ssrContext', {
  8211. get: function get () {
  8212. /* istanbul ignore next */
  8213. return this.$vnode && this.$vnode.ssrContext
  8214. }
  8215. });
  8216. // expose FunctionalRenderContext for ssr runtime helper installation
  8217. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  8218. value: FunctionalRenderContext
  8219. });
  8220. Vue.version = '2.6.11';
  8221. /**
  8222. * https://raw.githubusercontent.com/Tencent/westore/master/packages/westore/utils/diff.js
  8223. */
  8224. var ARRAYTYPE = '[object Array]';
  8225. var OBJECTTYPE = '[object Object]';
  8226. var NULLTYPE = '[object Null]';
  8227. var UNDEFINEDTYPE = '[object Undefined]';
  8228. // const FUNCTIONTYPE = '[object Function]'
  8229. function diff(current, pre) {
  8230. var result = {};
  8231. syncKeys(current, pre);
  8232. _diff(current, pre, '', result);
  8233. return result
  8234. }
  8235. function syncKeys(current, pre) {
  8236. if (current === pre) { return }
  8237. var rootCurrentType = type(current);
  8238. var rootPreType = type(pre);
  8239. if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
  8240. if(Object.keys(current).length >= Object.keys(pre).length){
  8241. for (var key in pre) {
  8242. var currentValue = current[key];
  8243. if (currentValue === undefined) {
  8244. current[key] = null;
  8245. } else {
  8246. syncKeys(currentValue, pre[key]);
  8247. }
  8248. }
  8249. }
  8250. } else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
  8251. if (current.length >= pre.length) {
  8252. pre.forEach(function (item, index) {
  8253. syncKeys(current[index], item);
  8254. });
  8255. }
  8256. }
  8257. }
  8258. function nullOrUndefined(currentType, preType) {
  8259. if(
  8260. (currentType === NULLTYPE || currentType === UNDEFINEDTYPE) &&
  8261. (preType === NULLTYPE || preType === UNDEFINEDTYPE)
  8262. ) {
  8263. return false
  8264. }
  8265. return true
  8266. }
  8267. function _diff(current, pre, path, result) {
  8268. if (current === pre) { return }
  8269. var rootCurrentType = type(current);
  8270. var rootPreType = type(pre);
  8271. if (rootCurrentType == OBJECTTYPE) {
  8272. if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
  8273. setResult(result, path, current);
  8274. } else {
  8275. var loop = function ( key ) {
  8276. var currentValue = current[key];
  8277. var preValue = pre[key];
  8278. var currentType = type(currentValue);
  8279. var preType = type(preValue);
  8280. if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
  8281. if (currentValue !== pre[key] && nullOrUndefined(currentType, preType)) {
  8282. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  8283. }
  8284. } else if (currentType == ARRAYTYPE) {
  8285. if (preType != ARRAYTYPE) {
  8286. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  8287. } else {
  8288. if (currentValue.length < preValue.length) {
  8289. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  8290. } else {
  8291. currentValue.forEach(function (item, index) {
  8292. _diff(item, preValue[index], (path == '' ? '' : path + ".") + key + '[' + index + ']', result);
  8293. });
  8294. }
  8295. }
  8296. } else if (currentType == OBJECTTYPE) {
  8297. if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
  8298. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  8299. } else {
  8300. for (var subKey in currentValue) {
  8301. _diff(currentValue[subKey], preValue[subKey], (path == '' ? '' : path + ".") + key + '.' + subKey, result);
  8302. }
  8303. }
  8304. }
  8305. };
  8306. for (var key in current) loop( key );
  8307. }
  8308. } else if (rootCurrentType == ARRAYTYPE) {
  8309. if (rootPreType != ARRAYTYPE) {
  8310. setResult(result, path, current);
  8311. } else {
  8312. if (current.length < pre.length) {
  8313. setResult(result, path, current);
  8314. } else {
  8315. current.forEach(function (item, index) {
  8316. _diff(item, pre[index], path + '[' + index + ']', result);
  8317. });
  8318. }
  8319. }
  8320. } else {
  8321. setResult(result, path, current);
  8322. }
  8323. }
  8324. function setResult(result, k, v) {
  8325. // if (type(v) != FUNCTIONTYPE) {
  8326. result[k] = v;
  8327. // }
  8328. }
  8329. function type(obj) {
  8330. return Object.prototype.toString.call(obj)
  8331. }
  8332. /* */
  8333. function flushCallbacks$1(vm) {
  8334. if (vm.__next_tick_callbacks && vm.__next_tick_callbacks.length) {
  8335. if (Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"jje_staff_uniapp","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  8336. var mpInstance = vm.$scope;
  8337. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  8338. ']:flushCallbacks[' + vm.__next_tick_callbacks.length + ']');
  8339. }
  8340. var copies = vm.__next_tick_callbacks.slice(0);
  8341. vm.__next_tick_callbacks.length = 0;
  8342. for (var i = 0; i < copies.length; i++) {
  8343. copies[i]();
  8344. }
  8345. }
  8346. }
  8347. function hasRenderWatcher(vm) {
  8348. return queue.find(function (watcher) { return vm._watcher === watcher; })
  8349. }
  8350. function nextTick$1(vm, cb) {
  8351. //1.nextTick 之前 已 setData 且 setData 还未回调完成
  8352. //2.nextTick 之前存在 render watcher
  8353. if (!vm.__next_tick_pending && !hasRenderWatcher(vm)) {
  8354. if(Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"jje_staff_uniapp","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG){
  8355. var mpInstance = vm.$scope;
  8356. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  8357. ']:nextVueTick');
  8358. }
  8359. return nextTick(cb, vm)
  8360. }else{
  8361. if(Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"jje_staff_uniapp","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG){
  8362. var mpInstance$1 = vm.$scope;
  8363. console.log('[' + (+new Date) + '][' + (mpInstance$1.is || mpInstance$1.route) + '][' + vm._uid +
  8364. ']:nextMPTick');
  8365. }
  8366. }
  8367. var _resolve;
  8368. if (!vm.__next_tick_callbacks) {
  8369. vm.__next_tick_callbacks = [];
  8370. }
  8371. vm.__next_tick_callbacks.push(function () {
  8372. if (cb) {
  8373. try {
  8374. cb.call(vm);
  8375. } catch (e) {
  8376. handleError(e, vm, 'nextTick');
  8377. }
  8378. } else if (_resolve) {
  8379. _resolve(vm);
  8380. }
  8381. });
  8382. // $flow-disable-line
  8383. if (!cb && typeof Promise !== 'undefined') {
  8384. return new Promise(function (resolve) {
  8385. _resolve = resolve;
  8386. })
  8387. }
  8388. }
  8389. /* */
  8390. function clearInstance(key, value) {
  8391. // 简易去除 Vue 和小程序组件实例
  8392. if (value) {
  8393. if (value._isVue || value.__v_isMPComponent) {
  8394. return {}
  8395. }
  8396. }
  8397. return value
  8398. }
  8399. function cloneWithData(vm) {
  8400. // 确保当前 vm 所有数据被同步
  8401. var ret = Object.create(null);
  8402. var dataKeys = [].concat(
  8403. Object.keys(vm._data || {}),
  8404. Object.keys(vm._computedWatchers || {}));
  8405. dataKeys.reduce(function(ret, key) {
  8406. ret[key] = vm[key];
  8407. return ret
  8408. }, ret);
  8409. // vue-composition-api
  8410. var compositionApiState = vm.__composition_api_state__ || vm.__secret_vfa_state__;
  8411. var rawBindings = compositionApiState && compositionApiState.rawBindings;
  8412. if (rawBindings) {
  8413. Object.keys(rawBindings).forEach(function (key) {
  8414. ret[key] = vm[key];
  8415. });
  8416. }
  8417. //TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
  8418. Object.assign(ret, vm.$mp.data || {});
  8419. if (
  8420. Array.isArray(vm.$options.behaviors) &&
  8421. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  8422. ) { //form-field
  8423. ret['name'] = vm.name;
  8424. ret['value'] = vm.value;
  8425. }
  8426. return JSON.parse(JSON.stringify(ret, clearInstance))
  8427. }
  8428. var patch = function(oldVnode, vnode) {
  8429. var this$1 = this;
  8430. if (vnode === null) { //destroy
  8431. return
  8432. }
  8433. if (this.mpType === 'page' || this.mpType === 'component') {
  8434. var mpInstance = this.$scope;
  8435. var data = Object.create(null);
  8436. try {
  8437. data = cloneWithData(this);
  8438. } catch (err) {
  8439. console.error(err);
  8440. }
  8441. data.__webviewId__ = mpInstance.data.__webviewId__;
  8442. var mpData = Object.create(null);
  8443. Object.keys(data).forEach(function (key) { //仅同步 data 中有的数据
  8444. mpData[key] = mpInstance.data[key];
  8445. });
  8446. var diffData = this.$shouldDiffData === false ? data : diff(data, mpData);
  8447. if (Object.keys(diffData).length) {
  8448. if (Object({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"jje_staff_uniapp","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  8449. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + this._uid +
  8450. ']差量更新',
  8451. JSON.stringify(diffData));
  8452. }
  8453. this.__next_tick_pending = true;
  8454. mpInstance.setData(diffData, function () {
  8455. this$1.__next_tick_pending = false;
  8456. flushCallbacks$1(this$1);
  8457. });
  8458. } else {
  8459. flushCallbacks$1(this);
  8460. }
  8461. }
  8462. };
  8463. /* */
  8464. function createEmptyRender() {
  8465. }
  8466. function mountComponent$1(
  8467. vm,
  8468. el,
  8469. hydrating
  8470. ) {
  8471. if (!vm.mpType) {//main.js 中的 new Vue
  8472. return vm
  8473. }
  8474. if (vm.mpType === 'app') {
  8475. vm.$options.render = createEmptyRender;
  8476. }
  8477. if (!vm.$options.render) {
  8478. vm.$options.render = createEmptyRender;
  8479. if (true) {
  8480. /* istanbul ignore if */
  8481. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  8482. vm.$options.el || el) {
  8483. warn(
  8484. 'You are using the runtime-only build of Vue where the template ' +
  8485. 'compiler is not available. Either pre-compile the templates into ' +
  8486. 'render functions, or use the compiler-included build.',
  8487. vm
  8488. );
  8489. } else {
  8490. warn(
  8491. 'Failed to mount component: template or render function not defined.',
  8492. vm
  8493. );
  8494. }
  8495. }
  8496. }
  8497. !vm._$fallback && callHook(vm, 'beforeMount');
  8498. var updateComponent = function () {
  8499. vm._update(vm._render(), hydrating);
  8500. };
  8501. // we set this to vm._watcher inside the watcher's constructor
  8502. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  8503. // component's mounted hook), which relies on vm._watcher being already defined
  8504. new Watcher(vm, updateComponent, noop, {
  8505. before: function before() {
  8506. if (vm._isMounted && !vm._isDestroyed) {
  8507. callHook(vm, 'beforeUpdate');
  8508. }
  8509. }
  8510. }, true /* isRenderWatcher */);
  8511. hydrating = false;
  8512. return vm
  8513. }
  8514. /* */
  8515. function renderClass (
  8516. staticClass,
  8517. dynamicClass
  8518. ) {
  8519. if (isDef(staticClass) || isDef(dynamicClass)) {
  8520. return concat(staticClass, stringifyClass(dynamicClass))
  8521. }
  8522. /* istanbul ignore next */
  8523. return ''
  8524. }
  8525. function concat (a, b) {
  8526. return a ? b ? (a + ' ' + b) : a : (b || '')
  8527. }
  8528. function stringifyClass (value) {
  8529. if (Array.isArray(value)) {
  8530. return stringifyArray(value)
  8531. }
  8532. if (isObject(value)) {
  8533. return stringifyObject(value)
  8534. }
  8535. if (typeof value === 'string') {
  8536. return value
  8537. }
  8538. /* istanbul ignore next */
  8539. return ''
  8540. }
  8541. function stringifyArray (value) {
  8542. var res = '';
  8543. var stringified;
  8544. for (var i = 0, l = value.length; i < l; i++) {
  8545. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  8546. if (res) { res += ' '; }
  8547. res += stringified;
  8548. }
  8549. }
  8550. return res
  8551. }
  8552. function stringifyObject (value) {
  8553. var res = '';
  8554. for (var key in value) {
  8555. if (value[key]) {
  8556. if (res) { res += ' '; }
  8557. res += key;
  8558. }
  8559. }
  8560. return res
  8561. }
  8562. /* */
  8563. var parseStyleText = cached(function (cssText) {
  8564. var res = {};
  8565. var listDelimiter = /;(?![^(]*\))/g;
  8566. var propertyDelimiter = /:(.+)/;
  8567. cssText.split(listDelimiter).forEach(function (item) {
  8568. if (item) {
  8569. var tmp = item.split(propertyDelimiter);
  8570. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  8571. }
  8572. });
  8573. return res
  8574. });
  8575. // normalize possible array / string values into Object
  8576. function normalizeStyleBinding (bindingStyle) {
  8577. if (Array.isArray(bindingStyle)) {
  8578. return toObject(bindingStyle)
  8579. }
  8580. if (typeof bindingStyle === 'string') {
  8581. return parseStyleText(bindingStyle)
  8582. }
  8583. return bindingStyle
  8584. }
  8585. /* */
  8586. var MP_METHODS = ['createSelectorQuery', 'createIntersectionObserver', 'selectAllComponents', 'selectComponent'];
  8587. function getTarget(obj, path) {
  8588. var parts = path.split('.');
  8589. var key = parts[0];
  8590. if (key.indexOf('__$n') === 0) { //number index
  8591. key = parseInt(key.replace('__$n', ''));
  8592. }
  8593. if (parts.length === 1) {
  8594. return obj[key]
  8595. }
  8596. return getTarget(obj[key], parts.slice(1).join('.'))
  8597. }
  8598. function internalMixin(Vue) {
  8599. Vue.config.errorHandler = function(err, vm, info) {
  8600. Vue.util.warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  8601. console.error(err);
  8602. /* eslint-disable no-undef */
  8603. var app = typeof getApp === 'function' && getApp();
  8604. if (app && app.onError) {
  8605. app.onError(err);
  8606. }
  8607. };
  8608. var oldEmit = Vue.prototype.$emit;
  8609. Vue.prototype.$emit = function(event) {
  8610. if (this.$scope && event) {
  8611. var triggerEvent = this.$scope['_triggerEvent'] || this.$scope['triggerEvent'];
  8612. if (triggerEvent) {
  8613. try {
  8614. triggerEvent.call(this.$scope, event, {
  8615. __args__: toArray(arguments, 1)
  8616. });
  8617. } catch (error) {
  8618. }
  8619. }
  8620. }
  8621. return oldEmit.apply(this, arguments)
  8622. };
  8623. Vue.prototype.$nextTick = function(fn) {
  8624. return nextTick$1(this, fn)
  8625. };
  8626. MP_METHODS.forEach(function (method) {
  8627. Vue.prototype[method] = function(args) {
  8628. if (this.$scope && this.$scope[method]) {
  8629. return this.$scope[method](args)
  8630. }
  8631. // mp-alipay
  8632. if (typeof my === 'undefined') {
  8633. return
  8634. }
  8635. if (method === 'createSelectorQuery') {
  8636. /* eslint-disable no-undef */
  8637. return my.createSelectorQuery(args)
  8638. } else if (method === 'createIntersectionObserver') {
  8639. /* eslint-disable no-undef */
  8640. return my.createIntersectionObserver(args)
  8641. }
  8642. // TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
  8643. };
  8644. });
  8645. Vue.prototype.__init_provide = initProvide;
  8646. Vue.prototype.__init_injections = initInjections;
  8647. Vue.prototype.__call_hook = function(hook, args) {
  8648. var vm = this;
  8649. // #7573 disable dep collection when invoking lifecycle hooks
  8650. pushTarget();
  8651. var handlers = vm.$options[hook];
  8652. var info = hook + " hook";
  8653. var ret;
  8654. if (handlers) {
  8655. for (var i = 0, j = handlers.length; i < j; i++) {
  8656. ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
  8657. }
  8658. }
  8659. if (vm._hasHookEvent) {
  8660. vm.$emit('hook:' + hook, args);
  8661. }
  8662. popTarget();
  8663. return ret
  8664. };
  8665. Vue.prototype.__set_model = function(target, key, value, modifiers) {
  8666. if (Array.isArray(modifiers)) {
  8667. if (modifiers.indexOf('trim') !== -1) {
  8668. value = value.trim();
  8669. }
  8670. if (modifiers.indexOf('number') !== -1) {
  8671. value = this._n(value);
  8672. }
  8673. }
  8674. if (!target) {
  8675. target = this;
  8676. }
  8677. // 解决动态属性添加
  8678. Vue.set(target, key, value);
  8679. };
  8680. Vue.prototype.__set_sync = function(target, key, value) {
  8681. if (!target) {
  8682. target = this;
  8683. }
  8684. // 解决动态属性添加
  8685. Vue.set(target, key, value);
  8686. };
  8687. Vue.prototype.__get_orig = function(item) {
  8688. if (isPlainObject(item)) {
  8689. return item['$orig'] || item
  8690. }
  8691. return item
  8692. };
  8693. Vue.prototype.__get_value = function(dataPath, target) {
  8694. return getTarget(target || this, dataPath)
  8695. };
  8696. Vue.prototype.__get_class = function(dynamicClass, staticClass) {
  8697. return renderClass(staticClass, dynamicClass)
  8698. };
  8699. Vue.prototype.__get_style = function(dynamicStyle, staticStyle) {
  8700. if (!dynamicStyle && !staticStyle) {
  8701. return ''
  8702. }
  8703. var dynamicStyleObj = normalizeStyleBinding(dynamicStyle);
  8704. var styleObj = staticStyle ? extend(staticStyle, dynamicStyleObj) : dynamicStyleObj;
  8705. return Object.keys(styleObj).map(function (name) { return ((hyphenate(name)) + ":" + (styleObj[name])); }).join(';')
  8706. };
  8707. Vue.prototype.__map = function(val, iteratee) {
  8708. //TODO 暂不考虑 string
  8709. var ret, i, l, keys, key;
  8710. if (Array.isArray(val)) {
  8711. ret = new Array(val.length);
  8712. for (i = 0, l = val.length; i < l; i++) {
  8713. ret[i] = iteratee(val[i], i);
  8714. }
  8715. return ret
  8716. } else if (isObject(val)) {
  8717. keys = Object.keys(val);
  8718. ret = Object.create(null);
  8719. for (i = 0, l = keys.length; i < l; i++) {
  8720. key = keys[i];
  8721. ret[key] = iteratee(val[key], key, i);
  8722. }
  8723. return ret
  8724. } else if (typeof val === 'number') {
  8725. ret = new Array(val);
  8726. for (i = 0, l = val; i < l; i++) {
  8727. // 第一个参数暂时仍和小程序一致
  8728. ret[i] = iteratee(i, i);
  8729. }
  8730. return ret
  8731. }
  8732. return []
  8733. };
  8734. }
  8735. /* */
  8736. var LIFECYCLE_HOOKS$1 = [
  8737. //App
  8738. 'onLaunch',
  8739. 'onShow',
  8740. 'onHide',
  8741. 'onUniNViewMessage',
  8742. 'onPageNotFound',
  8743. 'onThemeChange',
  8744. 'onError',
  8745. 'onUnhandledRejection',
  8746. //Page
  8747. 'onInit',
  8748. 'onLoad',
  8749. // 'onShow',
  8750. 'onReady',
  8751. // 'onHide',
  8752. 'onUnload',
  8753. 'onPullDownRefresh',
  8754. 'onReachBottom',
  8755. 'onTabItemTap',
  8756. 'onAddToFavorites',
  8757. 'onShareTimeline',
  8758. 'onShareAppMessage',
  8759. 'onResize',
  8760. 'onPageScroll',
  8761. 'onNavigationBarButtonTap',
  8762. 'onBackPress',
  8763. 'onNavigationBarSearchInputChanged',
  8764. 'onNavigationBarSearchInputConfirmed',
  8765. 'onNavigationBarSearchInputClicked',
  8766. 'onUploadDouyinVideo',
  8767. 'onNFCReadMessage',
  8768. //Component
  8769. // 'onReady', // 兼容旧版本,应该移除该事件
  8770. 'onPageShow',
  8771. 'onPageHide',
  8772. 'onPageResize'
  8773. ];
  8774. function lifecycleMixin$1(Vue) {
  8775. //fixed vue-class-component
  8776. var oldExtend = Vue.extend;
  8777. Vue.extend = function(extendOptions) {
  8778. extendOptions = extendOptions || {};
  8779. var methods = extendOptions.methods;
  8780. if (methods) {
  8781. Object.keys(methods).forEach(function (methodName) {
  8782. if (LIFECYCLE_HOOKS$1.indexOf(methodName)!==-1) {
  8783. extendOptions[methodName] = methods[methodName];
  8784. delete methods[methodName];
  8785. }
  8786. });
  8787. }
  8788. return oldExtend.call(this, extendOptions)
  8789. };
  8790. var strategies = Vue.config.optionMergeStrategies;
  8791. var mergeHook = strategies.created;
  8792. LIFECYCLE_HOOKS$1.forEach(function (hook) {
  8793. strategies[hook] = mergeHook;
  8794. });
  8795. Vue.prototype.__lifecycle_hooks__ = LIFECYCLE_HOOKS$1;
  8796. }
  8797. /* */
  8798. // install platform patch function
  8799. Vue.prototype.__patch__ = patch;
  8800. // public mount method
  8801. Vue.prototype.$mount = function(
  8802. el ,
  8803. hydrating
  8804. ) {
  8805. return mountComponent$1(this, el, hydrating)
  8806. };
  8807. lifecycleMixin$1(Vue);
  8808. internalMixin(Vue);
  8809. /* */
  8810. /* harmony default export */ __webpack_exports__["default"] = (Vue);
  8811. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ 5)))
  8812. /***/ }),
  8813. /* 28 */
  8814. /*!**************************************!*\
  8815. !*** D:/jje_staff_uniapp/pages.json ***!
  8816. \**************************************/
  8817. /*! no static exports found */
  8818. /***/ (function(module, exports) {
  8819. /***/ }),
  8820. /* 29 */,
  8821. /* 30 */,
  8822. /* 31 */,
  8823. /* 32 */,
  8824. /* 33 */,
  8825. /* 34 */
  8826. /*!**********************************************************************************************************!*\
  8827. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js ***!
  8828. \**********************************************************************************************************/
  8829. /*! exports provided: default */
  8830. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8831. "use strict";
  8832. __webpack_require__.r(__webpack_exports__);
  8833. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  8834. /* globals __VUE_SSR_CONTEXT__ */
  8835. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  8836. // This module is a runtime utility for cleaner component module output and will
  8837. // be included in the final webpack user bundle.
  8838. function normalizeComponent (
  8839. scriptExports,
  8840. render,
  8841. staticRenderFns,
  8842. functionalTemplate,
  8843. injectStyles,
  8844. scopeId,
  8845. moduleIdentifier, /* server only */
  8846. shadowMode, /* vue-cli only */
  8847. components, // fixed by xxxxxx auto components
  8848. renderjs // fixed by xxxxxx renderjs
  8849. ) {
  8850. // Vue.extend constructor export interop
  8851. var options = typeof scriptExports === 'function'
  8852. ? scriptExports.options
  8853. : scriptExports
  8854. // fixed by xxxxxx auto components
  8855. if (components) {
  8856. if (!options.components) {
  8857. options.components = {}
  8858. }
  8859. var hasOwn = Object.prototype.hasOwnProperty
  8860. for (var name in components) {
  8861. if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {
  8862. options.components[name] = components[name]
  8863. }
  8864. }
  8865. }
  8866. // fixed by xxxxxx renderjs
  8867. if (renderjs) {
  8868. if(typeof renderjs.beforeCreate === 'function'){
  8869. renderjs.beforeCreate = [renderjs.beforeCreate]
  8870. }
  8871. (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {
  8872. this[renderjs.__module] = this
  8873. });
  8874. (options.mixins || (options.mixins = [])).push(renderjs)
  8875. }
  8876. // render functions
  8877. if (render) {
  8878. options.render = render
  8879. options.staticRenderFns = staticRenderFns
  8880. options._compiled = true
  8881. }
  8882. // functional template
  8883. if (functionalTemplate) {
  8884. options.functional = true
  8885. }
  8886. // scopedId
  8887. if (scopeId) {
  8888. options._scopeId = 'data-v-' + scopeId
  8889. }
  8890. var hook
  8891. if (moduleIdentifier) { // server build
  8892. hook = function (context) {
  8893. // 2.3 injection
  8894. context =
  8895. context || // cached call
  8896. (this.$vnode && this.$vnode.ssrContext) || // stateful
  8897. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  8898. // 2.2 with runInNewContext: true
  8899. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  8900. context = __VUE_SSR_CONTEXT__
  8901. }
  8902. // inject component styles
  8903. if (injectStyles) {
  8904. injectStyles.call(this, context)
  8905. }
  8906. // register component module identifier for async chunk inferrence
  8907. if (context && context._registeredComponents) {
  8908. context._registeredComponents.add(moduleIdentifier)
  8909. }
  8910. }
  8911. // used by ssr in case component is cached and beforeCreate
  8912. // never gets called
  8913. options._ssrRegister = hook
  8914. } else if (injectStyles) {
  8915. hook = shadowMode
  8916. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  8917. : injectStyles
  8918. }
  8919. if (hook) {
  8920. if (options.functional) {
  8921. // for template-only hot-reload because in that case the render fn doesn't
  8922. // go through the normalizer
  8923. options._injectStyles = hook
  8924. // register for functioal component in vue file
  8925. var originalRender = options.render
  8926. options.render = function renderWithStyleInjection (h, context) {
  8927. hook.call(context)
  8928. return originalRender(h, context)
  8929. }
  8930. } else {
  8931. // inject component registration as beforeCreate hook
  8932. var existing = options.beforeCreate
  8933. options.beforeCreate = existing
  8934. ? [].concat(existing, hook)
  8935. : [hook]
  8936. }
  8937. }
  8938. return {
  8939. exports: scriptExports,
  8940. options: options
  8941. }
  8942. }
  8943. /***/ }),
  8944. /* 35 */
  8945. /*!****************************************************!*\
  8946. !*** D:/jje_staff_uniapp/uni.promisify.adaptor.js ***!
  8947. \****************************************************/
  8948. /*! no static exports found */
  8949. /***/ (function(module, exports, __webpack_require__) {
  8950. /* WEBPACK VAR INJECTION */(function(uni) {var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ 15);
  8951. uni.addInterceptor({
  8952. returnValue: function returnValue(res) {
  8953. if (!(!!res && (_typeof(res) === "object" || typeof res === "function") && typeof res.then === "function")) {
  8954. return res;
  8955. }
  8956. return new Promise(function (resolve, reject) {
  8957. res.then(function (res) {
  8958. return res[0] ? reject(res[0]) : resolve(res[1]);
  8959. });
  8960. });
  8961. }
  8962. });
  8963. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 4)["default"]))
  8964. /***/ }),
  8965. /* 36 */
  8966. /*!********************************************!*\
  8967. !*** D:/jje_staff_uniapp/common/js/api.js ***!
  8968. \********************************************/
  8969. /*! no static exports found */
  8970. /***/ (function(module, exports, __webpack_require__) {
  8971. "use strict";
  8972. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 6);
  8973. Object.defineProperty(exports, "__esModule", {
  8974. value: true
  8975. });
  8976. exports.default = void 0;
  8977. var _request = _interopRequireDefault(__webpack_require__(/*! ../js/request.js */ 37));
  8978. // 引用网络请求中间件
  8979. var _default = {
  8980. //我的权益卡列表
  8981. orderFinish: function orderFinish(orderId) {
  8982. return (0, _request.default)({
  8983. url: '/order/wechat/order/finish/' + orderId,
  8984. method: 'PUT'
  8985. });
  8986. }
  8987. };
  8988. exports.default = _default;
  8989. /***/ }),
  8990. /* 37 */
  8991. /*!************************************************!*\
  8992. !*** D:/jje_staff_uniapp/common/js/request.js ***!
  8993. \************************************************/
  8994. /*! no static exports found */
  8995. /***/ (function(module, exports, __webpack_require__) {
  8996. "use strict";
  8997. /* WEBPACK VAR INJECTION */(function(uni) {
  8998. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 6);
  8999. Object.defineProperty(exports, "__esModule", {
  9000. value: true
  9001. });
  9002. exports.default = void 0;
  9003. var _env = _interopRequireDefault(__webpack_require__(/*! ../js/env.js */ 38));
  9004. function service() {
  9005. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  9006. options.url = "".concat(_env.default.baseUrl).concat(options.url);
  9007. // 判断本地是否存在token,如果存在则带上请求头
  9008. var access_token = uni.getStorageSync('accessToken');
  9009. var refresh_token = uni.getStorageSync('refresh_token');
  9010. if (options.header && options.header['content-type']) {
  9011. options.header['Authorization'] = 'Bearer ' + access_token;
  9012. } else {
  9013. options.header = {
  9014. 'Authorization': 'Bearer ' + access_token,
  9015. 'content-type': 'application/json'
  9016. };
  9017. }
  9018. // resolved是返回成功数据,rejected返回错误数据
  9019. return new Promise(function (resolved, rejected) {
  9020. options.success = function (res) {
  9021. // 如果请求回来的状态码不是200则执行以下操作
  9022. if (res.data.code !== 200) {
  9023. // 非成功状态码弹窗
  9024. console.log('错误信息:+++', res.data.msg);
  9025. // 这里可以做一些状态码判断以及操作
  9026. if (res.data.code === 401) {
  9027. uni.showToast({
  9028. icon: 'none',
  9029. duration: 3000,
  9030. title: '登录过期,即将跳转登录页'
  9031. });
  9032. setTimeout(function () {
  9033. uni.navigateTo({
  9034. url: '/pages/login/login'
  9035. });
  9036. }, 3000);
  9037. } else {
  9038. uni.showToast({
  9039. icon: 'none',
  9040. duration: 3000,
  9041. title: res.data.msg || '系统繁忙,请重试!'
  9042. });
  9043. }
  9044. // 返回错误信息
  9045. rejected(res);
  9046. } else {
  9047. // 请求回来的状态码为200则返回内容
  9048. resolved(res);
  9049. }
  9050. };
  9051. options.fail = function (err) {
  9052. console.log('错误信息:+++', err);
  9053. // 请求失败弹窗
  9054. uni.showToast({
  9055. icon: 'none',
  9056. duration: 3000,
  9057. title: '服务器连接失败,请检查网络'
  9058. });
  9059. rejected(err);
  9060. };
  9061. uni.request(options);
  9062. });
  9063. }
  9064. var _default = service;
  9065. exports.default = _default;
  9066. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 4)["default"]))
  9067. /***/ }),
  9068. /* 38 */
  9069. /*!********************************************!*\
  9070. !*** D:/jje_staff_uniapp/common/js/env.js ***!
  9071. \********************************************/
  9072. /*! no static exports found */
  9073. /***/ (function(module, exports, __webpack_require__) {
  9074. "use strict";
  9075. Object.defineProperty(exports, "__esModule", {
  9076. value: true
  9077. });
  9078. exports.default = void 0;
  9079. var baseUrl = "https://jje.admin.xinyuekj.com.cn";
  9080. // let baseUrl = `https://jje.admin.xinyuekj.com.cn/test-api`
  9081. // let baseUrl = `http://65i1sxopd9qp.ngrok.xiaomiqiu123.top`
  9082. // 变量可自行添加修改
  9083. var _default = {
  9084. //存放变量的容器
  9085. appid: '__UNI__1EEA945',
  9086. baseUrl: baseUrl,
  9087. uploadUrl: '/v1/file/put-file'
  9088. };
  9089. exports.default = _default;
  9090. /***/ })
  9091. ]]);
  9092. //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map