vendor.js 260 KB

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