足力健前端,vue版本

service.runtime.esm.dev.js 190KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377
  1. export default function vueFactory (exports, SharedObject) {
  2. /* */
  3. var emptyObject = Object.freeze({});
  4. // These helpers produce better VM code in JS engines due to their
  5. // explicitness and function inlining.
  6. function isUndef (v) {
  7. return v === undefined || v === null
  8. }
  9. function isDef (v) {
  10. return v !== undefined && v !== null
  11. }
  12. function isTrue (v) {
  13. return v === true
  14. }
  15. function isFalse (v) {
  16. return v === false
  17. }
  18. /**
  19. * Check if value is primitive.
  20. */
  21. function isPrimitive (value) {
  22. return (
  23. typeof value === 'string' ||
  24. typeof value === 'number' ||
  25. // $flow-disable-line
  26. typeof value === 'symbol' ||
  27. typeof value === 'boolean'
  28. )
  29. }
  30. /**
  31. * Quick object check - this is primarily used to tell
  32. * Objects from primitive values when we know the value
  33. * is a JSON-compliant type.
  34. */
  35. function isObject (obj) {
  36. return obj !== null && typeof obj === 'object'
  37. }
  38. /**
  39. * Get the raw type string of a value, e.g., [object Object].
  40. */
  41. var _toString = Object.prototype.toString;
  42. function toRawType (value) {
  43. return _toString.call(value).slice(8, -1)
  44. }
  45. /**
  46. * Strict object type check. Only returns true
  47. * for plain JavaScript objects.
  48. */
  49. function isPlainObject (obj) {
  50. return _toString.call(obj) === '[object Object]'
  51. }
  52. function isRegExp (v) {
  53. return _toString.call(v) === '[object RegExp]'
  54. }
  55. /**
  56. * Check if val is a valid array index.
  57. */
  58. function isValidArrayIndex (val) {
  59. var n = parseFloat(String(val));
  60. return n >= 0 && Math.floor(n) === n && isFinite(val)
  61. }
  62. function isPromise (val) {
  63. return (
  64. isDef(val) &&
  65. typeof val.then === 'function' &&
  66. typeof val.catch === 'function'
  67. )
  68. }
  69. /**
  70. * Convert a value to a string that is actually rendered.
  71. */
  72. function toString (val) {
  73. return val == null
  74. ? ''
  75. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  76. ? JSON.stringify(val, null, 2)
  77. : String(val)
  78. }
  79. /**
  80. * Convert an input value to a number for persistence.
  81. * If the conversion fails, return original string.
  82. */
  83. function toNumber (val) {
  84. var n = parseFloat(val);
  85. return isNaN(n) ? val : n
  86. }
  87. /**
  88. * Make a map and return a function for checking if a key
  89. * is in that map.
  90. */
  91. function makeMap (
  92. str,
  93. expectsLowerCase
  94. ) {
  95. var map = Object.create(null);
  96. var list = str.split(',');
  97. for (var i = 0; i < list.length; i++) {
  98. map[list[i]] = true;
  99. }
  100. return expectsLowerCase
  101. ? function (val) { return map[val.toLowerCase()]; }
  102. : function (val) { return map[val]; }
  103. }
  104. /**
  105. * Check if a tag is a built-in tag.
  106. */
  107. var isBuiltInTag = makeMap('slot,component', true);
  108. /**
  109. * Check if an attribute is a reserved attribute.
  110. */
  111. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  112. /**
  113. * Remove an item from an array.
  114. */
  115. function remove (arr, item) {
  116. if (arr.length) {
  117. var index = arr.indexOf(item);
  118. if (index > -1) {
  119. return arr.splice(index, 1)
  120. }
  121. }
  122. }
  123. /**
  124. * Check whether an object has the property.
  125. */
  126. var hasOwnProperty = Object.prototype.hasOwnProperty;
  127. function hasOwn (obj, key) {
  128. return hasOwnProperty.call(obj, key)
  129. }
  130. /**
  131. * Create a cached version of a pure function.
  132. */
  133. function cached (fn) {
  134. var cache = Object.create(null);
  135. return (function cachedFn (str) {
  136. var hit = cache[str];
  137. return hit || (cache[str] = fn(str))
  138. })
  139. }
  140. /**
  141. * Camelize a hyphen-delimited string.
  142. */
  143. var camelizeRE = /-(\w)/g;
  144. var camelize = cached(function (str) {
  145. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  146. });
  147. /**
  148. * Capitalize a string.
  149. */
  150. var capitalize = cached(function (str) {
  151. return str.charAt(0).toUpperCase() + str.slice(1)
  152. });
  153. /**
  154. * Hyphenate a camelCase string.
  155. */
  156. var hyphenateRE = /\B([A-Z])/g;
  157. var hyphenate = cached(function (str) {
  158. return str.replace(hyphenateRE, '-$1').toLowerCase()
  159. });
  160. /**
  161. * Simple bind polyfill for environments that do not support it,
  162. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  163. * since native bind is now performant enough in most browsers.
  164. * But removing it would mean breaking code that was able to run in
  165. * PhantomJS 1.x, so this must be kept for backward compatibility.
  166. */
  167. /* istanbul ignore next */
  168. function polyfillBind (fn, ctx) {
  169. function boundFn (a) {
  170. var l = arguments.length;
  171. return l
  172. ? l > 1
  173. ? fn.apply(ctx, arguments)
  174. : fn.call(ctx, a)
  175. : fn.call(ctx)
  176. }
  177. boundFn._length = fn.length;
  178. return boundFn
  179. }
  180. function nativeBind (fn, ctx) {
  181. return fn.bind(ctx)
  182. }
  183. var bind = Function.prototype.bind
  184. ? nativeBind
  185. : polyfillBind;
  186. /**
  187. * Convert an Array-like object to a real Array.
  188. */
  189. function toArray (list, start) {
  190. start = start || 0;
  191. var i = list.length - start;
  192. var ret = new Array(i);
  193. while (i--) {
  194. ret[i] = list[i + start];
  195. }
  196. return ret
  197. }
  198. /**
  199. * Mix properties into target object.
  200. */
  201. function extend (to, _from) {
  202. for (var key in _from) {
  203. to[key] = _from[key];
  204. }
  205. return to
  206. }
  207. /**
  208. * Merge an Array of Objects into a single Object.
  209. */
  210. function toObject (arr) {
  211. var res = {};
  212. for (var i = 0; i < arr.length; i++) {
  213. if (arr[i]) {
  214. extend(res, arr[i]);
  215. }
  216. }
  217. return res
  218. }
  219. /* eslint-disable no-unused-vars */
  220. /**
  221. * Perform no operation.
  222. * Stubbing args to make Flow happy without leaving useless transpiled code
  223. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  224. */
  225. function noop (a, b, c) {}
  226. /**
  227. * Always return false.
  228. */
  229. var no = function (a, b, c) { return false; };
  230. /* eslint-enable no-unused-vars */
  231. /**
  232. * Return the same value.
  233. */
  234. var identity = function (_) { return _; };
  235. /**
  236. * Check if two values are loosely equal - that is,
  237. * if they are plain objects, do they have the same shape?
  238. */
  239. function looseEqual (a, b) {
  240. if (a === b) { return true }
  241. var isObjectA = isObject(a);
  242. var isObjectB = isObject(b);
  243. if (isObjectA && isObjectB) {
  244. try {
  245. var isArrayA = Array.isArray(a);
  246. var isArrayB = Array.isArray(b);
  247. if (isArrayA && isArrayB) {
  248. return a.length === b.length && a.every(function (e, i) {
  249. return looseEqual(e, b[i])
  250. })
  251. } else if (a instanceof Date && b instanceof Date) {
  252. return a.getTime() === b.getTime()
  253. } else if (!isArrayA && !isArrayB) {
  254. var keysA = Object.keys(a);
  255. var keysB = Object.keys(b);
  256. return keysA.length === keysB.length && keysA.every(function (key) {
  257. return looseEqual(a[key], b[key])
  258. })
  259. } else {
  260. /* istanbul ignore next */
  261. return false
  262. }
  263. } catch (e) {
  264. /* istanbul ignore next */
  265. return false
  266. }
  267. } else if (!isObjectA && !isObjectB) {
  268. return String(a) === String(b)
  269. } else {
  270. return false
  271. }
  272. }
  273. /**
  274. * Return the first index at which a loosely equal value can be
  275. * found in the array (if value is a plain object, the array must
  276. * contain an object of the same shape), or -1 if it is not present.
  277. */
  278. function looseIndexOf (arr, val) {
  279. for (var i = 0; i < arr.length; i++) {
  280. if (looseEqual(arr[i], val)) { return i }
  281. }
  282. return -1
  283. }
  284. /**
  285. * Ensure a function is called only once.
  286. */
  287. function once (fn) {
  288. var called = false;
  289. return function () {
  290. if (!called) {
  291. called = true;
  292. fn.apply(this, arguments);
  293. }
  294. }
  295. }
  296. var SSR_ATTR = 'data-server-rendered';
  297. var ASSET_TYPES = [
  298. 'component',
  299. 'directive',
  300. 'filter'
  301. ];
  302. var LIFECYCLE_HOOKS = [
  303. 'beforeCreate',
  304. 'created',
  305. 'beforeMount',
  306. 'mounted',
  307. 'beforeUpdate',
  308. 'updated',
  309. 'beforeDestroy',
  310. 'destroyed',
  311. 'activated',
  312. 'deactivated',
  313. 'errorCaptured',
  314. 'serverPrefetch'
  315. ];
  316. /* */
  317. var config = ({
  318. /**
  319. * Option merge strategies (used in core/util/options)
  320. */
  321. // $flow-disable-line
  322. optionMergeStrategies: Object.create(null),
  323. /**
  324. * Whether to suppress warnings.
  325. */
  326. silent: false,
  327. /**
  328. * Show production mode tip message on boot?
  329. */
  330. productionTip: "development" !== 'production',
  331. /**
  332. * Whether to enable devtools
  333. */
  334. devtools: "development" !== 'production',
  335. /**
  336. * Whether to record perf
  337. */
  338. performance: false,
  339. /**
  340. * Error handler for watcher errors
  341. */
  342. errorHandler: null,
  343. /**
  344. * Warn handler for watcher warns
  345. */
  346. warnHandler: null,
  347. /**
  348. * Ignore certain custom elements
  349. */
  350. ignoredElements: [],
  351. /**
  352. * Custom user key aliases for v-on
  353. */
  354. // $flow-disable-line
  355. keyCodes: Object.create(null),
  356. /**
  357. * Check if a tag is reserved so that it cannot be registered as a
  358. * component. This is platform-dependent and may be overwritten.
  359. */
  360. isReservedTag: no,
  361. /**
  362. * Check if an attribute is reserved so that it cannot be used as a component
  363. * prop. This is platform-dependent and may be overwritten.
  364. */
  365. isReservedAttr: no,
  366. /**
  367. * Check if a tag is an unknown element.
  368. * Platform-dependent.
  369. */
  370. isUnknownElement: no,
  371. /**
  372. * Get the namespace of an element
  373. */
  374. getTagNamespace: noop,
  375. /**
  376. * Parse the real tag name for the specific platform.
  377. */
  378. parsePlatformTagName: identity,
  379. /**
  380. * Check if an attribute must be bound using property, e.g. value
  381. * Platform-dependent.
  382. */
  383. mustUseProp: no,
  384. /**
  385. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  386. * This will significantly reduce performance if set to false.
  387. */
  388. async: true,
  389. /**
  390. * Exposed for legacy reasons
  391. */
  392. _lifecycleHooks: LIFECYCLE_HOOKS
  393. });
  394. /* */
  395. /**
  396. * unicode letters used for parsing html tags, component names and property paths.
  397. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  398. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  399. */
  400. 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/;
  401. /**
  402. * Check if a string starts with $ or _
  403. */
  404. function isReserved (str) {
  405. var c = (str + '').charCodeAt(0);
  406. return c === 0x24 || c === 0x5F
  407. }
  408. /**
  409. * Define a property.
  410. */
  411. function def (obj, key, val, enumerable) {
  412. Object.defineProperty(obj, key, {
  413. value: val,
  414. enumerable: !!enumerable,
  415. writable: true,
  416. configurable: true
  417. });
  418. }
  419. /**
  420. * Parse simple path.
  421. */
  422. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  423. function parsePath (path) {
  424. if (bailRE.test(path)) {
  425. return
  426. }
  427. var segments = path.split('.');
  428. return function (obj) {
  429. for (var i = 0; i < segments.length; i++) {
  430. if (!obj) { return }
  431. obj = obj[segments[i]];
  432. }
  433. return obj
  434. }
  435. }
  436. /* */
  437. // can we use __proto__?
  438. var hasProto = '__proto__' in {};
  439. // Browser environment sniffing
  440. var inBrowser = typeof window !== 'undefined';
  441. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  442. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  443. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  444. var isIE = UA && /msie|trident/.test(UA);
  445. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  446. var isEdge = UA && UA.indexOf('edge/') > 0;
  447. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  448. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  449. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  450. var isPhantomJS = UA && /phantomjs/.test(UA);
  451. var isFF = UA && UA.match(/firefox\/(\d+)/);
  452. // Firefox has a "watch" function on Object.prototype...
  453. var nativeWatch = ({}).watch;
  454. if (inBrowser) {
  455. try {
  456. var opts = {};
  457. Object.defineProperty(opts, 'passive', ({
  458. get: function get () {
  459. }
  460. })); // https://github.com/facebook/flow/issues/285
  461. window.addEventListener('test-passive', null, opts);
  462. } catch (e) {}
  463. }
  464. // this needs to be lazy-evaled because vue may be required before
  465. // vue-server-renderer can set VUE_ENV
  466. var _isServer;
  467. var isServerRendering = function () {
  468. if (_isServer === undefined) {
  469. /* istanbul ignore if */
  470. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  471. // detect presence of vue-server-renderer and avoid
  472. // Webpack shimming the process
  473. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  474. } else {
  475. _isServer = false;
  476. }
  477. }
  478. return _isServer
  479. };
  480. // detect devtools
  481. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  482. /* istanbul ignore next */
  483. function isNative (Ctor) {
  484. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  485. }
  486. var hasSymbol =
  487. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  488. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  489. var _Set;
  490. /* istanbul ignore if */ // $flow-disable-line
  491. if (typeof Set !== 'undefined' && isNative(Set)) {
  492. // use native Set when available.
  493. _Set = Set;
  494. } else {
  495. // a non-standard Set polyfill that only works with primitive keys.
  496. _Set = /*@__PURE__*/(function () {
  497. function Set () {
  498. this.set = Object.create(null);
  499. }
  500. Set.prototype.has = function has (key) {
  501. return this.set[key] === true
  502. };
  503. Set.prototype.add = function add (key) {
  504. this.set[key] = true;
  505. };
  506. Set.prototype.clear = function clear () {
  507. this.set = Object.create(null);
  508. };
  509. return Set;
  510. }());
  511. }
  512. /* */
  513. var warn = noop;
  514. var tip = noop;
  515. var generateComponentTrace = (noop); // work around flow check
  516. var formatComponentName = (noop);
  517. {
  518. var hasConsole = typeof console !== 'undefined';
  519. var classifyRE = /(?:^|[-_])(\w)/g;
  520. var classify = function (str) { return str
  521. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  522. .replace(/[-_]/g, ''); };
  523. warn = function (msg, vm) {
  524. var trace = vm ? generateComponentTrace(vm) : '';
  525. if (config.warnHandler) {
  526. config.warnHandler.call(null, msg, vm, trace);
  527. } else if (hasConsole && (!config.silent)) {
  528. console.error(("[Vue warn]: " + msg + trace));
  529. }
  530. };
  531. tip = function (msg, vm) {
  532. if (hasConsole && (!config.silent)) {
  533. console.warn("[Vue tip]: " + msg + (
  534. vm ? generateComponentTrace(vm) : ''
  535. ));
  536. }
  537. };
  538. formatComponentName = function (vm, includeFile) {
  539. if (vm.$root === vm) {
  540. return '<Root>'
  541. }
  542. var options = typeof vm === 'function' && vm.cid != null
  543. ? vm.options
  544. : vm._isVue
  545. ? vm.$options || vm.constructor.options
  546. : vm;
  547. var name = options.name || options._componentTag;
  548. var file = options.__file;
  549. if (!name && file) {
  550. var match = file.match(/([^/\\]+)\.vue$/);
  551. name = match && match[1];
  552. }
  553. return (
  554. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  555. (file && includeFile !== false ? (" at " + file) : '')
  556. )
  557. };
  558. var repeat = function (str, n) {
  559. var res = '';
  560. while (n) {
  561. if (n % 2 === 1) { res += str; }
  562. if (n > 1) { str += str; }
  563. n >>= 1;
  564. }
  565. return res
  566. };
  567. generateComponentTrace = function (vm) {
  568. if (vm._isVue && vm.$parent) {
  569. var tree = [];
  570. var currentRecursiveSequence = 0;
  571. while (vm) {
  572. if (tree.length > 0) {
  573. var last = tree[tree.length - 1];
  574. if (last.constructor === vm.constructor) {
  575. currentRecursiveSequence++;
  576. vm = vm.$parent;
  577. continue
  578. } else if (currentRecursiveSequence > 0) {
  579. tree[tree.length - 1] = [last, currentRecursiveSequence];
  580. currentRecursiveSequence = 0;
  581. }
  582. }
  583. tree.push(vm);
  584. vm = vm.$parent;
  585. }
  586. return '\n\nfound in\n\n' + tree
  587. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  588. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  589. : formatComponentName(vm))); })
  590. .join('\n')
  591. } else {
  592. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  593. }
  594. };
  595. }
  596. /* */
  597. var uid = 0;
  598. /**
  599. * A dep is an observable that can have multiple
  600. * directives subscribing to it.
  601. */
  602. var Dep = function Dep () {
  603. // fixed by xxxxxx (nvue vuex)
  604. /* eslint-disable no-undef */
  605. if(typeof SharedObject !== 'undefined'){
  606. this.id = SharedObject.uid++;
  607. } else {
  608. this.id = uid++;
  609. }
  610. this.subs = [];
  611. };
  612. Dep.prototype.addSub = function addSub (sub) {
  613. this.subs.push(sub);
  614. };
  615. Dep.prototype.removeSub = function removeSub (sub) {
  616. remove(this.subs, sub);
  617. };
  618. Dep.prototype.depend = function depend () {
  619. if (Dep.SharedObject.target) { // fixed by xxxxxx
  620. Dep.SharedObject.target.addDep(this);
  621. }
  622. };
  623. Dep.prototype.notify = function notify () {
  624. // stabilize the subscriber list first
  625. var subs = this.subs.slice();
  626. if (!config.async) {
  627. // subs aren't sorted in scheduler if not running async
  628. // we need to sort them now to make sure they fire in correct
  629. // order
  630. subs.sort(function (a, b) { return a.id - b.id; });
  631. }
  632. for (var i = 0, l = subs.length; i < l; i++) {
  633. subs[i].update();
  634. }
  635. };
  636. // The current target watcher being evaluated.
  637. // This is globally unique because only one watcher
  638. // can be evaluated at a time.
  639. // fixed by xxxxxx (nvue shared vuex)
  640. /* eslint-disable no-undef */
  641. Dep.SharedObject = typeof SharedObject !== 'undefined' ? SharedObject : {};
  642. Dep.SharedObject.target = null;
  643. Dep.SharedObject.targetStack = [];
  644. function pushTarget (target) {
  645. Dep.SharedObject.targetStack.push(target);
  646. Dep.SharedObject.target = target;
  647. }
  648. function popTarget () {
  649. Dep.SharedObject.targetStack.pop();
  650. Dep.SharedObject.target = Dep.SharedObject.targetStack[Dep.SharedObject.targetStack.length - 1];
  651. }
  652. /* */
  653. var VNode = function VNode (
  654. tag,
  655. data,
  656. children,
  657. text,
  658. elm,
  659. context,
  660. componentOptions,
  661. asyncFactory
  662. ) {
  663. this.tag = tag;
  664. this.data = data;
  665. this.children = children;
  666. this.text = text;
  667. this.elm = elm;
  668. this.ns = undefined;
  669. this.context = context;
  670. this.fnContext = undefined;
  671. this.fnOptions = undefined;
  672. this.fnScopeId = undefined;
  673. this.key = data && data.key;
  674. this.componentOptions = componentOptions;
  675. this.componentInstance = undefined;
  676. this.parent = undefined;
  677. this.raw = false;
  678. this.isStatic = false;
  679. this.isRootInsert = true;
  680. this.isComment = false;
  681. this.isCloned = false;
  682. this.isOnce = false;
  683. this.asyncFactory = asyncFactory;
  684. this.asyncMeta = undefined;
  685. this.isAsyncPlaceholder = false;
  686. };
  687. var prototypeAccessors = { child: { configurable: true } };
  688. // DEPRECATED: alias for componentInstance for backwards compat.
  689. /* istanbul ignore next */
  690. prototypeAccessors.child.get = function () {
  691. return this.componentInstance
  692. };
  693. Object.defineProperties( VNode.prototype, prototypeAccessors );
  694. var createEmptyVNode = function (text) {
  695. if ( text === void 0 ) text = '';
  696. var node = new VNode();
  697. node.text = text;
  698. node.isComment = true;
  699. return node
  700. };
  701. function createTextVNode (val) {
  702. return new VNode(undefined, undefined, undefined, String(val))
  703. }
  704. // optimized shallow clone
  705. // used for static nodes and slot nodes because they may be reused across
  706. // multiple renders, cloning them avoids errors when DOM manipulations rely
  707. // on their elm reference.
  708. function cloneVNode (vnode) {
  709. var cloned = new VNode(
  710. vnode.tag,
  711. vnode.data,
  712. // #7975
  713. // clone children array to avoid mutating original in case of cloning
  714. // a child.
  715. vnode.children && vnode.children.slice(),
  716. vnode.text,
  717. vnode.elm,
  718. vnode.context,
  719. vnode.componentOptions,
  720. vnode.asyncFactory
  721. );
  722. cloned.ns = vnode.ns;
  723. cloned.isStatic = vnode.isStatic;
  724. cloned.key = vnode.key;
  725. cloned.isComment = vnode.isComment;
  726. cloned.fnContext = vnode.fnContext;
  727. cloned.fnOptions = vnode.fnOptions;
  728. cloned.fnScopeId = vnode.fnScopeId;
  729. cloned.asyncMeta = vnode.asyncMeta;
  730. cloned.isCloned = true;
  731. return cloned
  732. }
  733. /*
  734. * not type checking this file because flow doesn't play well with
  735. * dynamically accessing methods on Array prototype
  736. */
  737. var arrayProto = Array.prototype;
  738. var arrayMethods = Object.create(arrayProto);
  739. var methodsToPatch = [
  740. 'push',
  741. 'pop',
  742. 'shift',
  743. 'unshift',
  744. 'splice',
  745. 'sort',
  746. 'reverse'
  747. ];
  748. /**
  749. * Intercept mutating methods and emit events
  750. */
  751. methodsToPatch.forEach(function (method) {
  752. // cache original method
  753. var original = arrayProto[method];
  754. def(arrayMethods, method, function mutator () {
  755. var args = [], len = arguments.length;
  756. while ( len-- ) args[ len ] = arguments[ len ];
  757. var result = original.apply(this, args);
  758. var ob = this.__ob__;
  759. var inserted;
  760. switch (method) {
  761. case 'push':
  762. case 'unshift':
  763. inserted = args;
  764. break
  765. case 'splice':
  766. inserted = args.slice(2);
  767. break
  768. }
  769. if (inserted) { ob.observeArray(inserted); }
  770. // notify change
  771. ob.dep.notify();
  772. return result
  773. });
  774. });
  775. /* */
  776. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  777. /**
  778. * In some cases we may want to disable observation inside a component's
  779. * update computation.
  780. */
  781. var shouldObserve = true;
  782. function toggleObserving (value) {
  783. shouldObserve = value;
  784. }
  785. /**
  786. * Observer class that is attached to each observed
  787. * object. Once attached, the observer converts the target
  788. * object's property keys into getter/setters that
  789. * collect dependencies and dispatch updates.
  790. */
  791. var Observer = function Observer (value) {
  792. this.value = value;
  793. this.dep = new Dep();
  794. this.vmCount = 0;
  795. def(value, '__ob__', this);
  796. if (Array.isArray(value)) {
  797. if (hasProto) {
  798. protoAugment(value, arrayMethods);
  799. } else {
  800. copyAugment(value, arrayMethods, arrayKeys);
  801. }
  802. this.observeArray(value);
  803. } else {
  804. this.walk(value);
  805. }
  806. };
  807. /**
  808. * Walk through all properties and convert them into
  809. * getter/setters. This method should only be called when
  810. * value type is Object.
  811. */
  812. Observer.prototype.walk = function walk (obj) {
  813. var keys = Object.keys(obj);
  814. for (var i = 0; i < keys.length; i++) {
  815. defineReactive$$1(obj, keys[i]);
  816. }
  817. };
  818. /**
  819. * Observe a list of Array items.
  820. */
  821. Observer.prototype.observeArray = function observeArray (items) {
  822. for (var i = 0, l = items.length; i < l; i++) {
  823. observe(items[i]);
  824. }
  825. };
  826. // helpers
  827. /**
  828. * Augment a target Object or Array by intercepting
  829. * the prototype chain using __proto__
  830. */
  831. function protoAugment (target, src) {
  832. /* eslint-disable no-proto */
  833. target.__proto__ = src;
  834. /* eslint-enable no-proto */
  835. }
  836. /**
  837. * Augment a target Object or Array by defining
  838. * hidden properties.
  839. */
  840. /* istanbul ignore next */
  841. function copyAugment (target, src, keys) {
  842. for (var i = 0, l = keys.length; i < l; i++) {
  843. var key = keys[i];
  844. def(target, key, src[key]);
  845. }
  846. }
  847. /**
  848. * Attempt to create an observer instance for a value,
  849. * returns the new observer if successfully observed,
  850. * or the existing observer if the value already has one.
  851. */
  852. function observe (value, asRootData) {
  853. if (!isObject(value) || value instanceof VNode) {
  854. return
  855. }
  856. var ob;
  857. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  858. ob = value.__ob__;
  859. } else if (
  860. shouldObserve &&
  861. !isServerRendering() &&
  862. (Array.isArray(value) || isPlainObject(value)) &&
  863. Object.isExtensible(value) &&
  864. !value._isVue
  865. ) {
  866. ob = new Observer(value);
  867. }
  868. if (asRootData && ob) {
  869. ob.vmCount++;
  870. }
  871. return ob
  872. }
  873. /**
  874. * Define a reactive property on an Object.
  875. */
  876. function defineReactive$$1 (
  877. obj,
  878. key,
  879. val,
  880. customSetter,
  881. shallow
  882. ) {
  883. var dep = new Dep();
  884. var property = Object.getOwnPropertyDescriptor(obj, key);
  885. if (property && property.configurable === false) {
  886. return
  887. }
  888. // cater for pre-defined getter/setters
  889. var getter = property && property.get;
  890. var setter = property && property.set;
  891. if ((!getter || setter) && arguments.length === 2) {
  892. val = obj[key];
  893. }
  894. var childOb = !shallow && observe(val);
  895. Object.defineProperty(obj, key, {
  896. enumerable: true,
  897. configurable: true,
  898. get: function reactiveGetter () {
  899. var value = getter ? getter.call(obj) : val;
  900. if (Dep.SharedObject.target) { // fixed by xxxxxx
  901. dep.depend();
  902. if (childOb) {
  903. childOb.dep.depend();
  904. if (Array.isArray(value)) {
  905. dependArray(value);
  906. }
  907. }
  908. }
  909. return value
  910. },
  911. set: function reactiveSetter (newVal) {
  912. var value = getter ? getter.call(obj) : val;
  913. /* eslint-disable no-self-compare */
  914. if (newVal === value || (newVal !== newVal && value !== value)) {
  915. return
  916. }
  917. /* eslint-enable no-self-compare */
  918. if (customSetter) {
  919. customSetter();
  920. }
  921. // #7981: for accessor properties without setter
  922. if (getter && !setter) { return }
  923. if (setter) {
  924. setter.call(obj, newVal);
  925. } else {
  926. val = newVal;
  927. }
  928. childOb = !shallow && observe(newVal);
  929. dep.notify();
  930. }
  931. });
  932. }
  933. /**
  934. * Set a property on an object. Adds the new property and
  935. * triggers change notification if the property doesn't
  936. * already exist.
  937. */
  938. function set (target, key, val) {
  939. if (isUndef(target) || isPrimitive(target)
  940. ) {
  941. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  942. }
  943. if (Array.isArray(target) && isValidArrayIndex(key)) {
  944. target.length = Math.max(target.length, key);
  945. target.splice(key, 1, val);
  946. return val
  947. }
  948. if (key in target && !(key in Object.prototype)) {
  949. target[key] = val;
  950. return val
  951. }
  952. var ob = (target).__ob__;
  953. if (target._isVue || (ob && ob.vmCount)) {
  954. warn(
  955. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  956. 'at runtime - declare it upfront in the data option.'
  957. );
  958. return val
  959. }
  960. if (!ob) {
  961. target[key] = val;
  962. return val
  963. }
  964. defineReactive$$1(ob.value, key, val);
  965. ob.dep.notify();
  966. return val
  967. }
  968. /**
  969. * Delete a property and trigger change if necessary.
  970. */
  971. function del (target, key) {
  972. if (isUndef(target) || isPrimitive(target)
  973. ) {
  974. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  975. }
  976. if (Array.isArray(target) && isValidArrayIndex(key)) {
  977. target.splice(key, 1);
  978. return
  979. }
  980. var ob = (target).__ob__;
  981. if (target._isVue || (ob && ob.vmCount)) {
  982. warn(
  983. 'Avoid deleting properties on a Vue instance or its root $data ' +
  984. '- just set it to null.'
  985. );
  986. return
  987. }
  988. if (!hasOwn(target, key)) {
  989. return
  990. }
  991. delete target[key];
  992. if (!ob) {
  993. return
  994. }
  995. ob.dep.notify();
  996. }
  997. /**
  998. * Collect dependencies on array elements when the array is touched, since
  999. * we cannot intercept array element access like property getters.
  1000. */
  1001. function dependArray (value) {
  1002. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  1003. e = value[i];
  1004. e && e.__ob__ && e.__ob__.dep.depend();
  1005. if (Array.isArray(e)) {
  1006. dependArray(e);
  1007. }
  1008. }
  1009. }
  1010. /* */
  1011. /**
  1012. * Option overwriting strategies are functions that handle
  1013. * how to merge a parent option value and a child option
  1014. * value into the final value.
  1015. */
  1016. var strats = config.optionMergeStrategies;
  1017. /**
  1018. * Options with restrictions
  1019. */
  1020. {
  1021. strats.el = strats.propsData = function (parent, child, vm, key) {
  1022. if (!vm) {
  1023. warn(
  1024. "option \"" + key + "\" can only be used during instance " +
  1025. 'creation with the `new` keyword.'
  1026. );
  1027. }
  1028. return defaultStrat(parent, child)
  1029. };
  1030. }
  1031. /**
  1032. * Helper that recursively merges two data objects together.
  1033. */
  1034. function mergeData (to, from) {
  1035. if (!from) { return to }
  1036. var key, toVal, fromVal;
  1037. var keys = hasSymbol
  1038. ? Reflect.ownKeys(from)
  1039. : Object.keys(from);
  1040. for (var i = 0; i < keys.length; i++) {
  1041. key = keys[i];
  1042. // in case the object is already observed...
  1043. if (key === '__ob__') { continue }
  1044. toVal = to[key];
  1045. fromVal = from[key];
  1046. if (!hasOwn(to, key)) {
  1047. set(to, key, fromVal);
  1048. } else if (
  1049. toVal !== fromVal &&
  1050. isPlainObject(toVal) &&
  1051. isPlainObject(fromVal)
  1052. ) {
  1053. mergeData(toVal, fromVal);
  1054. }
  1055. }
  1056. return to
  1057. }
  1058. /**
  1059. * Data
  1060. */
  1061. function mergeDataOrFn (
  1062. parentVal,
  1063. childVal,
  1064. vm
  1065. ) {
  1066. if (!vm) {
  1067. // in a Vue.extend merge, both should be functions
  1068. if (!childVal) {
  1069. return parentVal
  1070. }
  1071. if (!parentVal) {
  1072. return childVal
  1073. }
  1074. // when parentVal & childVal are both present,
  1075. // we need to return a function that returns the
  1076. // merged result of both functions... no need to
  1077. // check if parentVal is a function here because
  1078. // it has to be a function to pass previous merges.
  1079. return function mergedDataFn () {
  1080. return mergeData(
  1081. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  1082. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  1083. )
  1084. }
  1085. } else {
  1086. return function mergedInstanceDataFn () {
  1087. // instance merge
  1088. var instanceData = typeof childVal === 'function'
  1089. ? childVal.call(vm, vm)
  1090. : childVal;
  1091. var defaultData = typeof parentVal === 'function'
  1092. ? parentVal.call(vm, vm)
  1093. : parentVal;
  1094. if (instanceData) {
  1095. return mergeData(instanceData, defaultData)
  1096. } else {
  1097. return defaultData
  1098. }
  1099. }
  1100. }
  1101. }
  1102. strats.data = function (
  1103. parentVal,
  1104. childVal,
  1105. vm
  1106. ) {
  1107. if (!vm) {
  1108. if (childVal && typeof childVal !== 'function') {
  1109. warn(
  1110. 'The "data" option should be a function ' +
  1111. 'that returns a per-instance value in component ' +
  1112. 'definitions.',
  1113. vm
  1114. );
  1115. return parentVal
  1116. }
  1117. return mergeDataOrFn(parentVal, childVal)
  1118. }
  1119. return mergeDataOrFn(parentVal, childVal, vm)
  1120. };
  1121. /**
  1122. * Hooks and props are merged as arrays.
  1123. */
  1124. function mergeHook (
  1125. parentVal,
  1126. childVal
  1127. ) {
  1128. var res = childVal
  1129. ? parentVal
  1130. ? parentVal.concat(childVal)
  1131. : Array.isArray(childVal)
  1132. ? childVal
  1133. : [childVal]
  1134. : parentVal;
  1135. return res
  1136. ? dedupeHooks(res)
  1137. : res
  1138. }
  1139. function dedupeHooks (hooks) {
  1140. var res = [];
  1141. for (var i = 0; i < hooks.length; i++) {
  1142. if (res.indexOf(hooks[i]) === -1) {
  1143. res.push(hooks[i]);
  1144. }
  1145. }
  1146. return res
  1147. }
  1148. LIFECYCLE_HOOKS.forEach(function (hook) {
  1149. strats[hook] = mergeHook;
  1150. });
  1151. /**
  1152. * Assets
  1153. *
  1154. * When a vm is present (instance creation), we need to do
  1155. * a three-way merge between constructor options, instance
  1156. * options and parent options.
  1157. */
  1158. function mergeAssets (
  1159. parentVal,
  1160. childVal,
  1161. vm,
  1162. key
  1163. ) {
  1164. var res = Object.create(parentVal || null);
  1165. if (childVal) {
  1166. assertObjectType(key, childVal, vm);
  1167. return extend(res, childVal)
  1168. } else {
  1169. return res
  1170. }
  1171. }
  1172. ASSET_TYPES.forEach(function (type) {
  1173. strats[type + 's'] = mergeAssets;
  1174. });
  1175. /**
  1176. * Watchers.
  1177. *
  1178. * Watchers hashes should not overwrite one
  1179. * another, so we merge them as arrays.
  1180. */
  1181. strats.watch = function (
  1182. parentVal,
  1183. childVal,
  1184. vm,
  1185. key
  1186. ) {
  1187. // work around Firefox's Object.prototype.watch...
  1188. if (parentVal === nativeWatch) { parentVal = undefined; }
  1189. if (childVal === nativeWatch) { childVal = undefined; }
  1190. /* istanbul ignore if */
  1191. if (!childVal) { return Object.create(parentVal || null) }
  1192. {
  1193. assertObjectType(key, childVal, vm);
  1194. }
  1195. if (!parentVal) { return childVal }
  1196. var ret = {};
  1197. extend(ret, parentVal);
  1198. for (var key$1 in childVal) {
  1199. var parent = ret[key$1];
  1200. var child = childVal[key$1];
  1201. if (parent && !Array.isArray(parent)) {
  1202. parent = [parent];
  1203. }
  1204. ret[key$1] = parent
  1205. ? parent.concat(child)
  1206. : Array.isArray(child) ? child : [child];
  1207. }
  1208. return ret
  1209. };
  1210. /**
  1211. * Other object hashes.
  1212. */
  1213. strats.props =
  1214. strats.methods =
  1215. strats.inject =
  1216. strats.computed = function (
  1217. parentVal,
  1218. childVal,
  1219. vm,
  1220. key
  1221. ) {
  1222. if (childVal && "development" !== 'production') {
  1223. assertObjectType(key, childVal, vm);
  1224. }
  1225. if (!parentVal) { return childVal }
  1226. var ret = Object.create(null);
  1227. extend(ret, parentVal);
  1228. if (childVal) { extend(ret, childVal); }
  1229. return ret
  1230. };
  1231. strats.provide = mergeDataOrFn;
  1232. /**
  1233. * Default strategy.
  1234. */
  1235. var defaultStrat = function (parentVal, childVal) {
  1236. return childVal === undefined
  1237. ? parentVal
  1238. : childVal
  1239. };
  1240. /**
  1241. * Validate component names
  1242. */
  1243. function checkComponents (options) {
  1244. for (var key in options.components) {
  1245. validateComponentName(key);
  1246. }
  1247. }
  1248. function validateComponentName (name) {
  1249. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  1250. warn(
  1251. 'Invalid component name: "' + name + '". Component names ' +
  1252. 'should conform to valid custom element name in html5 specification.'
  1253. );
  1254. }
  1255. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  1256. warn(
  1257. 'Do not use built-in or reserved HTML elements as component ' +
  1258. 'id: ' + name
  1259. );
  1260. }
  1261. }
  1262. /**
  1263. * Ensure all props option syntax are normalized into the
  1264. * Object-based format.
  1265. */
  1266. function normalizeProps (options, vm) {
  1267. var props = options.props;
  1268. if (!props) { return }
  1269. var res = {};
  1270. var i, val, name;
  1271. if (Array.isArray(props)) {
  1272. i = props.length;
  1273. while (i--) {
  1274. val = props[i];
  1275. if (typeof val === 'string') {
  1276. name = camelize(val);
  1277. res[name] = { type: null };
  1278. } else {
  1279. warn('props must be strings when using array syntax.');
  1280. }
  1281. }
  1282. } else if (isPlainObject(props)) {
  1283. for (var key in props) {
  1284. val = props[key];
  1285. name = camelize(key);
  1286. res[name] = isPlainObject(val)
  1287. ? val
  1288. : { type: val };
  1289. }
  1290. } else {
  1291. warn(
  1292. "Invalid value for option \"props\": expected an Array or an Object, " +
  1293. "but got " + (toRawType(props)) + ".",
  1294. vm
  1295. );
  1296. }
  1297. options.props = res;
  1298. }
  1299. /**
  1300. * Normalize all injections into Object-based format
  1301. */
  1302. function normalizeInject (options, vm) {
  1303. var inject = options.inject;
  1304. if (!inject) { return }
  1305. var normalized = options.inject = {};
  1306. if (Array.isArray(inject)) {
  1307. for (var i = 0; i < inject.length; i++) {
  1308. normalized[inject[i]] = { from: inject[i] };
  1309. }
  1310. } else if (isPlainObject(inject)) {
  1311. for (var key in inject) {
  1312. var val = inject[key];
  1313. normalized[key] = isPlainObject(val)
  1314. ? extend({ from: key }, val)
  1315. : { from: val };
  1316. }
  1317. } else {
  1318. warn(
  1319. "Invalid value for option \"inject\": expected an Array or an Object, " +
  1320. "but got " + (toRawType(inject)) + ".",
  1321. vm
  1322. );
  1323. }
  1324. }
  1325. /**
  1326. * Normalize raw function directives into object format.
  1327. */
  1328. function normalizeDirectives (options) {
  1329. var dirs = options.directives;
  1330. if (dirs) {
  1331. for (var key in dirs) {
  1332. var def$$1 = dirs[key];
  1333. if (typeof def$$1 === 'function') {
  1334. dirs[key] = { bind: def$$1, update: def$$1 };
  1335. }
  1336. }
  1337. }
  1338. }
  1339. function assertObjectType (name, value, vm) {
  1340. if (!isPlainObject(value)) {
  1341. warn(
  1342. "Invalid value for option \"" + name + "\": expected an Object, " +
  1343. "but got " + (toRawType(value)) + ".",
  1344. vm
  1345. );
  1346. }
  1347. }
  1348. /**
  1349. * Merge two option objects into a new one.
  1350. * Core utility used in both instantiation and inheritance.
  1351. */
  1352. function mergeOptions (
  1353. parent,
  1354. child,
  1355. vm
  1356. ) {
  1357. {
  1358. checkComponents(child);
  1359. }
  1360. if (typeof child === 'function') {
  1361. child = child.options;
  1362. }
  1363. normalizeProps(child, vm);
  1364. normalizeInject(child, vm);
  1365. normalizeDirectives(child);
  1366. // Apply extends and mixins on the child options,
  1367. // but only if it is a raw options object that isn't
  1368. // the result of another mergeOptions call.
  1369. // Only merged options has the _base property.
  1370. if (!child._base) {
  1371. if (child.extends) {
  1372. parent = mergeOptions(parent, child.extends, vm);
  1373. }
  1374. if (child.mixins) {
  1375. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1376. parent = mergeOptions(parent, child.mixins[i], vm);
  1377. }
  1378. }
  1379. }
  1380. var options = {};
  1381. var key;
  1382. for (key in parent) {
  1383. mergeField(key);
  1384. }
  1385. for (key in child) {
  1386. if (!hasOwn(parent, key)) {
  1387. mergeField(key);
  1388. }
  1389. }
  1390. function mergeField (key) {
  1391. var strat = strats[key] || defaultStrat;
  1392. options[key] = strat(parent[key], child[key], vm, key);
  1393. }
  1394. return options
  1395. }
  1396. /**
  1397. * Resolve an asset.
  1398. * This function is used because child instances need access
  1399. * to assets defined in its ancestor chain.
  1400. */
  1401. function resolveAsset (
  1402. options,
  1403. type,
  1404. id,
  1405. warnMissing
  1406. ) {
  1407. /* istanbul ignore if */
  1408. if (typeof id !== 'string') {
  1409. return
  1410. }
  1411. var assets = options[type];
  1412. // check local registration variations first
  1413. if (hasOwn(assets, id)) { return assets[id] }
  1414. var camelizedId = camelize(id);
  1415. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  1416. var PascalCaseId = capitalize(camelizedId);
  1417. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  1418. // fallback to prototype chain
  1419. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  1420. if (warnMissing && !res) {
  1421. warn(
  1422. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  1423. options
  1424. );
  1425. }
  1426. return res
  1427. }
  1428. /* */
  1429. function validateProp (
  1430. key,
  1431. propOptions,
  1432. propsData,
  1433. vm
  1434. ) {
  1435. var prop = propOptions[key];
  1436. var absent = !hasOwn(propsData, key);
  1437. var value = propsData[key];
  1438. // boolean casting
  1439. var booleanIndex = getTypeIndex(Boolean, prop.type);
  1440. if (booleanIndex > -1) {
  1441. if (absent && !hasOwn(prop, 'default')) {
  1442. value = false;
  1443. } else if (value === '' || value === hyphenate(key)) {
  1444. // only cast empty string / same name to boolean if
  1445. // boolean has higher priority
  1446. var stringIndex = getTypeIndex(String, prop.type);
  1447. if (stringIndex < 0 || booleanIndex < stringIndex) {
  1448. value = true;
  1449. }
  1450. }
  1451. }
  1452. // check default value
  1453. if (value === undefined) {
  1454. value = getPropDefaultValue(vm, prop, key);
  1455. // since the default value is a fresh copy,
  1456. // make sure to observe it.
  1457. var prevShouldObserve = shouldObserve;
  1458. toggleObserving(true);
  1459. observe(value);
  1460. toggleObserving(prevShouldObserve);
  1461. }
  1462. {
  1463. assertProp(prop, key, value, vm, absent);
  1464. }
  1465. return value
  1466. }
  1467. /**
  1468. * Get the default value of a prop.
  1469. */
  1470. function getPropDefaultValue (vm, prop, key) {
  1471. // no default, return undefined
  1472. if (!hasOwn(prop, 'default')) {
  1473. return undefined
  1474. }
  1475. var def = prop.default;
  1476. // warn against non-factory defaults for Object & Array
  1477. if (isObject(def)) {
  1478. warn(
  1479. 'Invalid default value for prop "' + key + '": ' +
  1480. 'Props with type Object/Array must use a factory function ' +
  1481. 'to return the default value.',
  1482. vm
  1483. );
  1484. }
  1485. // the raw prop value was also undefined from previous render,
  1486. // return previous default value to avoid unnecessary watcher trigger
  1487. if (vm && vm.$options.propsData &&
  1488. vm.$options.propsData[key] === undefined &&
  1489. vm._props[key] !== undefined
  1490. ) {
  1491. return vm._props[key]
  1492. }
  1493. // call factory function for non-Function types
  1494. // a value is Function if its prototype is function even across different execution context
  1495. return typeof def === 'function' && getType(prop.type) !== 'Function'
  1496. ? def.call(vm)
  1497. : def
  1498. }
  1499. /**
  1500. * Assert whether a prop is valid.
  1501. */
  1502. function assertProp (
  1503. prop,
  1504. name,
  1505. value,
  1506. vm,
  1507. absent
  1508. ) {
  1509. if (prop.required && absent) {
  1510. warn(
  1511. 'Missing required prop: "' + name + '"',
  1512. vm
  1513. );
  1514. return
  1515. }
  1516. if (value == null && !prop.required) {
  1517. return
  1518. }
  1519. var type = prop.type;
  1520. var valid = !type || type === true;
  1521. var expectedTypes = [];
  1522. if (type) {
  1523. if (!Array.isArray(type)) {
  1524. type = [type];
  1525. }
  1526. for (var i = 0; i < type.length && !valid; i++) {
  1527. var assertedType = assertType(value, type[i]);
  1528. expectedTypes.push(assertedType.expectedType || '');
  1529. valid = assertedType.valid;
  1530. }
  1531. }
  1532. if (!valid) {
  1533. warn(
  1534. getInvalidTypeMessage(name, value, expectedTypes),
  1535. vm
  1536. );
  1537. return
  1538. }
  1539. var validator = prop.validator;
  1540. if (validator) {
  1541. if (!validator(value)) {
  1542. warn(
  1543. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  1544. vm
  1545. );
  1546. }
  1547. }
  1548. }
  1549. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  1550. function assertType (value, type) {
  1551. var valid;
  1552. var expectedType = getType(type);
  1553. if (simpleCheckRE.test(expectedType)) {
  1554. var t = typeof value;
  1555. valid = t === expectedType.toLowerCase();
  1556. // for primitive wrapper objects
  1557. if (!valid && t === 'object') {
  1558. valid = value instanceof type;
  1559. }
  1560. } else if (expectedType === 'Object') {
  1561. valid = isPlainObject(value);
  1562. } else if (expectedType === 'Array') {
  1563. valid = Array.isArray(value);
  1564. } else {
  1565. valid = value instanceof type;
  1566. }
  1567. return {
  1568. valid: valid,
  1569. expectedType: expectedType
  1570. }
  1571. }
  1572. /**
  1573. * Use function string name to check built-in types,
  1574. * because a simple equality check will fail when running
  1575. * across different vms / iframes.
  1576. */
  1577. function getType (fn) {
  1578. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  1579. return match ? match[1] : ''
  1580. }
  1581. function isSameType (a, b) {
  1582. return getType(a) === getType(b)
  1583. }
  1584. function getTypeIndex (type, expectedTypes) {
  1585. if (!Array.isArray(expectedTypes)) {
  1586. return isSameType(expectedTypes, type) ? 0 : -1
  1587. }
  1588. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  1589. if (isSameType(expectedTypes[i], type)) {
  1590. return i
  1591. }
  1592. }
  1593. return -1
  1594. }
  1595. function getInvalidTypeMessage (name, value, expectedTypes) {
  1596. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  1597. " Expected " + (expectedTypes.map(capitalize).join(', '));
  1598. var expectedType = expectedTypes[0];
  1599. var receivedType = toRawType(value);
  1600. var expectedValue = styleValue(value, expectedType);
  1601. var receivedValue = styleValue(value, receivedType);
  1602. // check if we need to specify expected value
  1603. if (expectedTypes.length === 1 &&
  1604. isExplicable(expectedType) &&
  1605. !isBoolean(expectedType, receivedType)) {
  1606. message += " with value " + expectedValue;
  1607. }
  1608. message += ", got " + receivedType + " ";
  1609. // check if we need to specify received value
  1610. if (isExplicable(receivedType)) {
  1611. message += "with value " + receivedValue + ".";
  1612. }
  1613. return message
  1614. }
  1615. function styleValue (value, type) {
  1616. if (type === 'String') {
  1617. return ("\"" + value + "\"")
  1618. } else if (type === 'Number') {
  1619. return ("" + (Number(value)))
  1620. } else {
  1621. return ("" + value)
  1622. }
  1623. }
  1624. function isExplicable (value) {
  1625. var explicitTypes = ['string', 'number', 'boolean'];
  1626. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  1627. }
  1628. function isBoolean () {
  1629. var args = [], len = arguments.length;
  1630. while ( len-- ) args[ len ] = arguments[ len ];
  1631. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  1632. }
  1633. /* */
  1634. function handleError (err, vm, info) {
  1635. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  1636. // See: https://github.com/vuejs/vuex/issues/1505
  1637. pushTarget();
  1638. try {
  1639. if (vm) {
  1640. var cur = vm;
  1641. while ((cur = cur.$parent)) {
  1642. var hooks = cur.$options.errorCaptured;
  1643. if (hooks) {
  1644. for (var i = 0; i < hooks.length; i++) {
  1645. try {
  1646. var capture = hooks[i].call(cur, err, vm, info) === false;
  1647. if (capture) { return }
  1648. } catch (e) {
  1649. globalHandleError(e, cur, 'errorCaptured hook');
  1650. }
  1651. }
  1652. }
  1653. }
  1654. }
  1655. globalHandleError(err, vm, info);
  1656. } finally {
  1657. popTarget();
  1658. }
  1659. }
  1660. function invokeWithErrorHandling (
  1661. handler,
  1662. context,
  1663. args,
  1664. vm,
  1665. info
  1666. ) {
  1667. var res;
  1668. try {
  1669. res = args ? handler.apply(context, args) : handler.call(context);
  1670. if (res && !res._isVue && isPromise(res) && !res._handled) {
  1671. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  1672. // issue #9511
  1673. // avoid catch triggering multiple times when nested calls
  1674. res._handled = true;
  1675. }
  1676. } catch (e) {
  1677. handleError(e, vm, info);
  1678. }
  1679. return res
  1680. }
  1681. function globalHandleError (err, vm, info) {
  1682. if (config.errorHandler) {
  1683. try {
  1684. return config.errorHandler.call(null, err, vm, info)
  1685. } catch (e) {
  1686. // if the user intentionally throws the original error in the handler,
  1687. // do not log it twice
  1688. if (e !== err) {
  1689. logError(e, null, 'config.errorHandler');
  1690. }
  1691. }
  1692. }
  1693. logError(err, vm, info);
  1694. }
  1695. function logError (err, vm, info) {
  1696. {
  1697. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  1698. }
  1699. /* istanbul ignore else */
  1700. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  1701. console.error(err);
  1702. } else {
  1703. throw err
  1704. }
  1705. }
  1706. /* */
  1707. var callbacks = [];
  1708. var pending = false;
  1709. function flushCallbacks () {
  1710. pending = false;
  1711. var copies = callbacks.slice(0);
  1712. callbacks.length = 0;
  1713. for (var i = 0; i < copies.length; i++) {
  1714. copies[i]();
  1715. }
  1716. }
  1717. // Here we have async deferring wrappers using microtasks.
  1718. // In 2.5 we used (macro) tasks (in combination with microtasks).
  1719. // However, it has subtle problems when state is changed right before repaint
  1720. // (e.g. #6813, out-in transitions).
  1721. // Also, using (macro) tasks in event handler would cause some weird behaviors
  1722. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  1723. // So we now use microtasks everywhere, again.
  1724. // A major drawback of this tradeoff is that there are some scenarios
  1725. // where microtasks have too high a priority and fire in between supposedly
  1726. // sequential events (e.g. #4521, #6690, which have workarounds)
  1727. // or even between bubbling of the same event (#6566).
  1728. // fixed by xxxxxx app-plus 平台 Promise 执行顺序不一致,导致各种乱七八糟的 Bug,统一使用 setTimeout
  1729. var timerFunc = function () {
  1730. setTimeout(flushCallbacks, 0);
  1731. };
  1732. // The nextTick behavior leverages the microtask queue, which can be accessed
  1733. // via either native Promise.then or MutationObserver.
  1734. // MutationObserver has wider support, however it is seriously bugged in
  1735. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  1736. // completely stops working after triggering a few times... so, if native
  1737. // Promise is available, we will use it:
  1738. /* istanbul ignore next, $flow-disable-line */
  1739. // if (typeof Promise !== 'undefined' && isNative(Promise)) {
  1740. // const p = Promise.resolve()
  1741. // timerFunc = () => {
  1742. // p.then(flushCallbacks)
  1743. // // In problematic UIWebViews, Promise.then doesn't completely break, but
  1744. // // it can get stuck in a weird state where callbacks are pushed into the
  1745. // // microtask queue but the queue isn't being flushed, until the browser
  1746. // // needs to do some other work, e.g. handle a timer. Therefore we can
  1747. // // "force" the microtask queue to be flushed by adding an empty timer.
  1748. // if (isIOS) setTimeout(noop)
  1749. // }
  1750. // isUsingMicroTask = true
  1751. // } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  1752. // isNative(MutationObserver) ||
  1753. // // PhantomJS and iOS 7.x
  1754. // MutationObserver.toString() === '[object MutationObserverConstructor]'
  1755. // )) {
  1756. // // Use MutationObserver where native Promise is not available,
  1757. // // e.g. PhantomJS, iOS7, Android 4.4
  1758. // // (#6466 MutationObserver is unreliable in IE11)
  1759. // let counter = 1
  1760. // const observer = new MutationObserver(flushCallbacks)
  1761. // const textNode = document.createTextNode(String(counter))
  1762. // observer.observe(textNode, {
  1763. // characterData: true
  1764. // })
  1765. // timerFunc = () => {
  1766. // counter = (counter + 1) % 2
  1767. // textNode.data = String(counter)
  1768. // }
  1769. // isUsingMicroTask = true
  1770. // } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  1771. // // Fallback to setImmediate.
  1772. // // Technically it leverages the (macro) task queue,
  1773. // // but it is still a better choice than setTimeout.
  1774. // timerFunc = () => {
  1775. // setImmediate(flushCallbacks)
  1776. // }
  1777. // } else {
  1778. // // Fallback to setTimeout.
  1779. // timerFunc = () => {
  1780. // setTimeout(flushCallbacks, 0)
  1781. // }
  1782. // }
  1783. function nextTick (cb, ctx) {
  1784. var _resolve;
  1785. callbacks.push(function () {
  1786. if (cb) {
  1787. try {
  1788. cb.call(ctx);
  1789. } catch (e) {
  1790. handleError(e, ctx, 'nextTick');
  1791. }
  1792. } else if (_resolve) {
  1793. _resolve(ctx);
  1794. }
  1795. });
  1796. if (!pending) {
  1797. pending = true;
  1798. timerFunc();
  1799. }
  1800. // $flow-disable-line
  1801. if (!cb && typeof Promise !== 'undefined') {
  1802. return new Promise(function (resolve) {
  1803. _resolve = resolve;
  1804. })
  1805. }
  1806. }
  1807. /* */
  1808. /* not type checking this file because flow doesn't play well with Proxy */
  1809. var initProxy;
  1810. {
  1811. var allowedGlobals = makeMap(
  1812. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  1813. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  1814. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  1815. 'require' // for Webpack/Browserify
  1816. );
  1817. var warnNonPresent = function (target, key) {
  1818. warn(
  1819. "Property or method \"" + key + "\" is not defined on the instance but " +
  1820. 'referenced during render. Make sure that this property is reactive, ' +
  1821. 'either in the data option, or for class-based components, by ' +
  1822. 'initializing the property. ' +
  1823. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  1824. target
  1825. );
  1826. };
  1827. var warnReservedPrefix = function (target, key) {
  1828. warn(
  1829. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  1830. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  1831. 'prevent conflicts with Vue internals. ' +
  1832. 'See: https://vuejs.org/v2/api/#data',
  1833. target
  1834. );
  1835. };
  1836. var hasProxy =
  1837. typeof Proxy !== 'undefined' && isNative(Proxy);
  1838. if (hasProxy) {
  1839. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  1840. config.keyCodes = new Proxy(config.keyCodes, {
  1841. set: function set (target, key, value) {
  1842. if (isBuiltInModifier(key)) {
  1843. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  1844. return false
  1845. } else {
  1846. target[key] = value;
  1847. return true
  1848. }
  1849. }
  1850. });
  1851. }
  1852. var hasHandler = {
  1853. has: function has (target, key) {
  1854. var has = key in target;
  1855. var isAllowed = allowedGlobals(key) ||
  1856. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  1857. if (!has && !isAllowed) {
  1858. if (key in target.$data) { warnReservedPrefix(target, key); }
  1859. else { warnNonPresent(target, key); }
  1860. }
  1861. return has || !isAllowed
  1862. }
  1863. };
  1864. var getHandler = {
  1865. get: function get (target, key) {
  1866. if (typeof key === 'string' && !(key in target)) {
  1867. if (key in target.$data) { warnReservedPrefix(target, key); }
  1868. else { warnNonPresent(target, key); }
  1869. }
  1870. return target[key]
  1871. }
  1872. };
  1873. initProxy = function initProxy (vm) {
  1874. if (hasProxy) {
  1875. // determine which proxy handler to use
  1876. var options = vm.$options;
  1877. var handlers = options.render && options.render._withStripped
  1878. ? getHandler
  1879. : hasHandler;
  1880. vm._renderProxy = new Proxy(vm, handlers);
  1881. } else {
  1882. vm._renderProxy = vm;
  1883. }
  1884. };
  1885. }
  1886. /* */
  1887. var seenObjects = new _Set();
  1888. /**
  1889. * Recursively traverse an object to evoke all converted
  1890. * getters, so that every nested property inside the object
  1891. * is collected as a "deep" dependency.
  1892. */
  1893. function traverse (val) {
  1894. _traverse(val, seenObjects);
  1895. seenObjects.clear();
  1896. }
  1897. function _traverse (val, seen) {
  1898. var i, keys;
  1899. var isA = Array.isArray(val);
  1900. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  1901. return
  1902. }
  1903. if (val.__ob__) {
  1904. var depId = val.__ob__.dep.id;
  1905. if (seen.has(depId)) {
  1906. return
  1907. }
  1908. seen.add(depId);
  1909. }
  1910. if (isA) {
  1911. i = val.length;
  1912. while (i--) { _traverse(val[i], seen); }
  1913. } else {
  1914. keys = Object.keys(val);
  1915. i = keys.length;
  1916. while (i--) { _traverse(val[keys[i]], seen); }
  1917. }
  1918. }
  1919. var mark;
  1920. var measure;
  1921. {
  1922. var perf = inBrowser && window.performance;
  1923. /* istanbul ignore if */
  1924. if (
  1925. perf &&
  1926. perf.mark &&
  1927. perf.measure &&
  1928. perf.clearMarks &&
  1929. perf.clearMeasures
  1930. ) {
  1931. mark = function (tag) { return perf.mark(tag); };
  1932. measure = function (name, startTag, endTag) {
  1933. perf.measure(name, startTag, endTag);
  1934. perf.clearMarks(startTag);
  1935. perf.clearMarks(endTag);
  1936. // perf.clearMeasures(name)
  1937. };
  1938. }
  1939. }
  1940. /* */
  1941. var normalizeEvent = cached(function (name) {
  1942. var passive = name.charAt(0) === '&';
  1943. name = passive ? name.slice(1) : name;
  1944. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  1945. name = once$$1 ? name.slice(1) : name;
  1946. var capture = name.charAt(0) === '!';
  1947. name = capture ? name.slice(1) : name;
  1948. return {
  1949. name: name,
  1950. once: once$$1,
  1951. capture: capture,
  1952. passive: passive
  1953. }
  1954. });
  1955. function createFnInvoker (fns, vm) {
  1956. function invoker () {
  1957. var arguments$1 = arguments;
  1958. var fns = invoker.fns;
  1959. if (Array.isArray(fns)) {
  1960. var cloned = fns.slice();
  1961. for (var i = 0; i < cloned.length; i++) {
  1962. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  1963. }
  1964. } else {
  1965. // return handler return value for single handlers
  1966. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  1967. }
  1968. }
  1969. invoker.fns = fns;
  1970. return invoker
  1971. }
  1972. function updateListeners (
  1973. on,
  1974. oldOn,
  1975. add,
  1976. remove$$1,
  1977. createOnceHandler,
  1978. vm
  1979. ) {
  1980. var name, def$$1, cur, old, event;
  1981. for (name in on) {
  1982. def$$1 = cur = on[name];
  1983. old = oldOn[name];
  1984. event = normalizeEvent(name);
  1985. if (isUndef(cur)) {
  1986. warn(
  1987. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  1988. vm
  1989. );
  1990. } else if (isUndef(old)) {
  1991. if (isUndef(cur.fns)) {
  1992. cur = on[name] = createFnInvoker(cur, vm);
  1993. }
  1994. if (isTrue(event.once)) {
  1995. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  1996. }
  1997. add(event.name, cur, event.capture, event.passive, event.params);
  1998. } else if (cur !== old) {
  1999. old.fns = cur;
  2000. on[name] = old;
  2001. }
  2002. }
  2003. for (name in oldOn) {
  2004. if (isUndef(on[name])) {
  2005. event = normalizeEvent(name);
  2006. remove$$1(event.name, oldOn[name], event.capture);
  2007. }
  2008. }
  2009. }
  2010. /* */
  2011. function mergeVNodeHook (def, hookKey, hook) {
  2012. if (def instanceof VNode) {
  2013. def = def.data.hook || (def.data.hook = {});
  2014. }
  2015. var invoker;
  2016. var oldHook = def[hookKey];
  2017. function wrappedHook () {
  2018. hook.apply(this, arguments);
  2019. // important: remove merged hook to ensure it's called only once
  2020. // and prevent memory leak
  2021. remove(invoker.fns, wrappedHook);
  2022. }
  2023. if (isUndef(oldHook)) {
  2024. // no existing hook
  2025. invoker = createFnInvoker([wrappedHook]);
  2026. } else {
  2027. /* istanbul ignore if */
  2028. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  2029. // already a merged invoker
  2030. invoker = oldHook;
  2031. invoker.fns.push(wrappedHook);
  2032. } else {
  2033. // existing plain hook
  2034. invoker = createFnInvoker([oldHook, wrappedHook]);
  2035. }
  2036. }
  2037. invoker.merged = true;
  2038. def[hookKey] = invoker;
  2039. }
  2040. /* */
  2041. // fixed by xxxxxx (mp properties)
  2042. function extractPropertiesFromVNodeData(data, Ctor, res, context) {
  2043. var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties;
  2044. if (isUndef(propOptions)) {
  2045. return res
  2046. }
  2047. var externalClasses = Ctor.options.mpOptions.externalClasses || [];
  2048. var attrs = data.attrs;
  2049. var props = data.props;
  2050. if (isDef(attrs) || isDef(props)) {
  2051. for (var key in propOptions) {
  2052. var altKey = hyphenate(key);
  2053. var result = checkProp(res, props, key, altKey, true) ||
  2054. checkProp(res, attrs, key, altKey, false);
  2055. // externalClass
  2056. if (
  2057. result &&
  2058. res[key] &&
  2059. externalClasses.indexOf(altKey) !== -1 &&
  2060. context[camelize(res[key])]
  2061. ) {
  2062. // 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串)
  2063. res[key] = context[camelize(res[key])];
  2064. }
  2065. }
  2066. }
  2067. return res
  2068. }
  2069. function extractPropsFromVNodeData (
  2070. data,
  2071. Ctor,
  2072. tag,
  2073. context// fixed by xxxxxx
  2074. ) {
  2075. // we are only extracting raw values here.
  2076. // validation and default values are handled in the child
  2077. // component itself.
  2078. var propOptions = Ctor.options.props;
  2079. if (isUndef(propOptions)) {
  2080. // fixed by xxxxxx
  2081. return extractPropertiesFromVNodeData(data, Ctor, {}, context)
  2082. }
  2083. var res = {};
  2084. var attrs = data.attrs;
  2085. var props = data.props;
  2086. if (isDef(attrs) || isDef(props)) {
  2087. for (var key in propOptions) {
  2088. var altKey = hyphenate(key);
  2089. {
  2090. var keyInLowerCase = key.toLowerCase();
  2091. if (
  2092. key !== keyInLowerCase &&
  2093. attrs && hasOwn(attrs, keyInLowerCase)
  2094. ) {
  2095. tip(
  2096. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  2097. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  2098. " \"" + key + "\". " +
  2099. "Note that HTML attributes are case-insensitive and camelCased " +
  2100. "props need to use their kebab-case equivalents when using in-DOM " +
  2101. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  2102. );
  2103. }
  2104. }
  2105. checkProp(res, props, key, altKey, true) ||
  2106. checkProp(res, attrs, key, altKey, false);
  2107. }
  2108. }
  2109. // fixed by xxxxxx
  2110. return extractPropertiesFromVNodeData(data, Ctor, res, context)
  2111. }
  2112. function checkProp (
  2113. res,
  2114. hash,
  2115. key,
  2116. altKey,
  2117. preserve
  2118. ) {
  2119. if (isDef(hash)) {
  2120. if (hasOwn(hash, key)) {
  2121. res[key] = hash[key];
  2122. if (!preserve) {
  2123. delete hash[key];
  2124. }
  2125. return true
  2126. } else if (hasOwn(hash, altKey)) {
  2127. res[key] = hash[altKey];
  2128. if (!preserve) {
  2129. delete hash[altKey];
  2130. }
  2131. return true
  2132. }
  2133. }
  2134. return false
  2135. }
  2136. /* */
  2137. // The template compiler attempts to minimize the need for normalization by
  2138. // statically analyzing the template at compile time.
  2139. //
  2140. // For plain HTML markup, normalization can be completely skipped because the
  2141. // generated render function is guaranteed to return Array<VNode>. There are
  2142. // two cases where extra normalization is needed:
  2143. // 1. When the children contains components - because a functional component
  2144. // may return an Array instead of a single root. In this case, just a simple
  2145. // normalization is needed - if any child is an Array, we flatten the whole
  2146. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  2147. // because functional components already normalize their own children.
  2148. function simpleNormalizeChildren (children) {
  2149. for (var i = 0; i < children.length; i++) {
  2150. if (Array.isArray(children[i])) {
  2151. return Array.prototype.concat.apply([], children)
  2152. }
  2153. }
  2154. return children
  2155. }
  2156. // 2. When the children contains constructs that always generated nested Arrays,
  2157. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  2158. // with hand-written render functions / JSX. In such cases a full normalization
  2159. // is needed to cater to all possible types of children values.
  2160. function normalizeChildren (children) {
  2161. return isPrimitive(children)
  2162. ? [createTextVNode(children)]
  2163. : Array.isArray(children)
  2164. ? normalizeArrayChildren(children)
  2165. : undefined
  2166. }
  2167. function isTextNode (node) {
  2168. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  2169. }
  2170. function normalizeArrayChildren (children, nestedIndex) {
  2171. var res = [];
  2172. var i, c, lastIndex, last;
  2173. for (i = 0; i < children.length; i++) {
  2174. c = children[i];
  2175. if (isUndef(c) || typeof c === 'boolean') { continue }
  2176. lastIndex = res.length - 1;
  2177. last = res[lastIndex];
  2178. // nested
  2179. if (Array.isArray(c)) {
  2180. if (c.length > 0) {
  2181. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  2182. // merge adjacent text nodes
  2183. if (isTextNode(c[0]) && isTextNode(last)) {
  2184. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  2185. c.shift();
  2186. }
  2187. res.push.apply(res, c);
  2188. }
  2189. } else if (isPrimitive(c)) {
  2190. if (isTextNode(last)) {
  2191. // merge adjacent text nodes
  2192. // this is necessary for SSR hydration because text nodes are
  2193. // essentially merged when rendered to HTML strings
  2194. res[lastIndex] = createTextVNode(last.text + c);
  2195. } else if (c !== '') {
  2196. // convert primitive to vnode
  2197. res.push(createTextVNode(c));
  2198. }
  2199. } else {
  2200. if (isTextNode(c) && isTextNode(last)) {
  2201. // merge adjacent text nodes
  2202. res[lastIndex] = createTextVNode(last.text + c.text);
  2203. } else {
  2204. // default key for nested array children (likely generated by v-for)
  2205. if (isTrue(children._isVList) &&
  2206. isDef(c.tag) &&
  2207. isUndef(c.key) &&
  2208. isDef(nestedIndex)) {
  2209. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  2210. }
  2211. res.push(c);
  2212. }
  2213. }
  2214. }
  2215. return res
  2216. }
  2217. /* */
  2218. function initProvide (vm) {
  2219. var provide = vm.$options.provide;
  2220. if (provide) {
  2221. vm._provided = typeof provide === 'function'
  2222. ? provide.call(vm)
  2223. : provide;
  2224. }
  2225. }
  2226. function initInjections (vm) {
  2227. var result = resolveInject(vm.$options.inject, vm);
  2228. if (result) {
  2229. toggleObserving(false);
  2230. Object.keys(result).forEach(function (key) {
  2231. /* istanbul ignore else */
  2232. {
  2233. defineReactive$$1(vm, key, result[key], function () {
  2234. warn(
  2235. "Avoid mutating an injected value directly since the changes will be " +
  2236. "overwritten whenever the provided component re-renders. " +
  2237. "injection being mutated: \"" + key + "\"",
  2238. vm
  2239. );
  2240. });
  2241. }
  2242. });
  2243. toggleObserving(true);
  2244. }
  2245. }
  2246. function resolveInject (inject, vm) {
  2247. if (inject) {
  2248. // inject is :any because flow is not smart enough to figure out cached
  2249. var result = Object.create(null);
  2250. var keys = hasSymbol
  2251. ? Reflect.ownKeys(inject)
  2252. : Object.keys(inject);
  2253. for (var i = 0; i < keys.length; i++) {
  2254. var key = keys[i];
  2255. // #6574 in case the inject object is observed...
  2256. if (key === '__ob__') { continue }
  2257. var provideKey = inject[key].from;
  2258. var source = vm;
  2259. while (source) {
  2260. if (source._provided && hasOwn(source._provided, provideKey)) {
  2261. result[key] = source._provided[provideKey];
  2262. break
  2263. }
  2264. source = source.$parent;
  2265. }
  2266. if (!source) {
  2267. if ('default' in inject[key]) {
  2268. var provideDefault = inject[key].default;
  2269. result[key] = typeof provideDefault === 'function'
  2270. ? provideDefault.call(vm)
  2271. : provideDefault;
  2272. } else {
  2273. warn(("Injection \"" + key + "\" not found"), vm);
  2274. }
  2275. }
  2276. }
  2277. return result
  2278. }
  2279. }
  2280. /* */
  2281. /**
  2282. * Runtime helper for resolving raw children VNodes into a slot object.
  2283. */
  2284. function resolveSlots (
  2285. children,
  2286. context
  2287. ) {
  2288. if (!children || !children.length) {
  2289. return {}
  2290. }
  2291. var slots = {};
  2292. for (var i = 0, l = children.length; i < l; i++) {
  2293. var child = children[i];
  2294. var data = child.data;
  2295. // remove slot attribute if the node is resolved as a Vue slot node
  2296. if (data && data.attrs && data.attrs.slot) {
  2297. delete data.attrs.slot;
  2298. }
  2299. // named slots should only be respected if the vnode was rendered in the
  2300. // same context.
  2301. if ((child.context === context || child.fnContext === context) &&
  2302. data && data.slot != null
  2303. ) {
  2304. var name = data.slot;
  2305. var slot = (slots[name] || (slots[name] = []));
  2306. if (child.tag === 'template') {
  2307. slot.push.apply(slot, child.children || []);
  2308. } else {
  2309. slot.push(child);
  2310. }
  2311. } else {
  2312. (slots.default || (slots.default = [])).push(child);
  2313. }
  2314. }
  2315. // ignore slots that contains only whitespace
  2316. for (var name$1 in slots) {
  2317. if (slots[name$1].every(isWhitespace)) {
  2318. delete slots[name$1];
  2319. }
  2320. }
  2321. return slots
  2322. }
  2323. function isWhitespace (node) {
  2324. return (node.isComment && !node.asyncFactory) || node.text === ' '
  2325. }
  2326. /* */
  2327. function normalizeScopedSlots (
  2328. slots,
  2329. normalSlots,
  2330. prevSlots
  2331. ) {
  2332. var res;
  2333. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  2334. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  2335. var key = slots && slots.$key;
  2336. if (!slots) {
  2337. res = {};
  2338. } else if (slots._normalized) {
  2339. // fast path 1: child component re-render only, parent did not change
  2340. return slots._normalized
  2341. } else if (
  2342. isStable &&
  2343. prevSlots &&
  2344. prevSlots !== emptyObject &&
  2345. key === prevSlots.$key &&
  2346. !hasNormalSlots &&
  2347. !prevSlots.$hasNormal
  2348. ) {
  2349. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  2350. // only need to normalize once
  2351. return prevSlots
  2352. } else {
  2353. res = {};
  2354. for (var key$1 in slots) {
  2355. if (slots[key$1] && key$1[0] !== '$') {
  2356. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  2357. }
  2358. }
  2359. }
  2360. // expose normal slots on scopedSlots
  2361. for (var key$2 in normalSlots) {
  2362. if (!(key$2 in res)) {
  2363. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  2364. }
  2365. }
  2366. // avoriaz seems to mock a non-extensible $scopedSlots object
  2367. // and when that is passed down this would cause an error
  2368. if (slots && Object.isExtensible(slots)) {
  2369. (slots)._normalized = res;
  2370. }
  2371. def(res, '$stable', isStable);
  2372. def(res, '$key', key);
  2373. def(res, '$hasNormal', hasNormalSlots);
  2374. return res
  2375. }
  2376. function normalizeScopedSlot(normalSlots, key, fn) {
  2377. var normalized = function () {
  2378. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  2379. res = res && typeof res === 'object' && !Array.isArray(res)
  2380. ? [res] // single vnode
  2381. : normalizeChildren(res);
  2382. return res && (
  2383. res.length === 0 ||
  2384. (res.length === 1 && res[0].isComment) // #9658
  2385. ) ? undefined
  2386. : res
  2387. };
  2388. // this is a slot using the new v-slot syntax without scope. although it is
  2389. // compiled as a scoped slot, render fn users would expect it to be present
  2390. // on this.$slots because the usage is semantically a normal slot.
  2391. if (fn.proxy) {
  2392. Object.defineProperty(normalSlots, key, {
  2393. get: normalized,
  2394. enumerable: true,
  2395. configurable: true
  2396. });
  2397. }
  2398. return normalized
  2399. }
  2400. function proxyNormalSlot(slots, key) {
  2401. return function () { return slots[key]; }
  2402. }
  2403. /* */
  2404. /**
  2405. * Runtime helper for rendering v-for lists.
  2406. */
  2407. function renderList (
  2408. val,
  2409. render
  2410. ) {
  2411. var ret, i, l, keys, key;
  2412. if (Array.isArray(val) || typeof val === 'string') {
  2413. ret = new Array(val.length);
  2414. for (i = 0, l = val.length; i < l; i++) {
  2415. ret[i] = render(val[i], i, i, i);
  2416. }
  2417. } else if (typeof val === 'number') {
  2418. ret = new Array(val);
  2419. for (i = 0; i < val; i++) {
  2420. ret[i] = render(i + 1, i, i, i);
  2421. }
  2422. } else if (isObject(val)) {
  2423. if (hasSymbol && val[Symbol.iterator]) {
  2424. ret = [];
  2425. var iterator = val[Symbol.iterator]();
  2426. var result = iterator.next();
  2427. i = 0;
  2428. while (!result.done) {
  2429. ret.push(render(result.value, ret.length, i++, i));
  2430. result = iterator.next();
  2431. }
  2432. } else {
  2433. keys = Object.keys(val);
  2434. ret = new Array(keys.length);
  2435. for (i = 0, l = keys.length; i < l; i++) {
  2436. key = keys[i];
  2437. ret[i] = render(val[key], key, i, i);
  2438. }
  2439. }
  2440. }
  2441. if (!isDef(ret)) {
  2442. ret = [];
  2443. }
  2444. (ret)._isVList = true;
  2445. return ret
  2446. }
  2447. /* */
  2448. /**
  2449. * Runtime helper for rendering <slot>
  2450. */
  2451. function renderSlot (
  2452. name,
  2453. fallback,
  2454. props,
  2455. bindObject
  2456. ) {
  2457. var scopedSlotFn = this.$scopedSlots[name];
  2458. var nodes;
  2459. if (scopedSlotFn) { // scoped slot
  2460. props = props || {};
  2461. if (bindObject) {
  2462. if (!isObject(bindObject)) {
  2463. warn(
  2464. 'slot v-bind without argument expects an Object',
  2465. this
  2466. );
  2467. }
  2468. props = extend(extend({}, bindObject), props);
  2469. }
  2470. // fixed by xxxxxx app-plus scopedSlot
  2471. nodes = scopedSlotFn(props, this, props._i) || fallback;
  2472. } else {
  2473. nodes = this.$slots[name] || fallback;
  2474. }
  2475. var target = props && props.slot;
  2476. if (target) {
  2477. return this.$createElement('template', { slot: target }, nodes)
  2478. } else {
  2479. return nodes
  2480. }
  2481. }
  2482. /* */
  2483. /**
  2484. * Runtime helper for resolving filters
  2485. */
  2486. function resolveFilter (id) {
  2487. return resolveAsset(this.$options, 'filters', id, true) || identity
  2488. }
  2489. /* */
  2490. function isKeyNotMatch (expect, actual) {
  2491. if (Array.isArray(expect)) {
  2492. return expect.indexOf(actual) === -1
  2493. } else {
  2494. return expect !== actual
  2495. }
  2496. }
  2497. /**
  2498. * Runtime helper for checking keyCodes from config.
  2499. * exposed as Vue.prototype._k
  2500. * passing in eventKeyName as last argument separately for backwards compat
  2501. */
  2502. function checkKeyCodes (
  2503. eventKeyCode,
  2504. key,
  2505. builtInKeyCode,
  2506. eventKeyName,
  2507. builtInKeyName
  2508. ) {
  2509. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  2510. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  2511. return isKeyNotMatch(builtInKeyName, eventKeyName)
  2512. } else if (mappedKeyCode) {
  2513. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  2514. } else if (eventKeyName) {
  2515. return hyphenate(eventKeyName) !== key
  2516. }
  2517. }
  2518. /* */
  2519. /**
  2520. * Runtime helper for merging v-bind="object" into a VNode's data.
  2521. */
  2522. function bindObjectProps (
  2523. data,
  2524. tag,
  2525. value,
  2526. asProp,
  2527. isSync
  2528. ) {
  2529. if (value) {
  2530. if (!isObject(value)) {
  2531. warn(
  2532. 'v-bind without argument expects an Object or Array value',
  2533. this
  2534. );
  2535. } else {
  2536. if (Array.isArray(value)) {
  2537. value = toObject(value);
  2538. }
  2539. var hash;
  2540. var loop = function ( key ) {
  2541. if (
  2542. key === 'class' ||
  2543. key === 'style' ||
  2544. isReservedAttribute(key)
  2545. ) {
  2546. hash = data;
  2547. } else {
  2548. var type = data.attrs && data.attrs.type;
  2549. hash = asProp || config.mustUseProp(tag, type, key)
  2550. ? data.domProps || (data.domProps = {})
  2551. : data.attrs || (data.attrs = {});
  2552. }
  2553. var camelizedKey = camelize(key);
  2554. var hyphenatedKey = hyphenate(key);
  2555. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  2556. hash[key] = value[key];
  2557. if (isSync) {
  2558. var on = data.on || (data.on = {});
  2559. on[("update:" + key)] = function ($event) {
  2560. value[key] = $event;
  2561. };
  2562. }
  2563. }
  2564. };
  2565. for (var key in value) loop( key );
  2566. }
  2567. }
  2568. return data
  2569. }
  2570. /* */
  2571. /**
  2572. * Runtime helper for rendering static trees.
  2573. */
  2574. function renderStatic (
  2575. index,
  2576. isInFor
  2577. ) {
  2578. var cached = this._staticTrees || (this._staticTrees = []);
  2579. var tree = cached[index];
  2580. // if has already-rendered static tree and not inside v-for,
  2581. // we can reuse the same tree.
  2582. if (tree && !isInFor) {
  2583. return tree
  2584. }
  2585. // otherwise, render a fresh tree.
  2586. tree = cached[index] = this.$options.staticRenderFns[index].call(
  2587. this._renderProxy,
  2588. null,
  2589. this // for render fns generated for functional component templates
  2590. );
  2591. markStatic(tree, ("__static__" + index), false);
  2592. return tree
  2593. }
  2594. /**
  2595. * Runtime helper for v-once.
  2596. * Effectively it means marking the node as static with a unique key.
  2597. */
  2598. function markOnce (
  2599. tree,
  2600. index,
  2601. key
  2602. ) {
  2603. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  2604. return tree
  2605. }
  2606. function markStatic (
  2607. tree,
  2608. key,
  2609. isOnce
  2610. ) {
  2611. if (Array.isArray(tree)) {
  2612. for (var i = 0; i < tree.length; i++) {
  2613. if (tree[i] && typeof tree[i] !== 'string') {
  2614. markStaticNode(tree[i], (key + "_" + i), isOnce);
  2615. }
  2616. }
  2617. } else {
  2618. markStaticNode(tree, key, isOnce);
  2619. }
  2620. }
  2621. function markStaticNode (node, key, isOnce) {
  2622. node.isStatic = true;
  2623. node.key = key;
  2624. node.isOnce = isOnce;
  2625. }
  2626. /* */
  2627. function bindObjectListeners (data, value) {
  2628. if (value) {
  2629. if (!isPlainObject(value)) {
  2630. warn(
  2631. 'v-on without argument expects an Object value',
  2632. this
  2633. );
  2634. } else {
  2635. var on = data.on = data.on ? extend({}, data.on) : {};
  2636. for (var key in value) {
  2637. var existing = on[key];
  2638. var ours = value[key];
  2639. on[key] = existing ? [].concat(existing, ours) : ours;
  2640. }
  2641. }
  2642. }
  2643. return data
  2644. }
  2645. /* */
  2646. function resolveScopedSlots (
  2647. fns, // see flow/vnode
  2648. res,
  2649. // the following are added in 2.6
  2650. hasDynamicKeys,
  2651. contentHashKey
  2652. ) {
  2653. res = res || { $stable: !hasDynamicKeys };
  2654. for (var i = 0; i < fns.length; i++) {
  2655. var slot = fns[i];
  2656. if (Array.isArray(slot)) {
  2657. resolveScopedSlots(slot, res, hasDynamicKeys);
  2658. } else if (slot) {
  2659. // marker for reverse proxying v-slot without scope on this.$slots
  2660. if (slot.proxy) {
  2661. slot.fn.proxy = true;
  2662. }
  2663. res[slot.key] = slot.fn;
  2664. }
  2665. }
  2666. if (contentHashKey) {
  2667. (res).$key = contentHashKey;
  2668. }
  2669. return res
  2670. }
  2671. /* */
  2672. function bindDynamicKeys (baseObj, values) {
  2673. for (var i = 0; i < values.length; i += 2) {
  2674. var key = values[i];
  2675. if (typeof key === 'string' && key) {
  2676. baseObj[values[i]] = values[i + 1];
  2677. } else if (key !== '' && key !== null) {
  2678. // null is a special value for explicitly removing a binding
  2679. warn(
  2680. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  2681. this
  2682. );
  2683. }
  2684. }
  2685. return baseObj
  2686. }
  2687. // helper to dynamically append modifier runtime markers to event names.
  2688. // ensure only append when value is already string, otherwise it will be cast
  2689. // to string and cause the type check to miss.
  2690. function prependModifier (value, symbol) {
  2691. return typeof value === 'string' ? symbol + value : value
  2692. }
  2693. /* */
  2694. function installRenderHelpers (target) {
  2695. target._o = markOnce;
  2696. target._n = toNumber;
  2697. target._s = toString;
  2698. target._l = renderList;
  2699. target._t = renderSlot;
  2700. target._q = looseEqual;
  2701. target._i = looseIndexOf;
  2702. target._m = renderStatic;
  2703. target._f = resolveFilter;
  2704. target._k = checkKeyCodes;
  2705. target._b = bindObjectProps;
  2706. target._v = createTextVNode;
  2707. target._e = createEmptyVNode;
  2708. target._u = resolveScopedSlots;
  2709. target._g = bindObjectListeners;
  2710. target._d = bindDynamicKeys;
  2711. target._p = prependModifier;
  2712. }
  2713. /* */
  2714. function FunctionalRenderContext (
  2715. data,
  2716. props,
  2717. children,
  2718. parent,
  2719. Ctor
  2720. ) {
  2721. var this$1 = this;
  2722. var options = Ctor.options;
  2723. // ensure the createElement function in functional components
  2724. // gets a unique context - this is necessary for correct named slot check
  2725. var contextVm;
  2726. if (hasOwn(parent, '_uid')) {
  2727. contextVm = Object.create(parent);
  2728. // $flow-disable-line
  2729. contextVm._original = parent;
  2730. } else {
  2731. // the context vm passed in is a functional context as well.
  2732. // in this case we want to make sure we are able to get a hold to the
  2733. // real context instance.
  2734. contextVm = parent;
  2735. // $flow-disable-line
  2736. parent = parent._original;
  2737. }
  2738. var isCompiled = isTrue(options._compiled);
  2739. var needNormalization = !isCompiled;
  2740. this.data = data;
  2741. this.props = props;
  2742. this.children = children;
  2743. this.parent = parent;
  2744. this.listeners = data.on || emptyObject;
  2745. this.injections = resolveInject(options.inject, parent);
  2746. this.slots = function () {
  2747. if (!this$1.$slots) {
  2748. normalizeScopedSlots(
  2749. data.scopedSlots,
  2750. this$1.$slots = resolveSlots(children, parent)
  2751. );
  2752. }
  2753. return this$1.$slots
  2754. };
  2755. Object.defineProperty(this, 'scopedSlots', ({
  2756. enumerable: true,
  2757. get: function get () {
  2758. return normalizeScopedSlots(data.scopedSlots, this.slots())
  2759. }
  2760. }));
  2761. // support for compiled functional template
  2762. if (isCompiled) {
  2763. // exposing $options for renderStatic()
  2764. this.$options = options;
  2765. // pre-resolve slots for renderSlot()
  2766. this.$slots = this.slots();
  2767. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  2768. }
  2769. if (options._scopeId) {
  2770. this._c = function (a, b, c, d) {
  2771. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  2772. if (vnode && !Array.isArray(vnode)) {
  2773. vnode.fnScopeId = options._scopeId;
  2774. vnode.fnContext = parent;
  2775. }
  2776. return vnode
  2777. };
  2778. } else {
  2779. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  2780. }
  2781. }
  2782. installRenderHelpers(FunctionalRenderContext.prototype);
  2783. function createFunctionalComponent (
  2784. Ctor,
  2785. propsData,
  2786. data,
  2787. contextVm,
  2788. children
  2789. ) {
  2790. var options = Ctor.options;
  2791. var props = {};
  2792. var propOptions = options.props;
  2793. if (isDef(propOptions)) {
  2794. for (var key in propOptions) {
  2795. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  2796. }
  2797. } else {
  2798. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  2799. if (isDef(data.props)) { mergeProps(props, data.props); }
  2800. }
  2801. var renderContext = new FunctionalRenderContext(
  2802. data,
  2803. props,
  2804. children,
  2805. contextVm,
  2806. Ctor
  2807. );
  2808. var vnode = options.render.call(null, renderContext._c, renderContext);
  2809. if (vnode instanceof VNode) {
  2810. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  2811. } else if (Array.isArray(vnode)) {
  2812. var vnodes = normalizeChildren(vnode) || [];
  2813. var res = new Array(vnodes.length);
  2814. for (var i = 0; i < vnodes.length; i++) {
  2815. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  2816. }
  2817. return res
  2818. }
  2819. }
  2820. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  2821. // #7817 clone node before setting fnContext, otherwise if the node is reused
  2822. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  2823. // that should not be matched to match.
  2824. var clone = cloneVNode(vnode);
  2825. clone.fnContext = contextVm;
  2826. clone.fnOptions = options;
  2827. {
  2828. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  2829. }
  2830. if (data.slot) {
  2831. (clone.data || (clone.data = {})).slot = data.slot;
  2832. }
  2833. return clone
  2834. }
  2835. function mergeProps (to, from) {
  2836. for (var key in from) {
  2837. to[camelize(key)] = from[key];
  2838. }
  2839. }
  2840. /* */
  2841. /* */
  2842. /* */
  2843. /* */
  2844. // inline hooks to be invoked on component VNodes during patch
  2845. var componentVNodeHooks = {
  2846. init: function init (vnode, hydrating) {
  2847. if (
  2848. vnode.componentInstance &&
  2849. !vnode.componentInstance._isDestroyed &&
  2850. vnode.data.keepAlive
  2851. ) {
  2852. // kept-alive components, treat as a patch
  2853. var mountedNode = vnode; // work around flow
  2854. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  2855. } else {
  2856. var child = vnode.componentInstance = createComponentInstanceForVnode(
  2857. vnode,
  2858. activeInstance
  2859. );
  2860. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  2861. }
  2862. },
  2863. prepatch: function prepatch (oldVnode, vnode) {
  2864. var options = vnode.componentOptions;
  2865. var child = vnode.componentInstance = oldVnode.componentInstance;
  2866. updateChildComponent(
  2867. child,
  2868. options.propsData, // updated props
  2869. options.listeners, // updated listeners
  2870. vnode, // new parent vnode
  2871. options.children // new children
  2872. );
  2873. },
  2874. insert: function insert (vnode) {
  2875. var context = vnode.context;
  2876. var componentInstance = vnode.componentInstance;
  2877. if (!componentInstance._isMounted) {
  2878. // fixed by xxxxxx
  2879. componentInstance._isMounted = true;
  2880. if (componentInstance._$vd) {// 延迟 mounted
  2881. callHook(componentInstance, 'onServiceCreated');
  2882. callHook(componentInstance, 'onServiceAttached');
  2883. componentInstance._$vd.addMountedVm(componentInstance);
  2884. } else {
  2885. callHook(componentInstance, 'mounted');
  2886. }
  2887. }
  2888. if (vnode.data.keepAlive) {
  2889. if (context._isMounted) {
  2890. // vue-router#1212
  2891. // During updates, a kept-alive component's child components may
  2892. // change, so directly walking the tree here may call activated hooks
  2893. // on incorrect children. Instead we push them into a queue which will
  2894. // be processed after the whole patch process ended.
  2895. queueActivatedComponent(componentInstance);
  2896. } else {
  2897. activateChildComponent(componentInstance, true /* direct */);
  2898. }
  2899. }
  2900. },
  2901. destroy: function destroy (vnode) {
  2902. var componentInstance = vnode.componentInstance;
  2903. if (!componentInstance._isDestroyed) {
  2904. if (!vnode.data.keepAlive) {
  2905. componentInstance.$destroy();
  2906. } else {
  2907. deactivateChildComponent(componentInstance, true /* direct */);
  2908. }
  2909. }
  2910. }
  2911. };
  2912. var hooksToMerge = Object.keys(componentVNodeHooks);
  2913. function createComponent (
  2914. Ctor,
  2915. data,
  2916. context,
  2917. children,
  2918. tag
  2919. ) {
  2920. if (isUndef(Ctor)) {
  2921. return
  2922. }
  2923. var baseCtor = context.$options._base;
  2924. // plain options object: turn it into a constructor
  2925. if (isObject(Ctor)) {
  2926. Ctor = baseCtor.extend(Ctor);
  2927. }
  2928. // if at this stage it's not a constructor or an async component factory,
  2929. // reject.
  2930. if (typeof Ctor !== 'function') {
  2931. {
  2932. warn(("Invalid Component definition: " + (String(Ctor))), context);
  2933. }
  2934. return
  2935. }
  2936. // async component
  2937. var asyncFactory;
  2938. if (isUndef(Ctor.cid)) {
  2939. asyncFactory = Ctor;
  2940. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  2941. if (Ctor === undefined) {
  2942. // return a placeholder node for async component, which is rendered
  2943. // as a comment node but preserves all the raw information for the node.
  2944. // the information will be used for async server-rendering and hydration.
  2945. return createAsyncPlaceholder(
  2946. asyncFactory,
  2947. data,
  2948. context,
  2949. children,
  2950. tag
  2951. )
  2952. }
  2953. }
  2954. data = data || {};
  2955. // resolve constructor options in case global mixins are applied after
  2956. // component constructor creation
  2957. resolveConstructorOptions(Ctor);
  2958. // transform component v-model data into props & events
  2959. if (isDef(data.model)) {
  2960. transformModel(Ctor.options, data);
  2961. }
  2962. // extract props
  2963. var propsData = extractPropsFromVNodeData(data, Ctor, tag, context); // fixed by xxxxxx
  2964. // functional component
  2965. if (isTrue(Ctor.options.functional)) {
  2966. return createFunctionalComponent(Ctor, propsData, data, context, children)
  2967. }
  2968. // extract listeners, since these needs to be treated as
  2969. // child component listeners instead of DOM listeners
  2970. var listeners = data.on;
  2971. // replace with listeners with .native modifier
  2972. // so it gets processed during parent component patch.
  2973. data.on = data.nativeOn;
  2974. if (isTrue(Ctor.options.abstract)) {
  2975. // abstract components do not keep anything
  2976. // other than props & listeners & slot
  2977. // work around flow
  2978. var slot = data.slot;
  2979. data = {};
  2980. if (slot) {
  2981. data.slot = slot;
  2982. }
  2983. }
  2984. // install component management hooks onto the placeholder node
  2985. installComponentHooks(data);
  2986. // return a placeholder vnode
  2987. var name = Ctor.options.name || tag;
  2988. var vnode = new VNode(
  2989. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  2990. data, undefined, undefined, undefined, context,
  2991. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  2992. asyncFactory
  2993. );
  2994. return vnode
  2995. }
  2996. function createComponentInstanceForVnode (
  2997. vnode, // we know it's MountedComponentVNode but flow doesn't
  2998. parent // activeInstance in lifecycle state
  2999. ) {
  3000. var options = {
  3001. _isComponent: true,
  3002. _parentVnode: vnode,
  3003. parent: parent
  3004. };
  3005. // check inline-template render functions
  3006. var inlineTemplate = vnode.data.inlineTemplate;
  3007. if (isDef(inlineTemplate)) {
  3008. options.render = inlineTemplate.render;
  3009. options.staticRenderFns = inlineTemplate.staticRenderFns;
  3010. }
  3011. return new vnode.componentOptions.Ctor(options)
  3012. }
  3013. function installComponentHooks (data) {
  3014. var hooks = data.hook || (data.hook = {});
  3015. for (var i = 0; i < hooksToMerge.length; i++) {
  3016. var key = hooksToMerge[i];
  3017. var existing = hooks[key];
  3018. var toMerge = componentVNodeHooks[key];
  3019. if (existing !== toMerge && !(existing && existing._merged)) {
  3020. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  3021. }
  3022. }
  3023. }
  3024. function mergeHook$1 (f1, f2) {
  3025. var merged = function (a, b) {
  3026. // flow complains about extra args which is why we use any
  3027. f1(a, b);
  3028. f2(a, b);
  3029. };
  3030. merged._merged = true;
  3031. return merged
  3032. }
  3033. // transform component v-model info (value and callback) into
  3034. // prop and event handler respectively.
  3035. function transformModel (options, data) {
  3036. var prop = (options.model && options.model.prop) || 'value';
  3037. var event = (options.model && options.model.event) || 'input'
  3038. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  3039. var on = data.on || (data.on = {});
  3040. var existing = on[event];
  3041. var callback = data.model.callback;
  3042. if (isDef(existing)) {
  3043. if (
  3044. Array.isArray(existing)
  3045. ? existing.indexOf(callback) === -1
  3046. : existing !== callback
  3047. ) {
  3048. on[event] = [callback].concat(existing);
  3049. }
  3050. } else {
  3051. on[event] = callback;
  3052. }
  3053. }
  3054. /* */
  3055. var SIMPLE_NORMALIZE = 1;
  3056. var ALWAYS_NORMALIZE = 2;
  3057. // wrapper function for providing a more flexible interface
  3058. // without getting yelled at by flow
  3059. function createElement (
  3060. context,
  3061. tag,
  3062. data,
  3063. children,
  3064. normalizationType,
  3065. alwaysNormalize
  3066. ) {
  3067. if (Array.isArray(data) || isPrimitive(data)) {
  3068. normalizationType = children;
  3069. children = data;
  3070. data = undefined;
  3071. }
  3072. if (isTrue(alwaysNormalize)) {
  3073. normalizationType = ALWAYS_NORMALIZE;
  3074. }
  3075. return _createElement(context, tag, data, children, normalizationType)
  3076. }
  3077. function _createElement (
  3078. context,
  3079. tag,
  3080. data,
  3081. children,
  3082. normalizationType
  3083. ) {
  3084. if (isDef(data) && isDef((data).__ob__)) {
  3085. warn(
  3086. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  3087. 'Always create fresh vnode data objects in each render!',
  3088. context
  3089. );
  3090. return createEmptyVNode()
  3091. }
  3092. // object syntax in v-bind
  3093. if (isDef(data) && isDef(data.is)) {
  3094. tag = data.is;
  3095. }
  3096. if (!tag) {
  3097. // in case of component :is set to falsy value
  3098. return createEmptyVNode()
  3099. }
  3100. // warn against non-primitive key
  3101. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  3102. ) {
  3103. {
  3104. warn(
  3105. 'Avoid using non-primitive value as key, ' +
  3106. 'use string/number value instead.',
  3107. context
  3108. );
  3109. }
  3110. }
  3111. // support single function children as default scoped slot
  3112. if (Array.isArray(children) &&
  3113. typeof children[0] === 'function'
  3114. ) {
  3115. data = data || {};
  3116. data.scopedSlots = { default: children[0] };
  3117. children.length = 0;
  3118. }
  3119. if (normalizationType === ALWAYS_NORMALIZE) {
  3120. children = normalizeChildren(children);
  3121. } else if (normalizationType === SIMPLE_NORMALIZE) {
  3122. children = simpleNormalizeChildren(children);
  3123. }
  3124. var vnode, ns;
  3125. if (typeof tag === 'string') {
  3126. var Ctor;
  3127. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  3128. if (config.isReservedTag(tag)) {
  3129. // platform built-in elements
  3130. if (isDef(data) && isDef(data.nativeOn)) {
  3131. warn(
  3132. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  3133. context
  3134. );
  3135. }
  3136. vnode = new VNode(
  3137. config.parsePlatformTagName(tag), data, children,
  3138. undefined, undefined, context
  3139. );
  3140. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  3141. // component
  3142. vnode = createComponent(Ctor, data, context, children, tag);
  3143. } else {
  3144. // unknown or unlisted namespaced elements
  3145. // check at runtime because it may get assigned a namespace when its
  3146. // parent normalizes children
  3147. vnode = new VNode(
  3148. tag, data, children,
  3149. undefined, undefined, context
  3150. );
  3151. }
  3152. } else {
  3153. // direct component options / constructor
  3154. vnode = createComponent(tag, data, context, children);
  3155. }
  3156. if (Array.isArray(vnode)) {
  3157. return vnode
  3158. } else if (isDef(vnode)) {
  3159. if (isDef(ns)) { applyNS(vnode, ns); }
  3160. if (isDef(data)) { registerDeepBindings(data); }
  3161. return vnode
  3162. } else {
  3163. return createEmptyVNode()
  3164. }
  3165. }
  3166. function applyNS (vnode, ns, force) {
  3167. vnode.ns = ns;
  3168. if (vnode.tag === 'foreignObject') {
  3169. // use default namespace inside foreignObject
  3170. ns = undefined;
  3171. force = true;
  3172. }
  3173. if (isDef(vnode.children)) {
  3174. for (var i = 0, l = vnode.children.length; i < l; i++) {
  3175. var child = vnode.children[i];
  3176. if (isDef(child.tag) && (
  3177. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  3178. applyNS(child, ns, force);
  3179. }
  3180. }
  3181. }
  3182. }
  3183. // ref #5318
  3184. // necessary to ensure parent re-render when deep bindings like :style and
  3185. // :class are used on slot nodes
  3186. function registerDeepBindings (data) {
  3187. if (isObject(data.style)) {
  3188. traverse(data.style);
  3189. }
  3190. if (isObject(data.class)) {
  3191. traverse(data.class);
  3192. }
  3193. }
  3194. /* */
  3195. function initRender (vm) {
  3196. vm._vnode = null; // the root of the child tree
  3197. vm._staticTrees = null; // v-once cached trees
  3198. var options = vm.$options;
  3199. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  3200. var renderContext = parentVnode && parentVnode.context;
  3201. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  3202. vm.$scopedSlots = emptyObject;
  3203. // bind the createElement fn to this instance
  3204. // so that we get proper render context inside it.
  3205. // args order: tag, data, children, normalizationType, alwaysNormalize
  3206. // internal version is used by render functions compiled from templates
  3207. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  3208. // normalization is always applied for the public version, used in
  3209. // user-written render functions.
  3210. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  3211. // $attrs & $listeners are exposed for easier HOC creation.
  3212. // they need to be reactive so that HOCs using them are always updated
  3213. var parentData = parentVnode && parentVnode.data;
  3214. /* istanbul ignore else */
  3215. {
  3216. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  3217. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  3218. }, true);
  3219. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  3220. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  3221. }, true);
  3222. }
  3223. }
  3224. var currentRenderingInstance = null;
  3225. function renderMixin (Vue) {
  3226. // install runtime convenience helpers
  3227. installRenderHelpers(Vue.prototype);
  3228. Vue.prototype.$nextTick = function (fn) {
  3229. return nextTick(fn, this)
  3230. };
  3231. Vue.prototype._render = function () {
  3232. var vm = this;
  3233. var ref = vm.$options;
  3234. var render = ref.render;
  3235. var _parentVnode = ref._parentVnode;
  3236. if (_parentVnode) {
  3237. vm.$scopedSlots = normalizeScopedSlots(
  3238. _parentVnode.data.scopedSlots,
  3239. vm.$slots,
  3240. vm.$scopedSlots
  3241. );
  3242. }
  3243. // set parent vnode. this allows render functions to have access
  3244. // to the data on the placeholder node.
  3245. vm.$vnode = _parentVnode;
  3246. // render self
  3247. var vnode;
  3248. try {
  3249. // There's no need to maintain a stack because all render fns are called
  3250. // separately from one another. Nested component's render fns are called
  3251. // when parent component is patched.
  3252. currentRenderingInstance = vm;
  3253. vnode = render.call(vm._renderProxy, vm.$createElement);
  3254. } catch (e) {
  3255. handleError(e, vm, "render");
  3256. // return error render result,
  3257. // or previous vnode to prevent render error causing blank component
  3258. /* istanbul ignore else */
  3259. if (vm.$options.renderError) {
  3260. try {
  3261. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  3262. } catch (e) {
  3263. handleError(e, vm, "renderError");
  3264. vnode = vm._vnode;
  3265. }
  3266. } else {
  3267. vnode = vm._vnode;
  3268. }
  3269. } finally {
  3270. currentRenderingInstance = null;
  3271. }
  3272. // if the returned array contains only a single node, allow it
  3273. if (Array.isArray(vnode) && vnode.length === 1) {
  3274. vnode = vnode[0];
  3275. }
  3276. // return empty vnode in case the render function errored out
  3277. if (!(vnode instanceof VNode)) {
  3278. if (Array.isArray(vnode)) {
  3279. warn(
  3280. 'Multiple root nodes returned from render function. Render function ' +
  3281. 'should return a single root node.',
  3282. vm
  3283. );
  3284. }
  3285. vnode = createEmptyVNode();
  3286. }
  3287. // set parent
  3288. vnode.parent = _parentVnode;
  3289. return vnode
  3290. };
  3291. }
  3292. /* */
  3293. function ensureCtor (comp, base) {
  3294. if (
  3295. comp.__esModule ||
  3296. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  3297. ) {
  3298. comp = comp.default;
  3299. }
  3300. return isObject(comp)
  3301. ? base.extend(comp)
  3302. : comp
  3303. }
  3304. function createAsyncPlaceholder (
  3305. factory,
  3306. data,
  3307. context,
  3308. children,
  3309. tag
  3310. ) {
  3311. var node = createEmptyVNode();
  3312. node.asyncFactory = factory;
  3313. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  3314. return node
  3315. }
  3316. function resolveAsyncComponent (
  3317. factory,
  3318. baseCtor
  3319. ) {
  3320. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  3321. return factory.errorComp
  3322. }
  3323. if (isDef(factory.resolved)) {
  3324. return factory.resolved
  3325. }
  3326. var owner = currentRenderingInstance;
  3327. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  3328. // already pending
  3329. factory.owners.push(owner);
  3330. }
  3331. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  3332. return factory.loadingComp
  3333. }
  3334. if (owner && !isDef(factory.owners)) {
  3335. var owners = factory.owners = [owner];
  3336. var sync = true;
  3337. var timerLoading = null;
  3338. var timerTimeout = null
  3339. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  3340. var forceRender = function (renderCompleted) {
  3341. for (var i = 0, l = owners.length; i < l; i++) {
  3342. (owners[i]).$forceUpdate();
  3343. }
  3344. if (renderCompleted) {
  3345. owners.length = 0;
  3346. if (timerLoading !== null) {
  3347. clearTimeout(timerLoading);
  3348. timerLoading = null;
  3349. }
  3350. if (timerTimeout !== null) {
  3351. clearTimeout(timerTimeout);
  3352. timerTimeout = null;
  3353. }
  3354. }
  3355. };
  3356. var resolve = once(function (res) {
  3357. // cache resolved
  3358. factory.resolved = ensureCtor(res, baseCtor);
  3359. // invoke callbacks only if this is not a synchronous resolve
  3360. // (async resolves are shimmed as synchronous during SSR)
  3361. if (!sync) {
  3362. forceRender(true);
  3363. } else {
  3364. owners.length = 0;
  3365. }
  3366. });
  3367. var reject = once(function (reason) {
  3368. warn(
  3369. "Failed to resolve async component: " + (String(factory)) +
  3370. (reason ? ("\nReason: " + reason) : '')
  3371. );
  3372. if (isDef(factory.errorComp)) {
  3373. factory.error = true;
  3374. forceRender(true);
  3375. }
  3376. });
  3377. var res = factory(resolve, reject);
  3378. if (isObject(res)) {
  3379. if (isPromise(res)) {
  3380. // () => Promise
  3381. if (isUndef(factory.resolved)) {
  3382. res.then(resolve, reject);
  3383. }
  3384. } else if (isPromise(res.component)) {
  3385. res.component.then(resolve, reject);
  3386. if (isDef(res.error)) {
  3387. factory.errorComp = ensureCtor(res.error, baseCtor);
  3388. }
  3389. if (isDef(res.loading)) {
  3390. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  3391. if (res.delay === 0) {
  3392. factory.loading = true;
  3393. } else {
  3394. timerLoading = setTimeout(function () {
  3395. timerLoading = null;
  3396. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  3397. factory.loading = true;
  3398. forceRender(false);
  3399. }
  3400. }, res.delay || 200);
  3401. }
  3402. }
  3403. if (isDef(res.timeout)) {
  3404. timerTimeout = setTimeout(function () {
  3405. timerTimeout = null;
  3406. if (isUndef(factory.resolved)) {
  3407. reject(
  3408. "timeout (" + (res.timeout) + "ms)"
  3409. );
  3410. }
  3411. }, res.timeout);
  3412. }
  3413. }
  3414. }
  3415. sync = false;
  3416. // return in case resolved synchronously
  3417. return factory.loading
  3418. ? factory.loadingComp
  3419. : factory.resolved
  3420. }
  3421. }
  3422. /* */
  3423. function isAsyncPlaceholder (node) {
  3424. return node.isComment && node.asyncFactory
  3425. }
  3426. /* */
  3427. function getFirstComponentChild (children) {
  3428. if (Array.isArray(children)) {
  3429. for (var i = 0; i < children.length; i++) {
  3430. var c = children[i];
  3431. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  3432. return c
  3433. }
  3434. }
  3435. }
  3436. }
  3437. /* */
  3438. /* */
  3439. function initEvents (vm) {
  3440. vm._events = Object.create(null);
  3441. vm._hasHookEvent = false;
  3442. // init parent attached events
  3443. var listeners = vm.$options._parentListeners;
  3444. if (listeners) {
  3445. updateComponentListeners(vm, listeners);
  3446. }
  3447. }
  3448. var target;
  3449. function add (event, fn) {
  3450. target.$on(event, fn);
  3451. }
  3452. function remove$1 (event, fn) {
  3453. target.$off(event, fn);
  3454. }
  3455. function createOnceHandler (event, fn) {
  3456. var _target = target;
  3457. return function onceHandler () {
  3458. var res = fn.apply(null, arguments);
  3459. if (res !== null) {
  3460. _target.$off(event, onceHandler);
  3461. }
  3462. }
  3463. }
  3464. function updateComponentListeners (
  3465. vm,
  3466. listeners,
  3467. oldListeners
  3468. ) {
  3469. target = vm;
  3470. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  3471. target = undefined;
  3472. }
  3473. function eventsMixin (Vue) {
  3474. var hookRE = /^hook:/;
  3475. Vue.prototype.$on = function (event, fn) {
  3476. var vm = this;
  3477. if (Array.isArray(event)) {
  3478. for (var i = 0, l = event.length; i < l; i++) {
  3479. vm.$on(event[i], fn);
  3480. }
  3481. } else {
  3482. (vm._events[event] || (vm._events[event] = [])).push(fn);
  3483. // optimize hook:event cost by using a boolean flag marked at registration
  3484. // instead of a hash lookup
  3485. if (hookRE.test(event)) {
  3486. vm._hasHookEvent = true;
  3487. }
  3488. }
  3489. return vm
  3490. };
  3491. Vue.prototype.$once = function (event, fn) {
  3492. var vm = this;
  3493. function on () {
  3494. vm.$off(event, on);
  3495. fn.apply(vm, arguments);
  3496. }
  3497. on.fn = fn;
  3498. vm.$on(event, on);
  3499. return vm
  3500. };
  3501. Vue.prototype.$off = function (event, fn) {
  3502. var vm = this;
  3503. // all
  3504. if (!arguments.length) {
  3505. vm._events = Object.create(null);
  3506. return vm
  3507. }
  3508. // array of events
  3509. if (Array.isArray(event)) {
  3510. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  3511. vm.$off(event[i$1], fn);
  3512. }
  3513. return vm
  3514. }
  3515. // specific event
  3516. var cbs = vm._events[event];
  3517. if (!cbs) {
  3518. return vm
  3519. }
  3520. if (!fn) {
  3521. vm._events[event] = null;
  3522. return vm
  3523. }
  3524. // specific handler
  3525. var cb;
  3526. var i = cbs.length;
  3527. while (i--) {
  3528. cb = cbs[i];
  3529. if (cb === fn || cb.fn === fn) {
  3530. cbs.splice(i, 1);
  3531. break
  3532. }
  3533. }
  3534. return vm
  3535. };
  3536. Vue.prototype.$emit = function (event) {
  3537. var vm = this;
  3538. {
  3539. var lowerCaseEvent = event.toLowerCase();
  3540. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  3541. tip(
  3542. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  3543. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  3544. "Note that HTML attributes are case-insensitive and you cannot use " +
  3545. "v-on to listen to camelCase events when using in-DOM templates. " +
  3546. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  3547. );
  3548. }
  3549. }
  3550. var cbs = vm._events[event];
  3551. if (cbs) {
  3552. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  3553. var args = toArray(arguments, 1);
  3554. var info = "event handler for \"" + event + "\"";
  3555. for (var i = 0, l = cbs.length; i < l; i++) {
  3556. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  3557. }
  3558. }
  3559. return vm
  3560. };
  3561. }
  3562. /* */
  3563. var activeInstance = null;
  3564. var isUpdatingChildComponent = false;
  3565. function setActiveInstance(vm) {
  3566. var prevActiveInstance = activeInstance;
  3567. activeInstance = vm;
  3568. return function () {
  3569. activeInstance = prevActiveInstance;
  3570. }
  3571. }
  3572. function initLifecycle (vm) {
  3573. var options = vm.$options;
  3574. // locate first non-abstract parent
  3575. var parent = options.parent;
  3576. if (parent && !options.abstract) {
  3577. while (parent.$options.abstract && parent.$parent) {
  3578. parent = parent.$parent;
  3579. }
  3580. parent.$children.push(vm);
  3581. }
  3582. vm.$parent = parent;
  3583. vm.$root = parent ? parent.$root : vm;
  3584. vm.$children = [];
  3585. vm.$refs = {};
  3586. vm._watcher = null;
  3587. vm._inactive = null;
  3588. vm._directInactive = false;
  3589. vm._isMounted = false;
  3590. vm._isDestroyed = false;
  3591. vm._isBeingDestroyed = false;
  3592. }
  3593. function lifecycleMixin (Vue) {
  3594. Vue.prototype._update = function (vnode, hydrating) {
  3595. var vm = this;
  3596. var prevEl = vm.$el;
  3597. var prevVnode = vm._vnode;
  3598. var restoreActiveInstance = setActiveInstance(vm);
  3599. vm._vnode = vnode;
  3600. // Vue.prototype.__patch__ is injected in entry points
  3601. // based on the rendering backend used.
  3602. if (!prevVnode) {
  3603. // initial render
  3604. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  3605. } else {
  3606. // updates
  3607. vm.$el = vm.__patch__(prevVnode, vnode);
  3608. }
  3609. restoreActiveInstance();
  3610. // update __vue__ reference
  3611. if (prevEl) {
  3612. prevEl.__vue__ = null;
  3613. }
  3614. if (vm.$el) {
  3615. vm.$el.__vue__ = vm;
  3616. }
  3617. // if parent is an HOC, update its $el as well
  3618. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  3619. vm.$parent.$el = vm.$el;
  3620. }
  3621. // updated hook is called by the scheduler to ensure that children are
  3622. // updated in a parent's updated hook.
  3623. };
  3624. Vue.prototype.$forceUpdate = function () {
  3625. var vm = this;
  3626. if (vm._watcher) {
  3627. vm._watcher.update();
  3628. }
  3629. };
  3630. Vue.prototype.$destroy = function () {
  3631. var vm = this;
  3632. if (vm._isBeingDestroyed) {
  3633. return
  3634. }
  3635. callHook(vm, 'beforeDestroy');
  3636. vm._isBeingDestroyed = true;
  3637. // remove self from parent
  3638. var parent = vm.$parent;
  3639. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  3640. remove(parent.$children, vm);
  3641. }
  3642. // teardown watchers
  3643. if (vm._watcher) {
  3644. vm._watcher.teardown();
  3645. }
  3646. var i = vm._watchers.length;
  3647. while (i--) {
  3648. vm._watchers[i].teardown();
  3649. }
  3650. // remove reference from data ob
  3651. // frozen object may not have observer.
  3652. if (vm._data.__ob__) {
  3653. vm._data.__ob__.vmCount--;
  3654. }
  3655. // call the last hook...
  3656. vm._isDestroyed = true;
  3657. // invoke destroy hooks on current rendered tree
  3658. vm.__patch__(vm._vnode, null);
  3659. // fire destroyed hook
  3660. callHook(vm, 'destroyed');
  3661. // turn off all instance listeners.
  3662. vm.$off();
  3663. // remove __vue__ reference
  3664. if (vm.$el) {
  3665. vm.$el.__vue__ = null;
  3666. }
  3667. // release circular reference (#6759)
  3668. if (vm.$vnode) {
  3669. vm.$vnode.parent = null;
  3670. }
  3671. };
  3672. }
  3673. function mountComponent (
  3674. vm,
  3675. el,
  3676. hydrating
  3677. ) {
  3678. vm.$el = el;
  3679. if (!vm.$options.render) {
  3680. vm.$options.render = createEmptyVNode;
  3681. {
  3682. /* istanbul ignore if */
  3683. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  3684. vm.$options.el || el) {
  3685. warn(
  3686. 'You are using the runtime-only build of Vue where the template ' +
  3687. 'compiler is not available. Either pre-compile the templates into ' +
  3688. 'render functions, or use the compiler-included build.',
  3689. vm
  3690. );
  3691. } else {
  3692. warn(
  3693. 'Failed to mount component: template or render function not defined.',
  3694. vm
  3695. );
  3696. }
  3697. }
  3698. }
  3699. callHook(vm, 'beforeMount');
  3700. var updateComponent;
  3701. /* istanbul ignore if */
  3702. if (config.performance && mark) {
  3703. updateComponent = function () {
  3704. var name = vm._name;
  3705. var id = vm._uid;
  3706. var startTag = "vue-perf-start:" + id;
  3707. var endTag = "vue-perf-end:" + id;
  3708. mark(startTag);
  3709. var vnode = vm._render();
  3710. mark(endTag);
  3711. measure(("vue " + name + " render"), startTag, endTag);
  3712. mark(startTag);
  3713. vm._update(vnode, hydrating);
  3714. mark(endTag);
  3715. measure(("vue " + name + " patch"), startTag, endTag);
  3716. };
  3717. } else {
  3718. updateComponent = function () {
  3719. vm._update(vm._render(), hydrating);
  3720. };
  3721. }
  3722. // we set this to vm._watcher inside the watcher's constructor
  3723. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  3724. // component's mounted hook), which relies on vm._watcher being already defined
  3725. new Watcher(vm, updateComponent, noop, {
  3726. before: function before () {
  3727. if (vm._isMounted && !vm._isDestroyed) {
  3728. callHook(vm, 'beforeUpdate');
  3729. }
  3730. }
  3731. }, true /* isRenderWatcher */);
  3732. hydrating = false;
  3733. // manually mounted instance, call mounted on self
  3734. // mounted is called for render-created child components in its inserted hook
  3735. if (vm.$vnode == null) {
  3736. // fixed by xxxxxx
  3737. vm._isMounted = true;
  3738. if (vm._$vd) {// 延迟 mounted 事件
  3739. callHook(vm, 'onServiceCreated');
  3740. callHook(vm, 'onServiceAttached');
  3741. vm._$vd.addMountedVm(vm);
  3742. } else {
  3743. callHook(vm, 'mounted');
  3744. }
  3745. }
  3746. return vm
  3747. }
  3748. function updateChildComponent (
  3749. vm,
  3750. propsData,
  3751. listeners,
  3752. parentVnode,
  3753. renderChildren
  3754. ) {
  3755. {
  3756. isUpdatingChildComponent = true;
  3757. }
  3758. // determine whether component has slot children
  3759. // we need to do this before overwriting $options._renderChildren.
  3760. // check if there are dynamic scopedSlots (hand-written or compiled but with
  3761. // dynamic slot names). Static scoped slots compiled from template has the
  3762. // "$stable" marker.
  3763. var newScopedSlots = parentVnode.data.scopedSlots;
  3764. var oldScopedSlots = vm.$scopedSlots;
  3765. var hasDynamicScopedSlot = !!(
  3766. (newScopedSlots && !newScopedSlots.$stable) ||
  3767. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  3768. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  3769. );
  3770. // Any static slot children from the parent may have changed during parent's
  3771. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  3772. // update is necessary to ensure correctness.
  3773. var needsForceUpdate = !!(
  3774. renderChildren || // has new static slots
  3775. vm.$options._renderChildren || // has old static slots
  3776. hasDynamicScopedSlot
  3777. );
  3778. vm.$options._parentVnode = parentVnode;
  3779. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  3780. if (vm._vnode) { // update child tree's parent
  3781. vm._vnode.parent = parentVnode;
  3782. }
  3783. vm.$options._renderChildren = renderChildren;
  3784. // update $attrs and $listeners hash
  3785. // these are also reactive so they may trigger child update if the child
  3786. // used them during render
  3787. vm.$attrs = parentVnode.data.attrs || emptyObject;
  3788. vm.$listeners = listeners || emptyObject;
  3789. // update props
  3790. if (propsData && vm.$options.props) {
  3791. toggleObserving(false);
  3792. var props = vm._props;
  3793. var propKeys = vm.$options._propKeys || [];
  3794. for (var i = 0; i < propKeys.length; i++) {
  3795. var key = propKeys[i];
  3796. var propOptions = vm.$options.props; // wtf flow?
  3797. props[key] = validateProp(key, propOptions, propsData, vm);
  3798. }
  3799. toggleObserving(true);
  3800. // keep a copy of raw propsData
  3801. vm.$options.propsData = propsData;
  3802. }
  3803. // fixed by xxxxxx update properties(mp runtime)
  3804. vm._$updateProperties && vm._$updateProperties(vm);
  3805. // update listeners
  3806. listeners = listeners || emptyObject;
  3807. var oldListeners = vm.$options._parentListeners;
  3808. vm.$options._parentListeners = listeners;
  3809. updateComponentListeners(vm, listeners, oldListeners);
  3810. // resolve slots + force update if has children
  3811. if (needsForceUpdate) {
  3812. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  3813. vm.$forceUpdate();
  3814. }
  3815. {
  3816. isUpdatingChildComponent = false;
  3817. }
  3818. }
  3819. function isInInactiveTree (vm) {
  3820. while (vm && (vm = vm.$parent)) {
  3821. if (vm._inactive) { return true }
  3822. }
  3823. return false
  3824. }
  3825. function activateChildComponent (vm, direct) {
  3826. if (direct) {
  3827. vm._directInactive = false;
  3828. if (isInInactiveTree(vm)) {
  3829. return
  3830. }
  3831. } else if (vm._directInactive) {
  3832. return
  3833. }
  3834. if (vm._inactive || vm._inactive === null) {
  3835. vm._inactive = false;
  3836. for (var i = 0; i < vm.$children.length; i++) {
  3837. activateChildComponent(vm.$children[i]);
  3838. }
  3839. callHook(vm, 'activated');
  3840. }
  3841. }
  3842. function deactivateChildComponent (vm, direct) {
  3843. if (direct) {
  3844. vm._directInactive = true;
  3845. if (isInInactiveTree(vm)) {
  3846. return
  3847. }
  3848. }
  3849. if (!vm._inactive) {
  3850. vm._inactive = true;
  3851. for (var i = 0; i < vm.$children.length; i++) {
  3852. deactivateChildComponent(vm.$children[i]);
  3853. }
  3854. callHook(vm, 'deactivated');
  3855. }
  3856. }
  3857. function callHook (vm, hook) {
  3858. // #7573 disable dep collection when invoking lifecycle hooks
  3859. pushTarget();
  3860. var handlers = vm.$options[hook];
  3861. var info = hook + " hook";
  3862. if (handlers) {
  3863. for (var i = 0, j = handlers.length; i < j; i++) {
  3864. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  3865. }
  3866. }
  3867. if (vm._hasHookEvent) {
  3868. vm.$emit('hook:' + hook);
  3869. }
  3870. popTarget();
  3871. }
  3872. /* */
  3873. var MAX_UPDATE_COUNT = 100;
  3874. var queue = []; // fixed by xxxxxx
  3875. var activatedChildren = [];
  3876. var has = {};
  3877. var circular = {};
  3878. var waiting = false;
  3879. var flushing = false;
  3880. var index = 0;
  3881. /**
  3882. * Reset the scheduler's state.
  3883. */
  3884. function resetSchedulerState () {
  3885. index = queue.length = activatedChildren.length = 0;
  3886. has = {};
  3887. {
  3888. circular = {};
  3889. }
  3890. waiting = flushing = false;
  3891. }
  3892. // Async edge case #6566 requires saving the timestamp when event listeners are
  3893. // attached. However, calling performance.now() has a perf overhead especially
  3894. // if the page has thousands of event listeners. Instead, we take a timestamp
  3895. // every time the scheduler flushes and use that for all event listeners
  3896. // attached during that flush.
  3897. var currentFlushTimestamp = 0;
  3898. // Async edge case fix requires storing an event listener's attach timestamp.
  3899. var getNow = Date.now;
  3900. // Determine what event timestamp the browser is using. Annoyingly, the
  3901. // timestamp can either be hi-res (relative to page load) or low-res
  3902. // (relative to UNIX epoch), so in order to compare time we have to use the
  3903. // same timestamp type when saving the flush timestamp.
  3904. // All IE versions use low-res event timestamps, and have problematic clock
  3905. // implementations (#9632)
  3906. if (inBrowser && !isIE) {
  3907. var performance = window.performance;
  3908. if (
  3909. performance &&
  3910. typeof performance.now === 'function' &&
  3911. getNow() > document.createEvent('Event').timeStamp
  3912. ) {
  3913. // if the event timestamp, although evaluated AFTER the Date.now(), is
  3914. // smaller than it, it means the event is using a hi-res timestamp,
  3915. // and we need to use the hi-res version for event listener timestamps as
  3916. // well.
  3917. getNow = function () { return performance.now(); };
  3918. }
  3919. }
  3920. /**
  3921. * Flush both queues and run the watchers.
  3922. */
  3923. function flushSchedulerQueue () {
  3924. currentFlushTimestamp = getNow();
  3925. flushing = true;
  3926. var watcher, id;
  3927. // Sort queue before flush.
  3928. // This ensures that:
  3929. // 1. Components are updated from parent to child. (because parent is always
  3930. // created before the child)
  3931. // 2. A component's user watchers are run before its render watcher (because
  3932. // user watchers are created before the render watcher)
  3933. // 3. If a component is destroyed during a parent component's watcher run,
  3934. // its watchers can be skipped.
  3935. queue.sort(function (a, b) { return a.id - b.id; });
  3936. // do not cache length because more watchers might be pushed
  3937. // as we run existing watchers
  3938. for (index = 0; index < queue.length; index++) {
  3939. watcher = queue[index];
  3940. if (watcher.before) {
  3941. watcher.before();
  3942. }
  3943. id = watcher.id;
  3944. has[id] = null;
  3945. watcher.run();
  3946. // in dev build, check and stop circular updates.
  3947. if (has[id] != null) {
  3948. circular[id] = (circular[id] || 0) + 1;
  3949. if (circular[id] > MAX_UPDATE_COUNT) {
  3950. warn(
  3951. 'You may have an infinite update loop ' + (
  3952. watcher.user
  3953. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  3954. : "in a component render function."
  3955. ),
  3956. watcher.vm
  3957. );
  3958. break
  3959. }
  3960. }
  3961. }
  3962. // keep copies of post queues before resetting state
  3963. var activatedQueue = activatedChildren.slice();
  3964. var updatedQueue = queue.slice();
  3965. resetSchedulerState();
  3966. // call component updated and activated hooks
  3967. callActivatedHooks(activatedQueue);
  3968. callUpdatedHooks(updatedQueue);
  3969. // devtool hook
  3970. /* istanbul ignore if */
  3971. if (devtools && config.devtools) {
  3972. devtools.emit('flush');
  3973. }
  3974. }
  3975. function callUpdatedHooks (queue) {
  3976. var i = queue.length;
  3977. while (i--) {
  3978. var watcher = queue[i];
  3979. var vm = watcher.vm;
  3980. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  3981. // fixed by xxxxx
  3982. if (vm._$vd) { // 延迟 updated 事件
  3983. vm._$vd.addUpdatedVm(vm);
  3984. }else{
  3985. callHook(vm, 'updated');
  3986. }
  3987. }
  3988. }
  3989. }
  3990. /**
  3991. * Queue a kept-alive component that was activated during patch.
  3992. * The queue will be processed after the entire tree has been patched.
  3993. */
  3994. function queueActivatedComponent (vm) {
  3995. // setting _inactive to false here so that a render function can
  3996. // rely on checking whether it's in an inactive tree (e.g. router-view)
  3997. vm._inactive = false;
  3998. activatedChildren.push(vm);
  3999. }
  4000. function callActivatedHooks (queue) {
  4001. for (var i = 0; i < queue.length; i++) {
  4002. queue[i]._inactive = true;
  4003. activateChildComponent(queue[i], true /* true */);
  4004. }
  4005. }
  4006. /**
  4007. * Push a watcher into the watcher queue.
  4008. * Jobs with duplicate IDs will be skipped unless it's
  4009. * pushed when the queue is being flushed.
  4010. */
  4011. function queueWatcher (watcher) {
  4012. var id = watcher.id;
  4013. if (has[id] == null) {
  4014. has[id] = true;
  4015. if (!flushing) {
  4016. queue.push(watcher);
  4017. } else {
  4018. // if already flushing, splice the watcher based on its id
  4019. // if already past its id, it will be run next immediately.
  4020. var i = queue.length - 1;
  4021. while (i > index && queue[i].id > watcher.id) {
  4022. i--;
  4023. }
  4024. queue.splice(i + 1, 0, watcher);
  4025. }
  4026. // queue the flush
  4027. if (!waiting) {
  4028. waiting = true;
  4029. if (!config.async) {
  4030. flushSchedulerQueue();
  4031. return
  4032. }
  4033. nextTick(flushSchedulerQueue);
  4034. }
  4035. }
  4036. }
  4037. /* */
  4038. var uid$2 = 0;
  4039. /**
  4040. * A watcher parses an expression, collects dependencies,
  4041. * and fires callback when the expression value changes.
  4042. * This is used for both the $watch() api and directives.
  4043. */
  4044. var Watcher = function Watcher (
  4045. vm,
  4046. expOrFn,
  4047. cb,
  4048. options,
  4049. isRenderWatcher
  4050. ) {
  4051. this.vm = vm;
  4052. if (isRenderWatcher) {
  4053. vm._watcher = this;
  4054. }
  4055. vm._watchers.push(this);
  4056. // options
  4057. if (options) {
  4058. this.deep = !!options.deep;
  4059. this.user = !!options.user;
  4060. this.lazy = !!options.lazy;
  4061. this.sync = !!options.sync;
  4062. this.before = options.before;
  4063. } else {
  4064. this.deep = this.user = this.lazy = this.sync = false;
  4065. }
  4066. this.cb = cb;
  4067. this.id = ++uid$2; // uid for batching
  4068. this.active = true;
  4069. this.dirty = this.lazy; // for lazy watchers
  4070. this.deps = [];
  4071. this.newDeps = [];
  4072. this.depIds = new _Set();
  4073. this.newDepIds = new _Set();
  4074. this.expression = expOrFn.toString();
  4075. // parse expression for getter
  4076. if (typeof expOrFn === 'function') {
  4077. this.getter = expOrFn;
  4078. } else {
  4079. this.getter = parsePath(expOrFn);
  4080. if (!this.getter) {
  4081. this.getter = noop;
  4082. warn(
  4083. "Failed watching path: \"" + expOrFn + "\" " +
  4084. 'Watcher only accepts simple dot-delimited paths. ' +
  4085. 'For full control, use a function instead.',
  4086. vm
  4087. );
  4088. }
  4089. }
  4090. this.value = this.lazy
  4091. ? undefined
  4092. : this.get();
  4093. };
  4094. /**
  4095. * Evaluate the getter, and re-collect dependencies.
  4096. */
  4097. Watcher.prototype.get = function get () {
  4098. pushTarget(this);
  4099. var value;
  4100. var vm = this.vm;
  4101. try {
  4102. value = this.getter.call(vm, vm);
  4103. } catch (e) {
  4104. if (this.user) {
  4105. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  4106. } else {
  4107. throw e
  4108. }
  4109. } finally {
  4110. // "touch" every property so they are all tracked as
  4111. // dependencies for deep watching
  4112. if (this.deep) {
  4113. traverse(value);
  4114. }
  4115. popTarget();
  4116. this.cleanupDeps();
  4117. }
  4118. return value
  4119. };
  4120. /**
  4121. * Add a dependency to this directive.
  4122. */
  4123. Watcher.prototype.addDep = function addDep (dep) {
  4124. var id = dep.id;
  4125. if (!this.newDepIds.has(id)) {
  4126. this.newDepIds.add(id);
  4127. this.newDeps.push(dep);
  4128. if (!this.depIds.has(id)) {
  4129. dep.addSub(this);
  4130. }
  4131. }
  4132. };
  4133. /**
  4134. * Clean up for dependency collection.
  4135. */
  4136. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  4137. var i = this.deps.length;
  4138. while (i--) {
  4139. var dep = this.deps[i];
  4140. if (!this.newDepIds.has(dep.id)) {
  4141. dep.removeSub(this);
  4142. }
  4143. }
  4144. var tmp = this.depIds;
  4145. this.depIds = this.newDepIds;
  4146. this.newDepIds = tmp;
  4147. this.newDepIds.clear();
  4148. tmp = this.deps;
  4149. this.deps = this.newDeps;
  4150. this.newDeps = tmp;
  4151. this.newDeps.length = 0;
  4152. };
  4153. /**
  4154. * Subscriber interface.
  4155. * Will be called when a dependency changes.
  4156. */
  4157. Watcher.prototype.update = function update () {
  4158. /* istanbul ignore else */
  4159. if (this.lazy) {
  4160. this.dirty = true;
  4161. } else if (this.sync) {
  4162. this.run();
  4163. } else {
  4164. queueWatcher(this);
  4165. }
  4166. };
  4167. /**
  4168. * Scheduler job interface.
  4169. * Will be called by the scheduler.
  4170. */
  4171. Watcher.prototype.run = function run () {
  4172. if (this.active) {
  4173. var value = this.get();
  4174. if (
  4175. value !== this.value ||
  4176. // Deep watchers and watchers on Object/Arrays should fire even
  4177. // when the value is the same, because the value may
  4178. // have mutated.
  4179. isObject(value) ||
  4180. this.deep
  4181. ) {
  4182. // set new value
  4183. var oldValue = this.value;
  4184. this.value = value;
  4185. if (this.user) {
  4186. try {
  4187. this.cb.call(this.vm, value, oldValue);
  4188. } catch (e) {
  4189. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  4190. }
  4191. } else {
  4192. this.cb.call(this.vm, value, oldValue);
  4193. }
  4194. }
  4195. }
  4196. };
  4197. /**
  4198. * Evaluate the value of the watcher.
  4199. * This only gets called for lazy watchers.
  4200. */
  4201. Watcher.prototype.evaluate = function evaluate () {
  4202. this.value = this.get();
  4203. this.dirty = false;
  4204. };
  4205. /**
  4206. * Depend on all deps collected by this watcher.
  4207. */
  4208. Watcher.prototype.depend = function depend () {
  4209. var i = this.deps.length;
  4210. while (i--) {
  4211. this.deps[i].depend();
  4212. }
  4213. };
  4214. /**
  4215. * Remove self from all dependencies' subscriber list.
  4216. */
  4217. Watcher.prototype.teardown = function teardown () {
  4218. if (this.active) {
  4219. // remove self from vm's watcher list
  4220. // this is a somewhat expensive operation so we skip it
  4221. // if the vm is being destroyed.
  4222. if (!this.vm._isBeingDestroyed) {
  4223. remove(this.vm._watchers, this);
  4224. }
  4225. var i = this.deps.length;
  4226. while (i--) {
  4227. this.deps[i].removeSub(this);
  4228. }
  4229. this.active = false;
  4230. }
  4231. };
  4232. /* */
  4233. var sharedPropertyDefinition = {
  4234. enumerable: true,
  4235. configurable: true,
  4236. get: noop,
  4237. set: noop
  4238. };
  4239. function proxy (target, sourceKey, key) {
  4240. sharedPropertyDefinition.get = function proxyGetter () {
  4241. return this[sourceKey][key]
  4242. };
  4243. sharedPropertyDefinition.set = function proxySetter (val) {
  4244. this[sourceKey][key] = val;
  4245. };
  4246. Object.defineProperty(target, key, sharedPropertyDefinition);
  4247. }
  4248. function initState (vm) {
  4249. vm._watchers = [];
  4250. var opts = vm.$options;
  4251. if (opts.props) { initProps(vm, opts.props); }
  4252. if (opts.methods) { initMethods(vm, opts.methods); }
  4253. if (opts.data) {
  4254. initData(vm);
  4255. } else {
  4256. observe(vm._data = {}, true /* asRootData */);
  4257. }
  4258. if (opts.computed) { initComputed(vm, opts.computed); }
  4259. if (opts.watch && opts.watch !== nativeWatch) {
  4260. initWatch(vm, opts.watch);
  4261. }
  4262. }
  4263. function initProps (vm, propsOptions) {
  4264. var propsData = vm.$options.propsData || {};
  4265. var props = vm._props = {};
  4266. // cache prop keys so that future props updates can iterate using Array
  4267. // instead of dynamic object key enumeration.
  4268. var keys = vm.$options._propKeys = [];
  4269. var isRoot = !vm.$parent;
  4270. // root instance props should be converted
  4271. if (!isRoot) {
  4272. toggleObserving(false);
  4273. }
  4274. var loop = function ( key ) {
  4275. keys.push(key);
  4276. var value = validateProp(key, propsOptions, propsData, vm);
  4277. /* istanbul ignore else */
  4278. {
  4279. var hyphenatedKey = hyphenate(key);
  4280. if (isReservedAttribute(hyphenatedKey) ||
  4281. config.isReservedAttr(hyphenatedKey)) {
  4282. warn(
  4283. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  4284. vm
  4285. );
  4286. }
  4287. defineReactive$$1(props, key, value, function () {
  4288. if (!isRoot && !isUpdatingChildComponent) {
  4289. warn(
  4290. "Avoid mutating a prop directly since the value will be " +
  4291. "overwritten whenever the parent component re-renders. " +
  4292. "Instead, use a data or computed property based on the prop's " +
  4293. "value. Prop being mutated: \"" + key + "\"",
  4294. vm
  4295. );
  4296. }
  4297. });
  4298. }
  4299. // static props are already proxied on the component's prototype
  4300. // during Vue.extend(). We only need to proxy props defined at
  4301. // instantiation here.
  4302. if (!(key in vm)) {
  4303. proxy(vm, "_props", key);
  4304. }
  4305. };
  4306. for (var key in propsOptions) loop( key );
  4307. toggleObserving(true);
  4308. }
  4309. function initData (vm) {
  4310. var data = vm.$options.data;
  4311. data = vm._data = typeof data === 'function'
  4312. ? getData(data, vm)
  4313. : data || {};
  4314. if (!isPlainObject(data)) {
  4315. data = {};
  4316. warn(
  4317. 'data functions should return an object:\n' +
  4318. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  4319. vm
  4320. );
  4321. }
  4322. // proxy data on instance
  4323. var keys = Object.keys(data);
  4324. var props = vm.$options.props;
  4325. var methods = vm.$options.methods;
  4326. var i = keys.length;
  4327. while (i--) {
  4328. var key = keys[i];
  4329. {
  4330. if (methods && hasOwn(methods, key)) {
  4331. warn(
  4332. ("Method \"" + key + "\" has already been defined as a data property."),
  4333. vm
  4334. );
  4335. }
  4336. }
  4337. if (props && hasOwn(props, key)) {
  4338. warn(
  4339. "The data property \"" + key + "\" is already declared as a prop. " +
  4340. "Use prop default value instead.",
  4341. vm
  4342. );
  4343. } else if (!isReserved(key)) {
  4344. proxy(vm, "_data", key);
  4345. }
  4346. }
  4347. // observe data
  4348. observe(data, true /* asRootData */);
  4349. }
  4350. function getData (data, vm) {
  4351. // #7573 disable dep collection when invoking data getters
  4352. pushTarget();
  4353. try {
  4354. return data.call(vm, vm)
  4355. } catch (e) {
  4356. handleError(e, vm, "data()");
  4357. return {}
  4358. } finally {
  4359. popTarget();
  4360. }
  4361. }
  4362. var computedWatcherOptions = { lazy: true };
  4363. function initComputed (vm, computed) {
  4364. // $flow-disable-line
  4365. var watchers = vm._computedWatchers = Object.create(null);
  4366. // computed properties are just getters during SSR
  4367. var isSSR = isServerRendering();
  4368. for (var key in computed) {
  4369. var userDef = computed[key];
  4370. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  4371. if (getter == null) {
  4372. warn(
  4373. ("Getter is missing for computed property \"" + key + "\"."),
  4374. vm
  4375. );
  4376. }
  4377. if (!isSSR) {
  4378. // create internal watcher for the computed property.
  4379. watchers[key] = new Watcher(
  4380. vm,
  4381. getter || noop,
  4382. noop,
  4383. computedWatcherOptions
  4384. );
  4385. }
  4386. // component-defined computed properties are already defined on the
  4387. // component prototype. We only need to define computed properties defined
  4388. // at instantiation here.
  4389. if (!(key in vm)) {
  4390. defineComputed(vm, key, userDef);
  4391. } else {
  4392. if (key in vm.$data) {
  4393. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  4394. } else if (vm.$options.props && key in vm.$options.props) {
  4395. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  4396. }
  4397. }
  4398. }
  4399. }
  4400. function defineComputed (
  4401. target,
  4402. key,
  4403. userDef
  4404. ) {
  4405. var shouldCache = !isServerRendering();
  4406. if (typeof userDef === 'function') {
  4407. sharedPropertyDefinition.get = shouldCache
  4408. ? createComputedGetter(key)
  4409. : createGetterInvoker(userDef);
  4410. sharedPropertyDefinition.set = noop;
  4411. } else {
  4412. sharedPropertyDefinition.get = userDef.get
  4413. ? shouldCache && userDef.cache !== false
  4414. ? createComputedGetter(key)
  4415. : createGetterInvoker(userDef.get)
  4416. : noop;
  4417. sharedPropertyDefinition.set = userDef.set || noop;
  4418. }
  4419. if (sharedPropertyDefinition.set === noop) {
  4420. sharedPropertyDefinition.set = function () {
  4421. warn(
  4422. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  4423. this
  4424. );
  4425. };
  4426. }
  4427. Object.defineProperty(target, key, sharedPropertyDefinition);
  4428. }
  4429. function createComputedGetter (key) {
  4430. return function computedGetter () {
  4431. var watcher = this._computedWatchers && this._computedWatchers[key];
  4432. if (watcher) {
  4433. if (watcher.dirty) {
  4434. watcher.evaluate();
  4435. }
  4436. if (Dep.SharedObject.target) { // fixed by xxxxxx
  4437. watcher.depend();
  4438. }
  4439. return watcher.value
  4440. }
  4441. }
  4442. }
  4443. function createGetterInvoker(fn) {
  4444. return function computedGetter () {
  4445. return fn.call(this, this)
  4446. }
  4447. }
  4448. function initMethods (vm, methods) {
  4449. var props = vm.$options.props;
  4450. for (var key in methods) {
  4451. {
  4452. if (typeof methods[key] !== 'function') {
  4453. warn(
  4454. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  4455. "Did you reference the function correctly?",
  4456. vm
  4457. );
  4458. }
  4459. if (props && hasOwn(props, key)) {
  4460. warn(
  4461. ("Method \"" + key + "\" has already been defined as a prop."),
  4462. vm
  4463. );
  4464. }
  4465. if ((key in vm) && isReserved(key)) {
  4466. warn(
  4467. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  4468. "Avoid defining component methods that start with _ or $."
  4469. );
  4470. }
  4471. }
  4472. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  4473. }
  4474. }
  4475. function initWatch (vm, watch) {
  4476. for (var key in watch) {
  4477. var handler = watch[key];
  4478. if (Array.isArray(handler)) {
  4479. for (var i = 0; i < handler.length; i++) {
  4480. createWatcher(vm, key, handler[i]);
  4481. }
  4482. } else {
  4483. createWatcher(vm, key, handler);
  4484. }
  4485. }
  4486. }
  4487. function createWatcher (
  4488. vm,
  4489. expOrFn,
  4490. handler,
  4491. options
  4492. ) {
  4493. if (isPlainObject(handler)) {
  4494. options = handler;
  4495. handler = handler.handler;
  4496. }
  4497. if (typeof handler === 'string') {
  4498. handler = vm[handler];
  4499. }
  4500. return vm.$watch(expOrFn, handler, options)
  4501. }
  4502. function stateMixin (Vue) {
  4503. // flow somehow has problems with directly declared definition object
  4504. // when using Object.defineProperty, so we have to procedurally build up
  4505. // the object here.
  4506. var dataDef = {};
  4507. dataDef.get = function () { return this._data };
  4508. var propsDef = {};
  4509. propsDef.get = function () { return this._props };
  4510. {
  4511. dataDef.set = function () {
  4512. warn(
  4513. 'Avoid replacing instance root $data. ' +
  4514. 'Use nested data properties instead.',
  4515. this
  4516. );
  4517. };
  4518. propsDef.set = function () {
  4519. warn("$props is readonly.", this);
  4520. };
  4521. }
  4522. Object.defineProperty(Vue.prototype, '$data', dataDef);
  4523. Object.defineProperty(Vue.prototype, '$props', propsDef);
  4524. Vue.prototype.$set = set;
  4525. Vue.prototype.$delete = del;
  4526. Vue.prototype.$watch = function (
  4527. expOrFn,
  4528. cb,
  4529. options
  4530. ) {
  4531. var vm = this;
  4532. if (isPlainObject(cb)) {
  4533. return createWatcher(vm, expOrFn, cb, options)
  4534. }
  4535. options = options || {};
  4536. options.user = true;
  4537. var watcher = new Watcher(vm, expOrFn, cb, options);
  4538. if (options.immediate) {
  4539. try {
  4540. cb.call(vm, watcher.value);
  4541. } catch (error) {
  4542. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  4543. }
  4544. }
  4545. return function unwatchFn () {
  4546. watcher.teardown();
  4547. }
  4548. };
  4549. }
  4550. /* */
  4551. var uid$3 = 0;
  4552. function initMixin (Vue) {
  4553. Vue.prototype._init = function (options) {
  4554. var vm = this;
  4555. // a uid
  4556. vm._uid = uid$3++;
  4557. var startTag, endTag;
  4558. /* istanbul ignore if */
  4559. if (config.performance && mark) {
  4560. startTag = "vue-perf-start:" + (vm._uid);
  4561. endTag = "vue-perf-end:" + (vm._uid);
  4562. mark(startTag);
  4563. }
  4564. // a flag to avoid this being observed
  4565. vm._isVue = true;
  4566. // merge options
  4567. if (options && options._isComponent) {
  4568. // optimize internal component instantiation
  4569. // since dynamic options merging is pretty slow, and none of the
  4570. // internal component options needs special treatment.
  4571. initInternalComponent(vm, options);
  4572. } else {
  4573. vm.$options = mergeOptions(
  4574. resolveConstructorOptions(vm.constructor),
  4575. options || {},
  4576. vm
  4577. );
  4578. }
  4579. /* istanbul ignore else */
  4580. {
  4581. initProxy(vm);
  4582. }
  4583. // expose real self
  4584. vm._self = vm;
  4585. initLifecycle(vm);
  4586. initEvents(vm);
  4587. initRender(vm);
  4588. callHook(vm, 'beforeCreate');
  4589. initInjections(vm); // resolve injections before data/props
  4590. initState(vm);
  4591. initProvide(vm); // resolve provide after data/props
  4592. callHook(vm, 'created');
  4593. /* istanbul ignore if */
  4594. if (config.performance && mark) {
  4595. vm._name = formatComponentName(vm, false);
  4596. mark(endTag);
  4597. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  4598. }
  4599. if (vm.$options.el) {
  4600. vm.$mount(vm.$options.el);
  4601. }
  4602. };
  4603. }
  4604. function initInternalComponent (vm, options) {
  4605. var opts = vm.$options = Object.create(vm.constructor.options);
  4606. // doing this because it's faster than dynamic enumeration.
  4607. var parentVnode = options._parentVnode;
  4608. opts.parent = options.parent;
  4609. opts._parentVnode = parentVnode;
  4610. var vnodeComponentOptions = parentVnode.componentOptions;
  4611. opts.propsData = vnodeComponentOptions.propsData;
  4612. opts._parentListeners = vnodeComponentOptions.listeners;
  4613. opts._renderChildren = vnodeComponentOptions.children;
  4614. opts._componentTag = vnodeComponentOptions.tag;
  4615. if (options.render) {
  4616. opts.render = options.render;
  4617. opts.staticRenderFns = options.staticRenderFns;
  4618. }
  4619. }
  4620. function resolveConstructorOptions (Ctor) {
  4621. var options = Ctor.options;
  4622. if (Ctor.super) {
  4623. var superOptions = resolveConstructorOptions(Ctor.super);
  4624. var cachedSuperOptions = Ctor.superOptions;
  4625. if (superOptions !== cachedSuperOptions) {
  4626. // super option changed,
  4627. // need to resolve new options.
  4628. Ctor.superOptions = superOptions;
  4629. // check if there are any late-modified/attached options (#4976)
  4630. var modifiedOptions = resolveModifiedOptions(Ctor);
  4631. // update base extend options
  4632. if (modifiedOptions) {
  4633. extend(Ctor.extendOptions, modifiedOptions);
  4634. }
  4635. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4636. if (options.name) {
  4637. options.components[options.name] = Ctor;
  4638. }
  4639. }
  4640. }
  4641. return options
  4642. }
  4643. function resolveModifiedOptions (Ctor) {
  4644. var modified;
  4645. var latest = Ctor.options;
  4646. var sealed = Ctor.sealedOptions;
  4647. for (var key in latest) {
  4648. if (latest[key] !== sealed[key]) {
  4649. if (!modified) { modified = {}; }
  4650. modified[key] = latest[key];
  4651. }
  4652. }
  4653. return modified
  4654. }
  4655. function Vue (options) {
  4656. if (!(this instanceof Vue)
  4657. ) {
  4658. warn('Vue is a constructor and should be called with the `new` keyword');
  4659. }
  4660. this._init(options);
  4661. }
  4662. initMixin(Vue);
  4663. stateMixin(Vue);
  4664. eventsMixin(Vue);
  4665. lifecycleMixin(Vue);
  4666. renderMixin(Vue);
  4667. /* */
  4668. function initUse (Vue) {
  4669. Vue.use = function (plugin) {
  4670. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  4671. if (installedPlugins.indexOf(plugin) > -1) {
  4672. return this
  4673. }
  4674. // additional parameters
  4675. var args = toArray(arguments, 1);
  4676. args.unshift(this);
  4677. if (typeof plugin.install === 'function') {
  4678. plugin.install.apply(plugin, args);
  4679. } else if (typeof plugin === 'function') {
  4680. plugin.apply(null, args);
  4681. }
  4682. installedPlugins.push(plugin);
  4683. return this
  4684. };
  4685. }
  4686. /* */
  4687. function initMixin$1 (Vue) {
  4688. Vue.mixin = function (mixin) {
  4689. this.options = mergeOptions(this.options, mixin);
  4690. return this
  4691. };
  4692. }
  4693. /* */
  4694. function initExtend (Vue) {
  4695. /**
  4696. * Each instance constructor, including Vue, has a unique
  4697. * cid. This enables us to create wrapped "child
  4698. * constructors" for prototypal inheritance and cache them.
  4699. */
  4700. Vue.cid = 0;
  4701. var cid = 1;
  4702. /**
  4703. * Class inheritance
  4704. */
  4705. Vue.extend = function (extendOptions) {
  4706. extendOptions = extendOptions || {};
  4707. var Super = this;
  4708. var SuperId = Super.cid;
  4709. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  4710. if (cachedCtors[SuperId]) {
  4711. return cachedCtors[SuperId]
  4712. }
  4713. var name = extendOptions.name || Super.options.name;
  4714. if (name) {
  4715. validateComponentName(name);
  4716. }
  4717. var Sub = function VueComponent (options) {
  4718. this._init(options);
  4719. };
  4720. Sub.prototype = Object.create(Super.prototype);
  4721. Sub.prototype.constructor = Sub;
  4722. Sub.cid = cid++;
  4723. Sub.options = mergeOptions(
  4724. Super.options,
  4725. extendOptions
  4726. );
  4727. Sub['super'] = Super;
  4728. // For props and computed properties, we define the proxy getters on
  4729. // the Vue instances at extension time, on the extended prototype. This
  4730. // avoids Object.defineProperty calls for each instance created.
  4731. if (Sub.options.props) {
  4732. initProps$1(Sub);
  4733. }
  4734. if (Sub.options.computed) {
  4735. initComputed$1(Sub);
  4736. }
  4737. // allow further extension/mixin/plugin usage
  4738. Sub.extend = Super.extend;
  4739. Sub.mixin = Super.mixin;
  4740. Sub.use = Super.use;
  4741. // create asset registers, so extended classes
  4742. // can have their private assets too.
  4743. ASSET_TYPES.forEach(function (type) {
  4744. Sub[type] = Super[type];
  4745. });
  4746. // enable recursive self-lookup
  4747. if (name) {
  4748. Sub.options.components[name] = Sub;
  4749. }
  4750. // keep a reference to the super options at extension time.
  4751. // later at instantiation we can check if Super's options have
  4752. // been updated.
  4753. Sub.superOptions = Super.options;
  4754. Sub.extendOptions = extendOptions;
  4755. Sub.sealedOptions = extend({}, Sub.options);
  4756. // cache constructor
  4757. cachedCtors[SuperId] = Sub;
  4758. return Sub
  4759. };
  4760. }
  4761. function initProps$1 (Comp) {
  4762. var props = Comp.options.props;
  4763. for (var key in props) {
  4764. proxy(Comp.prototype, "_props", key);
  4765. }
  4766. }
  4767. function initComputed$1 (Comp) {
  4768. var computed = Comp.options.computed;
  4769. for (var key in computed) {
  4770. defineComputed(Comp.prototype, key, computed[key]);
  4771. }
  4772. }
  4773. /* */
  4774. function initAssetRegisters (Vue) {
  4775. /**
  4776. * Create asset registration methods.
  4777. */
  4778. ASSET_TYPES.forEach(function (type) {
  4779. Vue[type] = function (
  4780. id,
  4781. definition
  4782. ) {
  4783. if (!definition) {
  4784. return this.options[type + 's'][id]
  4785. } else {
  4786. /* istanbul ignore if */
  4787. if (type === 'component') {
  4788. validateComponentName(id);
  4789. }
  4790. if (type === 'component' && isPlainObject(definition)) {
  4791. definition.name = definition.name || id;
  4792. definition = this.options._base.extend(definition);
  4793. }
  4794. if (type === 'directive' && typeof definition === 'function') {
  4795. definition = { bind: definition, update: definition };
  4796. }
  4797. this.options[type + 's'][id] = definition;
  4798. return definition
  4799. }
  4800. };
  4801. });
  4802. }
  4803. /* */
  4804. function getComponentName (opts) {
  4805. return opts && (opts.Ctor.options.name || opts.tag)
  4806. }
  4807. function matches (pattern, name) {
  4808. if (Array.isArray(pattern)) {
  4809. return pattern.indexOf(name) > -1
  4810. } else if (typeof pattern === 'string') {
  4811. return pattern.split(',').indexOf(name) > -1
  4812. } else if (isRegExp(pattern)) {
  4813. return pattern.test(name)
  4814. }
  4815. /* istanbul ignore next */
  4816. return false
  4817. }
  4818. function pruneCache (keepAliveInstance, filter) {
  4819. var cache = keepAliveInstance.cache;
  4820. var keys = keepAliveInstance.keys;
  4821. var _vnode = keepAliveInstance._vnode;
  4822. for (var key in cache) {
  4823. var cachedNode = cache[key];
  4824. if (cachedNode) {
  4825. var name = getComponentName(cachedNode.componentOptions);
  4826. if (name && !filter(name)) {
  4827. pruneCacheEntry(cache, key, keys, _vnode);
  4828. }
  4829. }
  4830. }
  4831. }
  4832. function pruneCacheEntry (
  4833. cache,
  4834. key,
  4835. keys,
  4836. current
  4837. ) {
  4838. var cached$$1 = cache[key];
  4839. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  4840. cached$$1.componentInstance.$destroy();
  4841. }
  4842. cache[key] = null;
  4843. remove(keys, key);
  4844. }
  4845. var patternTypes = [String, RegExp, Array];
  4846. var KeepAlive = {
  4847. name: 'keep-alive',
  4848. abstract: true,
  4849. props: {
  4850. include: patternTypes,
  4851. exclude: patternTypes,
  4852. max: [String, Number]
  4853. },
  4854. created: function created () {
  4855. this.cache = Object.create(null);
  4856. this.keys = [];
  4857. },
  4858. destroyed: function destroyed () {
  4859. for (var key in this.cache) {
  4860. pruneCacheEntry(this.cache, key, this.keys);
  4861. }
  4862. },
  4863. mounted: function mounted () {
  4864. var this$1 = this;
  4865. this.$watch('include', function (val) {
  4866. pruneCache(this$1, function (name) { return matches(val, name); });
  4867. });
  4868. this.$watch('exclude', function (val) {
  4869. pruneCache(this$1, function (name) { return !matches(val, name); });
  4870. });
  4871. },
  4872. render: function render () {
  4873. var slot = this.$slots.default;
  4874. var vnode = getFirstComponentChild(slot);
  4875. var componentOptions = vnode && vnode.componentOptions;
  4876. if (componentOptions) {
  4877. // check pattern
  4878. var name = getComponentName(componentOptions);
  4879. var ref = this;
  4880. var include = ref.include;
  4881. var exclude = ref.exclude;
  4882. if (
  4883. // not included
  4884. (include && (!name || !matches(include, name))) ||
  4885. // excluded
  4886. (exclude && name && matches(exclude, name))
  4887. ) {
  4888. return vnode
  4889. }
  4890. var ref$1 = this;
  4891. var cache = ref$1.cache;
  4892. var keys = ref$1.keys;
  4893. var key = vnode.key == null
  4894. // same constructor may get registered as different local components
  4895. // so cid alone is not enough (#3269)
  4896. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  4897. : vnode.key;
  4898. if (cache[key]) {
  4899. vnode.componentInstance = cache[key].componentInstance;
  4900. // make current key freshest
  4901. remove(keys, key);
  4902. keys.push(key);
  4903. } else {
  4904. cache[key] = vnode;
  4905. keys.push(key);
  4906. // prune oldest entry
  4907. if (this.max && keys.length > parseInt(this.max)) {
  4908. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  4909. }
  4910. }
  4911. vnode.data.keepAlive = true;
  4912. }
  4913. return vnode || (slot && slot[0])
  4914. }
  4915. };
  4916. var builtInComponents = {
  4917. KeepAlive: KeepAlive
  4918. };
  4919. /* */
  4920. function initGlobalAPI (Vue) {
  4921. // config
  4922. var configDef = {};
  4923. configDef.get = function () { return config; };
  4924. {
  4925. configDef.set = function () {
  4926. warn(
  4927. 'Do not replace the Vue.config object, set individual fields instead.'
  4928. );
  4929. };
  4930. }
  4931. Object.defineProperty(Vue, 'config', configDef);
  4932. // exposed util methods.
  4933. // NOTE: these are not considered part of the public API - avoid relying on
  4934. // them unless you are aware of the risk.
  4935. Vue.util = {
  4936. warn: warn,
  4937. extend: extend,
  4938. mergeOptions: mergeOptions,
  4939. defineReactive: defineReactive$$1
  4940. };
  4941. Vue.set = set;
  4942. Vue.delete = del;
  4943. Vue.nextTick = nextTick;
  4944. // 2.6 explicit observable API
  4945. Vue.observable = function (obj) {
  4946. observe(obj);
  4947. return obj
  4948. };
  4949. Vue.options = Object.create(null);
  4950. ASSET_TYPES.forEach(function (type) {
  4951. Vue.options[type + 's'] = Object.create(null);
  4952. });
  4953. // this is used to identify the "base" constructor to extend all plain-object
  4954. // components with in Weex's multi-instance scenarios.
  4955. Vue.options._base = Vue;
  4956. extend(Vue.options.components, builtInComponents);
  4957. initUse(Vue);
  4958. initMixin$1(Vue);
  4959. initExtend(Vue);
  4960. initAssetRegisters(Vue);
  4961. }
  4962. initGlobalAPI(Vue);
  4963. Object.defineProperty(Vue.prototype, '$isServer', {
  4964. get: isServerRendering
  4965. });
  4966. Object.defineProperty(Vue.prototype, '$ssrContext', {
  4967. get: function get () {
  4968. /* istanbul ignore next */
  4969. return this.$vnode && this.$vnode.ssrContext
  4970. }
  4971. });
  4972. // expose FunctionalRenderContext for ssr runtime helper installation
  4973. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  4974. value: FunctionalRenderContext
  4975. });
  4976. Vue.version = '2.6.11';
  4977. var nextNodeRef = 1;
  4978. function uniqueId() {
  4979. return (nextNodeRef++).toString()
  4980. }
  4981. var Node = function Node() {
  4982. this.nodeId = uniqueId();
  4983. this.ref = this.nodeId;
  4984. this.children = [];
  4985. this.pureChildren = [];
  4986. this.parentNode = null;
  4987. this.nextSibling = null;
  4988. this.previousSibling = null;
  4989. };
  4990. Node.prototype.destroy = function destroy () {
  4991. this._$vd && this._$vd.removeElement(this);
  4992. this.children.forEach(function (child) {
  4993. child.destroy();
  4994. });
  4995. };
  4996. var Comment = /*@__PURE__*/(function (Node$$1) {
  4997. function Comment(value) {
  4998. Node$$1.call(this);
  4999. this.nodeType = 8;
  5000. this.nodeId = uniqueId();
  5001. this.ref = this.nodeId;
  5002. this.type = 'comment';
  5003. this.value = value;
  5004. this.children = [];
  5005. this.pureChildren = [];
  5006. }
  5007. if ( Node$$1 ) Comment.__proto__ = Node$$1;
  5008. Comment.prototype = Object.create( Node$$1 && Node$$1.prototype );
  5009. Comment.prototype.constructor = Comment;
  5010. Comment.prototype.toString = function toString () {
  5011. return '<!-- ' + this.value + ' -->'
  5012. };
  5013. return Comment;
  5014. }(Node));
  5015. function appendBody(doc, node, before) {
  5016. var documentElement = doc.documentElement;
  5017. if (documentElement.pureChildren.length > 0 || node.parentNode) {
  5018. return
  5019. }
  5020. var children = documentElement.children;
  5021. var beforeIndex = children.indexOf(before);
  5022. if (beforeIndex < 0) {
  5023. children.push(node);
  5024. } else {
  5025. children.splice(beforeIndex, 0, node);
  5026. }
  5027. if (node.nodeType === 1) {
  5028. if (node.role === 'body') {
  5029. node.docId = doc.id;
  5030. node.ownerDocument = doc;
  5031. node.parentNode = documentElement;
  5032. linkParent(node, documentElement);
  5033. } else {
  5034. node.children.forEach(function (child) {
  5035. child.parentNode = node;
  5036. });
  5037. setBody(doc, node);
  5038. node.docId = doc.id;
  5039. node.ownerDocument = doc;
  5040. linkParent(node, documentElement);
  5041. }
  5042. documentElement.pureChildren.push(node);
  5043. } else {
  5044. node.parentNode = documentElement;
  5045. }
  5046. }
  5047. function setBody(doc, el) {
  5048. el.role = 'body';
  5049. el.depth = 1;
  5050. el.ref = '_root';
  5051. doc.body = el;
  5052. }
  5053. function linkParent(node, parent) {
  5054. node.parentNode = parent;
  5055. if (parent.docId) {
  5056. node.docId = parent.docId;
  5057. node.ownerDocument = parent.ownerDocument;
  5058. node.depth = parent.depth + 1;
  5059. }
  5060. node.children.forEach(function (child) {
  5061. linkParent(child, node);
  5062. });
  5063. }
  5064. function nextElement(node) {
  5065. while (node) {
  5066. if (node.nodeType === 1) {
  5067. return node
  5068. }
  5069. node = node.nextSibling;
  5070. }
  5071. }
  5072. function previousElement(node) {
  5073. while (node) {
  5074. if (node.nodeType === 1) {
  5075. return node
  5076. }
  5077. node = node.previousSibling;
  5078. }
  5079. }
  5080. function insertIndex(target, list, newIndex, changeSibling) {
  5081. if (newIndex < 0) {
  5082. newIndex = 0;
  5083. }
  5084. var before = list[newIndex - 1];
  5085. var after = list[newIndex];
  5086. list.splice(newIndex, 0, target);
  5087. if (changeSibling) {
  5088. before && (before.nextSibling = target);
  5089. target.previousSibling = before;
  5090. target.nextSibling = after;
  5091. after && (after.previousSibling = target);
  5092. }
  5093. return newIndex
  5094. }
  5095. function moveIndex(target, list, newIndex, changeSibling) {
  5096. var index = list.indexOf(target);
  5097. if (index < 0) {
  5098. return -1
  5099. }
  5100. if (changeSibling) {
  5101. var before = list[index - 1];
  5102. var after = list[index + 1];
  5103. before && (before.nextSibling = after);
  5104. after && (after.previousSibling = before);
  5105. }
  5106. list.splice(index, 1);
  5107. var newIndexAfter = newIndex;
  5108. if (index <= newIndex) {
  5109. newIndexAfter = newIndex - 1;
  5110. }
  5111. var beforeNew = list[newIndexAfter - 1];
  5112. var afterNew = list[newIndexAfter];
  5113. list.splice(newIndexAfter, 0, target);
  5114. if (changeSibling) {
  5115. beforeNew && (beforeNew.nextSibling = target);
  5116. target.previousSibling = beforeNew;
  5117. target.nextSibling = afterNew;
  5118. afterNew && (afterNew.previousSibling = target);
  5119. }
  5120. if (index === newIndexAfter) {
  5121. return -1
  5122. }
  5123. return newIndex
  5124. }
  5125. function removeIndex(target, list, changeSibling) {
  5126. var index = list.indexOf(target);
  5127. if (index < 0) {
  5128. return
  5129. }
  5130. if (changeSibling) {
  5131. var before = list[index - 1];
  5132. var after = list[index + 1];
  5133. before && (before.nextSibling = after);
  5134. after && (after.previousSibling = before);
  5135. }
  5136. list.splice(index, 1);
  5137. }
  5138. var DEFAULT_TAG_NAME = 'view';
  5139. var Element = /*@__PURE__*/(function (Node$$1) {
  5140. function Element(type) {
  5141. if ( type === void 0 ) type = DEFAULT_TAG_NAME;
  5142. Node$$1.call(this);
  5143. this.nodeType = 1;
  5144. this.nodeId = uniqueId();
  5145. this.ref = this.nodeId;
  5146. this.type = type;
  5147. this.attr = {};
  5148. this.events = {};
  5149. this.children = [];
  5150. this.pureChildren = [];
  5151. }
  5152. if ( Node$$1 ) Element.__proto__ = Node$$1;
  5153. Element.prototype = Object.create( Node$$1 && Node$$1.prototype );
  5154. Element.prototype.constructor = Element;
  5155. Element.prototype.setAttribute = function setAttribute (key, value) {
  5156. if (key === 'cid') {
  5157. this.cid = value;
  5158. } else if (key === 'nid') {
  5159. this.nid = value;
  5160. }
  5161. };
  5162. Element.prototype.dispatchEvent = function dispatchEvent (name, target) {
  5163. var handlers = this.events[name];
  5164. if (!handlers) {
  5165. return
  5166. }
  5167. handlers.forEach(function (handler) {
  5168. handler(target);
  5169. });
  5170. };
  5171. Element.prototype.addEventListener = function addEventListener (name, handler) {
  5172. if (this.cid === '' || this.nid === '') {
  5173. return console.error(("cid=" + (this.cid) + ",nid=" + (this.nid) + " addEventListener(" + name + ") not found"))
  5174. }
  5175. (this.events[name] || (this.events[name] = [])).push(handler);
  5176. this._$vd.addElement(this);
  5177. };
  5178. Element.prototype.removeEventListener = function removeEventListener (name, handler) {
  5179. var this$1 = this;
  5180. if (this.cid === '' || this.nid === '') {
  5181. return console.error(("cid=" + (this.cid) + ",nid=" + (this.nid) + " removeEventListener(" + name + ") not found"))
  5182. }
  5183. var isRemoved = false;
  5184. if (this.events[name]) {
  5185. var handlerIndex = this.events[name].indexOf(handler);
  5186. if (handlerIndex !== -1) {
  5187. this.events[name].splice(handlerIndex, 1);
  5188. isRemoved = true;
  5189. }
  5190. }
  5191. if (!isRemoved) {
  5192. console.error(("cid=" + (this.cid) + ",nid=" + (this.nid) + " removeEventListener(" + name + ") handler not found"));
  5193. }
  5194. Object.keys(this.events).every(function (eventType) { return this$1.events[eventType].length === 0; }) &&
  5195. this._$vd.removeElement(this);
  5196. };
  5197. Element.prototype.appendChild = function appendChild (node) {
  5198. if (node.parentNode && node.parentNode !== this) {
  5199. return
  5200. }
  5201. if (!node.parentNode) {
  5202. // if ("development" !== 'production') {
  5203. // console.log(`[appendChild](${this.docId},${node.type},${node.ref}) ` +
  5204. // `Append <${node.type}> to <${this.type}> (${this.ref}).`)
  5205. // }
  5206. linkParent(node, this);
  5207. insertIndex(node, this.children, this.children.length, true);
  5208. if (node.nodeType === 1) {
  5209. insertIndex(node, this.pureChildren, this.pureChildren.length);
  5210. }
  5211. } else {
  5212. // if ("development" !== 'production') {
  5213. // console.log(`[appendChild](${this.docId},${node.type},${node.ref}) ` +
  5214. // `Move <${node.type}> to ${this.children.length} of <${this.type}> (${this.ref}).`)
  5215. // }
  5216. moveIndex(node, this.children, this.children.length, true);
  5217. if (node.nodeType === 1) {
  5218. moveIndex(node, this.pureChildren, this.pureChildren.length);
  5219. }
  5220. }
  5221. };
  5222. Element.prototype.insertBefore = function insertBefore (node, before) {
  5223. if (node.parentNode && node.parentNode !== this) {
  5224. return
  5225. }
  5226. if (node === before || (node.nextSibling && node.nextSibling === before)) {
  5227. return
  5228. }
  5229. if (!node.parentNode) {
  5230. // if ("development" !== 'production') {
  5231. // console.log(`[insertBefore](${this.docId},${node.type},${node.ref}) ` +
  5232. // `Insert <${node.type}> to <${this.type}> (${this.ref}), before (${before.ref}).`)
  5233. // }
  5234. linkParent(node, this);
  5235. insertIndex(node, this.children, this.children.indexOf(before), true);
  5236. if (node.nodeType === 1) {
  5237. var pureBefore = nextElement(before);
  5238. insertIndex(
  5239. node,
  5240. this.pureChildren,
  5241. pureBefore ?
  5242. this.pureChildren.indexOf(pureBefore) :
  5243. this.pureChildren.length
  5244. );
  5245. }
  5246. } else {
  5247. moveIndex(node, this.children, this.children.indexOf(before), true);
  5248. if (node.nodeType === 1) {
  5249. var pureBefore$1 = nextElement(before);
  5250. moveIndex(
  5251. node,
  5252. this.pureChildren,
  5253. pureBefore$1 ?
  5254. this.pureChildren.indexOf(pureBefore$1) :
  5255. this.pureChildren.length
  5256. );
  5257. }
  5258. }
  5259. };
  5260. Element.prototype.insertAfter = function insertAfter (node, after) {
  5261. if (node.parentNode && node.parentNode !== this) {
  5262. return
  5263. }
  5264. if (node === after || (node.previousSibling && node.previousSibling === after)) {
  5265. return
  5266. }
  5267. if (!node.parentNode) {
  5268. // if ("development" !== 'production') {
  5269. // console.log(`[insertAfter](${this.docId},${node.type},${node.ref}) ` +
  5270. // `Insert <${node.type}> to <${this.type}> (${this.ref}), after (${after.ref}).`)
  5271. // }
  5272. linkParent(node, this);
  5273. insertIndex(node, this.children, this.children.indexOf(after) + 1, true);
  5274. if (node.nodeType === 1) {
  5275. insertIndex(
  5276. node,
  5277. this.pureChildren,
  5278. this.pureChildren.indexOf(previousElement(after)) + 1
  5279. );
  5280. }
  5281. } else {
  5282. moveIndex(node, this.children, this.children.indexOf(after) + 1, true);
  5283. if (node.nodeType === 1) {
  5284. moveIndex(
  5285. node,
  5286. this.pureChildren,
  5287. this.pureChildren.indexOf(previousElement(after)) + 1
  5288. );
  5289. }
  5290. }
  5291. };
  5292. Element.prototype.removeChild = function removeChild (node, preserved) {
  5293. if (node.parentNode) {
  5294. removeIndex(node, this.children, true);
  5295. if (node.nodeType === 1) {
  5296. // if ("development" !== 'production') {
  5297. // console.log(`[removeChild](${this.docId},${node.type},${node.ref}) ` +
  5298. // `Remove <${node.type}> from <${this.type}> (${this.ref}).`)
  5299. // }
  5300. removeIndex(node, this.pureChildren);
  5301. }
  5302. }
  5303. if (!preserved) {
  5304. node.destroy();
  5305. }
  5306. };
  5307. Element.prototype.clear = function clear () {
  5308. this.children.forEach(function (node) {
  5309. node.destroy();
  5310. });
  5311. this.children.length = 0;
  5312. this.pureChildren.length = 0;
  5313. };
  5314. Element.prototype.toString = function toString () {
  5315. return '<' + this.type +
  5316. ' attr=' + JSON.stringify(this.attr) +
  5317. ' style=' + JSON.stringify(this.toStyle()) + '>' +
  5318. this.pureChildren.map(function (child) { return child.toString(); }).join('') +
  5319. '</' + this.type + '>'
  5320. };
  5321. return Element;
  5322. }(Node));
  5323. var Document = function Document(id, url) {
  5324. this.id = id ? id.toString() : '';
  5325. this.URL = url;
  5326. this.createDocumentElement();
  5327. };
  5328. Document.prototype.createDocumentElement = function createDocumentElement () {
  5329. var this$1 = this;
  5330. if (!this.documentElement) {
  5331. var el = new Element('document');
  5332. el.docId = this.id;
  5333. el.ownerDocument = this;
  5334. el.role = 'documentElement';
  5335. el.depth = 0;
  5336. el.ref = '_documentElement';
  5337. this.documentElement = el;
  5338. Object.defineProperty(el, 'appendChild', {
  5339. configurable: true,
  5340. enumerable: true,
  5341. writable: true,
  5342. value: function (node) {
  5343. appendBody(this$1, node);
  5344. }
  5345. });
  5346. Object.defineProperty(el, 'insertBefore', {
  5347. configurable: true,
  5348. enumerable: true,
  5349. writable: true,
  5350. value: function (node, before) {
  5351. appendBody(this$1, node, before);
  5352. }
  5353. });
  5354. // if ("development" !== 'production') {
  5355. // console.log(`Create document element (id: "${el.docId}", ref: "${el.ref}")`)
  5356. // }
  5357. }
  5358. return this.documentElement
  5359. };
  5360. Document.prototype.createBody = function createBody (type) {
  5361. if (!this.body) {
  5362. var el = new Element(type);
  5363. setBody(this, el);
  5364. // if ("development" !== 'production') {
  5365. // console.log(`[createBody](${this.id},${el.type},${el.ref}) ` +
  5366. // `(${JSON.stringify(el.toJSON(true))}).`)
  5367. // }
  5368. }
  5369. return this.body
  5370. };
  5371. Document.prototype.createElement = function createElement (tagName) {
  5372. var el = new Element(tagName);
  5373. // if ("development" !== 'production') {
  5374. // console.log(`[createElement](${this.id},${el.type},${el.ref}) ` +
  5375. // `(${JSON.stringify(el.toJSON(true))}).`)
  5376. // }
  5377. return el
  5378. };
  5379. Document.prototype.createComment = function createComment (text) {
  5380. return new Comment(text)
  5381. };
  5382. Document.prototype.destroy = function destroy () {
  5383. // if ("development" !== 'production') {
  5384. // console.log(`[destroy](${this.id},document,${this.ref}) ` +
  5385. // `Destroy document (id: "${this.id}", URL: "${this.URL}")`)
  5386. // }
  5387. };
  5388. /* */
  5389. // these are reserved for web because they are directly compiled away
  5390. // during template compilation
  5391. var isReservedAttr = makeMap('style,class');
  5392. // attributes that should be using props for binding
  5393. var acceptValue = makeMap('input,textarea,option,select,progress');
  5394. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  5395. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  5396. var isBooleanAttr = makeMap(
  5397. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  5398. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  5399. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  5400. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  5401. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  5402. 'truespeed,typemustmatch,visible'
  5403. );
  5404. /* */
  5405. var isReservedTag = makeMap(
  5406. 'html,body,base,head,link,meta,style,title,' +
  5407. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  5408. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  5409. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  5410. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  5411. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  5412. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  5413. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  5414. 'output,progress,select,textarea,' +
  5415. 'details,dialog,menu,menuitem,summary,' +
  5416. 'content,element,shadow,template,blockquote,iframe,tfoot'
  5417. );
  5418. function mustUseProp$1 () {
  5419. return false
  5420. }
  5421. function getTagNamespace () { }
  5422. function isUnknownElement () {
  5423. return false
  5424. }
  5425. /* */
  5426. function createElement$1(tagName) {
  5427. return new Element(tagName)
  5428. }
  5429. function createElementNS(namespace, tagName) {
  5430. return new Element(namespace + ':' + tagName)
  5431. }
  5432. function createTextNode() {
  5433. return new Element('text')
  5434. }
  5435. function createComment(text) {
  5436. return new Comment(text)
  5437. }
  5438. function insertBefore(node, target, before) {
  5439. node.insertBefore(target, before);
  5440. }
  5441. function removeChild(node, child) {
  5442. node.removeChild(child);
  5443. }
  5444. function appendChild(node, child) {
  5445. node.appendChild(child);
  5446. }
  5447. function parentNode(node) {
  5448. return node.parentNode
  5449. }
  5450. function nextSibling(node) {
  5451. return node.nextSibling
  5452. }
  5453. function tagName(node) {
  5454. return node.type
  5455. }
  5456. function setTextContent() {}
  5457. function setStyleScope() {}
  5458. var nodeOps = /*#__PURE__*/Object.freeze({
  5459. createElement: createElement$1,
  5460. createElementNS: createElementNS,
  5461. createTextNode: createTextNode,
  5462. createComment: createComment,
  5463. insertBefore: insertBefore,
  5464. removeChild: removeChild,
  5465. appendChild: appendChild,
  5466. parentNode: parentNode,
  5467. nextSibling: nextSibling,
  5468. tagName: tagName,
  5469. setTextContent: setTextContent,
  5470. setStyleScope: setStyleScope
  5471. });
  5472. /* */
  5473. var ref = {
  5474. create: function create (_, vnode) {
  5475. registerRef(vnode);
  5476. },
  5477. update: function update (oldVnode, vnode) {
  5478. if (oldVnode.data.ref !== vnode.data.ref) {
  5479. registerRef(oldVnode, true);
  5480. registerRef(vnode);
  5481. }
  5482. },
  5483. destroy: function destroy (vnode) {
  5484. registerRef(vnode, true);
  5485. }
  5486. };
  5487. function registerRef (vnode, isRemoval) {
  5488. var key = vnode.data.ref;
  5489. if (!isDef(key)) { return }
  5490. var vm = vnode.context;
  5491. var ref = vnode.componentInstance || vnode.elm;
  5492. var refs = vm.$refs;
  5493. if (isRemoval) {
  5494. if (Array.isArray(refs[key])) {
  5495. remove(refs[key], ref);
  5496. } else if (refs[key] === ref) {
  5497. refs[key] = undefined;
  5498. }
  5499. } else {
  5500. if (vnode.data.refInFor) {
  5501. if (!Array.isArray(refs[key])) {
  5502. refs[key] = [ref];
  5503. } else if (refs[key].indexOf(ref) < 0) {
  5504. // $flow-disable-line
  5505. refs[key].push(ref);
  5506. }
  5507. } else {
  5508. refs[key] = ref;
  5509. }
  5510. }
  5511. }
  5512. /* */
  5513. var isHTMLTag = makeMap(
  5514. 'html,body,base,head,link,meta,style,title,' +
  5515. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  5516. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  5517. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  5518. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  5519. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  5520. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  5521. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  5522. 'output,progress,select,textarea,' +
  5523. 'details,dialog,menu,menuitem,summary,' +
  5524. 'content,element,shadow,template,blockquote,iframe,tfoot'
  5525. );
  5526. // this map is intentionally selective, only covering SVG elements that may
  5527. // contain child elements.
  5528. var isSVG = makeMap(
  5529. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  5530. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  5531. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  5532. true
  5533. );
  5534. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  5535. /**
  5536. * Virtual DOM patching algorithm based on Snabbdom by
  5537. * Simon Friis Vindum (@paldepind)
  5538. * Licensed under the MIT License
  5539. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  5540. *
  5541. * modified by Evan You (@yyx990803)
  5542. *
  5543. * Not type-checking this because this file is perf-critical and the cost
  5544. * of making flow understand it is not worth it.
  5545. */
  5546. var emptyNode = new VNode('', {}, []);
  5547. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  5548. function sameVnode (a, b) {
  5549. return (
  5550. a.key === b.key && (
  5551. (
  5552. a.tag === b.tag &&
  5553. a.isComment === b.isComment &&
  5554. isDef(a.data) === isDef(b.data) &&
  5555. sameInputType(a, b)
  5556. ) || (
  5557. isTrue(a.isAsyncPlaceholder) &&
  5558. a.asyncFactory === b.asyncFactory &&
  5559. isUndef(b.asyncFactory.error)
  5560. )
  5561. )
  5562. )
  5563. }
  5564. function sameInputType (a, b) {
  5565. if (a.tag !== 'input') { return true }
  5566. var i;
  5567. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  5568. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  5569. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  5570. }
  5571. function createKeyToOldIdx (children, beginIdx, endIdx) {
  5572. var i, key;
  5573. var map = {};
  5574. for (i = beginIdx; i <= endIdx; ++i) {
  5575. key = children[i].key;
  5576. if (isDef(key)) { map[key] = i; }
  5577. }
  5578. return map
  5579. }
  5580. function createPatchFunction (backend) {
  5581. var i, j;
  5582. var cbs = {};
  5583. var modules = backend.modules;
  5584. var nodeOps = backend.nodeOps;
  5585. for (i = 0; i < hooks.length; ++i) {
  5586. cbs[hooks[i]] = [];
  5587. for (j = 0; j < modules.length; ++j) {
  5588. if (isDef(modules[j][hooks[i]])) {
  5589. cbs[hooks[i]].push(modules[j][hooks[i]]);
  5590. }
  5591. }
  5592. }
  5593. function emptyNodeAt (elm) {
  5594. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  5595. }
  5596. function createRmCb (childElm, listeners) {
  5597. function remove$$1 () {
  5598. if (--remove$$1.listeners === 0) {
  5599. removeNode(childElm);
  5600. }
  5601. }
  5602. remove$$1.listeners = listeners;
  5603. return remove$$1
  5604. }
  5605. function removeNode (el) {
  5606. var parent = nodeOps.parentNode(el);
  5607. // element may have already been removed due to v-html / v-text
  5608. if (isDef(parent)) {
  5609. nodeOps.removeChild(parent, el);
  5610. }
  5611. }
  5612. function isUnknownElement (vnode, inVPre) {
  5613. return (
  5614. !inVPre &&
  5615. !vnode.ns &&
  5616. !(
  5617. config.ignoredElements.length &&
  5618. config.ignoredElements.some(function (ignore) {
  5619. return isRegExp(ignore)
  5620. ? ignore.test(vnode.tag)
  5621. : ignore === vnode.tag
  5622. })
  5623. ) &&
  5624. config.isUnknownElement(vnode.tag)
  5625. )
  5626. }
  5627. var creatingElmInVPre = 0;
  5628. function createElm (
  5629. vnode,
  5630. insertedVnodeQueue,
  5631. parentElm,
  5632. refElm,
  5633. nested,
  5634. ownerArray,
  5635. index
  5636. ) {
  5637. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5638. // This vnode was used in a previous render!
  5639. // now it's used as a new node, overwriting its elm would cause
  5640. // potential patch errors down the road when it's used as an insertion
  5641. // reference node. Instead, we clone the node on-demand before creating
  5642. // associated DOM element for it.
  5643. vnode = ownerArray[index] = cloneVNode(vnode);
  5644. }
  5645. vnode.isRootInsert = !nested; // for transition enter check
  5646. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  5647. return
  5648. }
  5649. var data = vnode.data;
  5650. var children = vnode.children;
  5651. var tag = vnode.tag;
  5652. if (isDef(tag)) {
  5653. {
  5654. if (data && data.pre) {
  5655. creatingElmInVPre++;
  5656. }
  5657. if (isUnknownElement(vnode, creatingElmInVPre)) {
  5658. warn(
  5659. 'Unknown custom element: <' + tag + '> - did you ' +
  5660. 'register the component correctly? For recursive components, ' +
  5661. 'make sure to provide the "name" option.',
  5662. vnode.context
  5663. );
  5664. }
  5665. }
  5666. vnode.elm = vnode.ns
  5667. ? nodeOps.createElementNS(vnode.ns, tag)
  5668. : nodeOps.createElement(tag, vnode);
  5669. setScope(vnode);
  5670. /* istanbul ignore if */
  5671. {
  5672. createChildren(vnode, children, insertedVnodeQueue);
  5673. if (isDef(data)) {
  5674. invokeCreateHooks(vnode, insertedVnodeQueue);
  5675. }
  5676. insert(parentElm, vnode.elm, refElm);
  5677. }
  5678. if (data && data.pre) {
  5679. creatingElmInVPre--;
  5680. }
  5681. } else if (isTrue(vnode.isComment)) {
  5682. vnode.elm = nodeOps.createComment(vnode.text);
  5683. insert(parentElm, vnode.elm, refElm);
  5684. } else {
  5685. vnode.elm = nodeOps.createTextNode(vnode.text);
  5686. insert(parentElm, vnode.elm, refElm);
  5687. }
  5688. }
  5689. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5690. var i = vnode.data;
  5691. if (isDef(i)) {
  5692. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  5693. if (isDef(i = i.hook) && isDef(i = i.init)) {
  5694. i(vnode, false /* hydrating */);
  5695. }
  5696. // after calling the init hook, if the vnode is a child component
  5697. // it should've created a child instance and mounted it. the child
  5698. // component also has set the placeholder vnode's elm.
  5699. // in that case we can just return the element and be done.
  5700. if (isDef(vnode.componentInstance)) {
  5701. initComponent(vnode, insertedVnodeQueue);
  5702. insert(parentElm, vnode.elm, refElm);
  5703. if (isTrue(isReactivated)) {
  5704. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  5705. }
  5706. return true
  5707. }
  5708. }
  5709. }
  5710. function initComponent (vnode, insertedVnodeQueue) {
  5711. if (isDef(vnode.data.pendingInsert)) {
  5712. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  5713. vnode.data.pendingInsert = null;
  5714. }
  5715. vnode.elm = vnode.componentInstance.$el;
  5716. if (isPatchable(vnode)) {
  5717. invokeCreateHooks(vnode, insertedVnodeQueue);
  5718. setScope(vnode);
  5719. } else {
  5720. // empty component root.
  5721. // skip all element-related modules except for ref (#3455)
  5722. registerRef(vnode);
  5723. // make sure to invoke the insert hook
  5724. insertedVnodeQueue.push(vnode);
  5725. }
  5726. }
  5727. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5728. var i;
  5729. // hack for #4339: a reactivated component with inner transition
  5730. // does not trigger because the inner node's created hooks are not called
  5731. // again. It's not ideal to involve module-specific logic in here but
  5732. // there doesn't seem to be a better way to do it.
  5733. var innerNode = vnode;
  5734. while (innerNode.componentInstance) {
  5735. innerNode = innerNode.componentInstance._vnode;
  5736. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  5737. for (i = 0; i < cbs.activate.length; ++i) {
  5738. cbs.activate[i](emptyNode, innerNode);
  5739. }
  5740. insertedVnodeQueue.push(innerNode);
  5741. break
  5742. }
  5743. }
  5744. // unlike a newly created component,
  5745. // a reactivated keep-alive component doesn't insert itself
  5746. insert(parentElm, vnode.elm, refElm);
  5747. }
  5748. function insert (parent, elm, ref$$1) {
  5749. if (isDef(parent)) {
  5750. if (isDef(ref$$1)) {
  5751. if (nodeOps.parentNode(ref$$1) === parent) {
  5752. nodeOps.insertBefore(parent, elm, ref$$1);
  5753. }
  5754. } else {
  5755. nodeOps.appendChild(parent, elm);
  5756. }
  5757. }
  5758. }
  5759. function createChildren (vnode, children, insertedVnodeQueue) {
  5760. if (Array.isArray(children)) {
  5761. {
  5762. checkDuplicateKeys(children);
  5763. }
  5764. for (var i = 0; i < children.length; ++i) {
  5765. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  5766. }
  5767. } else if (isPrimitive(vnode.text)) {
  5768. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  5769. }
  5770. }
  5771. function isPatchable (vnode) {
  5772. while (vnode.componentInstance) {
  5773. vnode = vnode.componentInstance._vnode;
  5774. }
  5775. return isDef(vnode.tag)
  5776. }
  5777. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  5778. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5779. cbs.create[i$1](emptyNode, vnode);
  5780. }
  5781. i = vnode.data.hook; // Reuse variable
  5782. if (isDef(i)) {
  5783. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  5784. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  5785. }
  5786. }
  5787. // set scope id attribute for scoped CSS.
  5788. // this is implemented as a special case to avoid the overhead
  5789. // of going through the normal attribute patching process.
  5790. function setScope (vnode) {
  5791. var i;
  5792. if (isDef(i = vnode.fnScopeId)) {
  5793. nodeOps.setStyleScope(vnode.elm, i);
  5794. } else {
  5795. var ancestor = vnode;
  5796. while (ancestor) {
  5797. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  5798. nodeOps.setStyleScope(vnode.elm, i);
  5799. }
  5800. ancestor = ancestor.parent;
  5801. }
  5802. }
  5803. // for slot content they should also get the scopeId from the host instance.
  5804. if (isDef(i = activeInstance) &&
  5805. i !== vnode.context &&
  5806. i !== vnode.fnContext &&
  5807. isDef(i = i.$options._scopeId)
  5808. ) {
  5809. nodeOps.setStyleScope(vnode.elm, i);
  5810. }
  5811. }
  5812. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  5813. for (; startIdx <= endIdx; ++startIdx) {
  5814. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  5815. }
  5816. }
  5817. function invokeDestroyHook (vnode) {
  5818. var i, j;
  5819. var data = vnode.data;
  5820. if (isDef(data)) {
  5821. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  5822. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  5823. }
  5824. if (isDef(i = vnode.children)) {
  5825. for (j = 0; j < vnode.children.length; ++j) {
  5826. invokeDestroyHook(vnode.children[j]);
  5827. }
  5828. }
  5829. }
  5830. function removeVnodes (vnodes, startIdx, endIdx) {
  5831. for (; startIdx <= endIdx; ++startIdx) {
  5832. var ch = vnodes[startIdx];
  5833. if (isDef(ch)) {
  5834. if (isDef(ch.tag)) {
  5835. removeAndInvokeRemoveHook(ch);
  5836. invokeDestroyHook(ch);
  5837. } else { // Text node
  5838. removeNode(ch.elm);
  5839. }
  5840. }
  5841. }
  5842. }
  5843. function removeAndInvokeRemoveHook (vnode, rm) {
  5844. if (isDef(rm) || isDef(vnode.data)) {
  5845. var i, children;
  5846. var listeners = cbs.remove.length + 1;
  5847. if (isDef(rm)) {
  5848. // we have a recursively passed down rm callback
  5849. // increase the listeners count
  5850. rm.listeners += listeners;
  5851. } else {
  5852. // directly removing
  5853. rm = createRmCb(vnode.elm, listeners);
  5854. }
  5855. // recursively invoke hooks on child component root node
  5856. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  5857. removeAndInvokeRemoveHook(i, rm);
  5858. } else if (isDef(children = vnode.children)) {
  5859. // fixed by xxxxxx
  5860. // app-plus service 层 elm 暂未实现父子关系维护,移除父 elm 时,导致子 elm 还存留(影响了事件查找)
  5861. // 暂时使用 vnode 的 children 递归 rm 掉子 elm
  5862. for (i = 0; i < children.length; i++) {
  5863. if (children[i].tag) {
  5864. removeAndInvokeRemoveHook(children[i]);
  5865. }
  5866. }
  5867. }
  5868. for (i = 0; i < cbs.remove.length; ++i) {
  5869. cbs.remove[i](vnode, rm);
  5870. }
  5871. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  5872. i(vnode, rm);
  5873. } else {
  5874. rm();
  5875. }
  5876. } else {
  5877. removeNode(vnode.elm);
  5878. }
  5879. }
  5880. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  5881. var oldStartIdx = 0;
  5882. var newStartIdx = 0;
  5883. var oldEndIdx = oldCh.length - 1;
  5884. var oldStartVnode = oldCh[0];
  5885. var oldEndVnode = oldCh[oldEndIdx];
  5886. var newEndIdx = newCh.length - 1;
  5887. var newStartVnode = newCh[0];
  5888. var newEndVnode = newCh[newEndIdx];
  5889. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  5890. // removeOnly is a special flag used only by <transition-group>
  5891. // to ensure removed elements stay in correct relative positions
  5892. // during leaving transitions
  5893. var canMove = !removeOnly;
  5894. {
  5895. checkDuplicateKeys(newCh);
  5896. }
  5897. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  5898. if (isUndef(oldStartVnode)) {
  5899. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  5900. } else if (isUndef(oldEndVnode)) {
  5901. oldEndVnode = oldCh[--oldEndIdx];
  5902. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  5903. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5904. oldStartVnode = oldCh[++oldStartIdx];
  5905. newStartVnode = newCh[++newStartIdx];
  5906. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  5907. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5908. oldEndVnode = oldCh[--oldEndIdx];
  5909. newEndVnode = newCh[--newEndIdx];
  5910. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  5911. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5912. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  5913. oldStartVnode = oldCh[++oldStartIdx];
  5914. newEndVnode = newCh[--newEndIdx];
  5915. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  5916. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5917. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  5918. oldEndVnode = oldCh[--oldEndIdx];
  5919. newStartVnode = newCh[++newStartIdx];
  5920. } else {
  5921. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  5922. idxInOld = isDef(newStartVnode.key)
  5923. ? oldKeyToIdx[newStartVnode.key]
  5924. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  5925. if (isUndef(idxInOld)) { // New element
  5926. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5927. } else {
  5928. vnodeToMove = oldCh[idxInOld];
  5929. if (sameVnode(vnodeToMove, newStartVnode)) {
  5930. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5931. oldCh[idxInOld] = undefined;
  5932. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  5933. } else {
  5934. // same key but different element. treat as new element
  5935. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5936. }
  5937. }
  5938. newStartVnode = newCh[++newStartIdx];
  5939. }
  5940. }
  5941. if (oldStartIdx > oldEndIdx) {
  5942. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  5943. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  5944. } else if (newStartIdx > newEndIdx) {
  5945. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  5946. }
  5947. }
  5948. function checkDuplicateKeys (children) {
  5949. var seenKeys = {};
  5950. for (var i = 0; i < children.length; i++) {
  5951. var vnode = children[i];
  5952. var key = vnode.key;
  5953. if (isDef(key)) {
  5954. if (seenKeys[key]) {
  5955. warn(
  5956. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  5957. vnode.context
  5958. );
  5959. } else {
  5960. seenKeys[key] = true;
  5961. }
  5962. }
  5963. }
  5964. }
  5965. function findIdxInOld (node, oldCh, start, end) {
  5966. for (var i = start; i < end; i++) {
  5967. var c = oldCh[i];
  5968. if (isDef(c) && sameVnode(node, c)) { return i }
  5969. }
  5970. }
  5971. function patchVnode (
  5972. oldVnode,
  5973. vnode,
  5974. insertedVnodeQueue,
  5975. ownerArray,
  5976. index,
  5977. removeOnly
  5978. ) {
  5979. if (oldVnode === vnode) {
  5980. return
  5981. }
  5982. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5983. // clone reused vnode
  5984. vnode = ownerArray[index] = cloneVNode(vnode);
  5985. }
  5986. var elm = vnode.elm = oldVnode.elm;
  5987. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  5988. if (isDef(vnode.asyncFactory.resolved)) {
  5989. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  5990. } else {
  5991. vnode.isAsyncPlaceholder = true;
  5992. }
  5993. return
  5994. }
  5995. // reuse element for static trees.
  5996. // note we only do this if the vnode is cloned -
  5997. // if the new node is not cloned it means the render functions have been
  5998. // reset by the hot-reload-api and we need to do a proper re-render.
  5999. if (isTrue(vnode.isStatic) &&
  6000. isTrue(oldVnode.isStatic) &&
  6001. vnode.key === oldVnode.key &&
  6002. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  6003. ) {
  6004. vnode.componentInstance = oldVnode.componentInstance;
  6005. return
  6006. }
  6007. var i;
  6008. var data = vnode.data;
  6009. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  6010. i(oldVnode, vnode);
  6011. }
  6012. var oldCh = oldVnode.children;
  6013. var ch = vnode.children;
  6014. if (isDef(data) && isPatchable(vnode)) {
  6015. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  6016. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  6017. }
  6018. if (isUndef(vnode.text)) {
  6019. if (isDef(oldCh) && isDef(ch)) {
  6020. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  6021. } else if (isDef(ch)) {
  6022. {
  6023. checkDuplicateKeys(ch);
  6024. }
  6025. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  6026. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  6027. } else if (isDef(oldCh)) {
  6028. removeVnodes(oldCh, 0, oldCh.length - 1);
  6029. } else if (isDef(oldVnode.text)) {
  6030. nodeOps.setTextContent(elm, '');
  6031. }
  6032. } else if (oldVnode.text !== vnode.text) {
  6033. nodeOps.setTextContent(elm, vnode.text);
  6034. }
  6035. if (isDef(data)) {
  6036. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  6037. }
  6038. }
  6039. function invokeInsertHook (vnode, queue, initial) {
  6040. // delay insert hooks for component root nodes, invoke them after the
  6041. // element is really inserted
  6042. if (isTrue(initial) && isDef(vnode.parent)) {
  6043. vnode.parent.data.pendingInsert = queue;
  6044. } else {
  6045. for (var i = 0; i < queue.length; ++i) {
  6046. queue[i].data.hook.insert(queue[i]);
  6047. }
  6048. }
  6049. }
  6050. var hydrationBailed = false;
  6051. // list of modules that can skip create hook during hydration because they
  6052. // are already rendered on the client or has no need for initialization
  6053. // Note: style is excluded because it relies on initial clone for future
  6054. // deep updates (#7063).
  6055. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  6056. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  6057. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  6058. var i;
  6059. var tag = vnode.tag;
  6060. var data = vnode.data;
  6061. var children = vnode.children;
  6062. inVPre = inVPre || (data && data.pre);
  6063. vnode.elm = elm;
  6064. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  6065. vnode.isAsyncPlaceholder = true;
  6066. return true
  6067. }
  6068. // assert node match
  6069. {
  6070. if (!assertNodeMatch(elm, vnode, inVPre)) {
  6071. return false
  6072. }
  6073. }
  6074. if (isDef(data)) {
  6075. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  6076. if (isDef(i = vnode.componentInstance)) {
  6077. // child component. it should have hydrated its own tree.
  6078. initComponent(vnode, insertedVnodeQueue);
  6079. return true
  6080. }
  6081. }
  6082. if (isDef(tag)) {
  6083. if (isDef(children)) {
  6084. // empty element, allow client to pick up and populate children
  6085. if (!elm.hasChildNodes()) {
  6086. createChildren(vnode, children, insertedVnodeQueue);
  6087. } else {
  6088. // v-html and domProps: innerHTML
  6089. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  6090. if (i !== elm.innerHTML) {
  6091. /* istanbul ignore if */
  6092. if (typeof console !== 'undefined' &&
  6093. !hydrationBailed
  6094. ) {
  6095. hydrationBailed = true;
  6096. console.warn('Parent: ', elm);
  6097. console.warn('server innerHTML: ', i);
  6098. console.warn('client innerHTML: ', elm.innerHTML);
  6099. }
  6100. return false
  6101. }
  6102. } else {
  6103. // iterate and compare children lists
  6104. var childrenMatch = true;
  6105. var childNode = elm.firstChild;
  6106. for (var i$1 = 0; i$1 < children.length; i$1++) {
  6107. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  6108. childrenMatch = false;
  6109. break
  6110. }
  6111. childNode = childNode.nextSibling;
  6112. }
  6113. // if childNode is not null, it means the actual childNodes list is
  6114. // longer than the virtual children list.
  6115. if (!childrenMatch || childNode) {
  6116. /* istanbul ignore if */
  6117. if (typeof console !== 'undefined' &&
  6118. !hydrationBailed
  6119. ) {
  6120. hydrationBailed = true;
  6121. console.warn('Parent: ', elm);
  6122. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  6123. }
  6124. return false
  6125. }
  6126. }
  6127. }
  6128. }
  6129. if (isDef(data)) {
  6130. var fullInvoke = false;
  6131. for (var key in data) {
  6132. if (!isRenderedModule(key)) {
  6133. fullInvoke = true;
  6134. invokeCreateHooks(vnode, insertedVnodeQueue);
  6135. break
  6136. }
  6137. }
  6138. if (!fullInvoke && data['class']) {
  6139. // ensure collecting deps for deep class bindings for future updates
  6140. traverse(data['class']);
  6141. }
  6142. }
  6143. } else if (elm.data !== vnode.text) {
  6144. elm.data = vnode.text;
  6145. }
  6146. return true
  6147. }
  6148. function assertNodeMatch (node, vnode, inVPre) {
  6149. if (isDef(vnode.tag)) {
  6150. return vnode.tag.indexOf('vue-component') === 0 || (
  6151. !isUnknownElement(vnode, inVPre) &&
  6152. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  6153. )
  6154. } else {
  6155. return node.nodeType === (vnode.isComment ? 8 : 3)
  6156. }
  6157. }
  6158. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  6159. if (isUndef(vnode)) {
  6160. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  6161. return
  6162. }
  6163. var isInitialPatch = false;
  6164. var insertedVnodeQueue = [];
  6165. if (isUndef(oldVnode)) {
  6166. // empty mount (likely as component), create new root element
  6167. isInitialPatch = true;
  6168. createElm(vnode, insertedVnodeQueue);
  6169. } else {
  6170. var isRealElement = isDef(oldVnode.nodeType);
  6171. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  6172. // patch existing root node
  6173. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  6174. } else {
  6175. if (isRealElement) {
  6176. // mounting to a real element
  6177. // check if this is server-rendered content and if we can perform
  6178. // a successful hydration.
  6179. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  6180. oldVnode.removeAttribute(SSR_ATTR);
  6181. hydrating = true;
  6182. }
  6183. if (isTrue(hydrating)) {
  6184. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  6185. invokeInsertHook(vnode, insertedVnodeQueue, true);
  6186. return oldVnode
  6187. } else {
  6188. warn(
  6189. 'The client-side rendered virtual DOM tree is not matching ' +
  6190. 'server-rendered content. This is likely caused by incorrect ' +
  6191. 'HTML markup, for example nesting block-level elements inside ' +
  6192. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  6193. 'full client-side render.'
  6194. );
  6195. }
  6196. }
  6197. // either not server-rendered, or hydration failed.
  6198. // create an empty node and replace it
  6199. oldVnode = emptyNodeAt(oldVnode);
  6200. }
  6201. // replacing existing element
  6202. var oldElm = oldVnode.elm;
  6203. var parentElm = nodeOps.parentNode(oldElm);
  6204. // create new node
  6205. createElm(
  6206. vnode,
  6207. insertedVnodeQueue,
  6208. // extremely rare edge case: do not insert if old element is in a
  6209. // leaving transition. Only happens when combining transition +
  6210. // keep-alive + HOCs. (#4590)
  6211. oldElm._leaveCb ? null : parentElm,
  6212. nodeOps.nextSibling(oldElm)
  6213. );
  6214. // update parent placeholder node element, recursively
  6215. if (isDef(vnode.parent)) {
  6216. var ancestor = vnode.parent;
  6217. var patchable = isPatchable(vnode);
  6218. while (ancestor) {
  6219. for (var i = 0; i < cbs.destroy.length; ++i) {
  6220. cbs.destroy[i](ancestor);
  6221. }
  6222. ancestor.elm = vnode.elm;
  6223. if (patchable) {
  6224. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  6225. cbs.create[i$1](emptyNode, ancestor);
  6226. }
  6227. // #6513
  6228. // invoke insert hooks that may have been merged by create hooks.
  6229. // e.g. for directives that uses the "inserted" hook.
  6230. var insert = ancestor.data.hook.insert;
  6231. if (insert.merged) {
  6232. // start at index 1 to avoid re-invoking component mounted hook
  6233. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  6234. insert.fns[i$2]();
  6235. }
  6236. }
  6237. } else {
  6238. registerRef(ancestor);
  6239. }
  6240. ancestor = ancestor.parent;
  6241. }
  6242. }
  6243. // destroy old node
  6244. if (isDef(parentElm)) {
  6245. removeVnodes([oldVnode], 0, 0);
  6246. } else if (isDef(oldVnode.tag)) {
  6247. invokeDestroyHook(oldVnode);
  6248. }
  6249. }
  6250. }
  6251. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  6252. return vnode.elm
  6253. }
  6254. }
  6255. /* */
  6256. var directives = {
  6257. create: updateDirectives,
  6258. update: updateDirectives,
  6259. destroy: function unbindDirectives (vnode) {
  6260. updateDirectives(vnode, emptyNode);
  6261. }
  6262. };
  6263. function updateDirectives (oldVnode, vnode) {
  6264. if (oldVnode.data.directives || vnode.data.directives) {
  6265. _update(oldVnode, vnode);
  6266. }
  6267. }
  6268. function _update (oldVnode, vnode) {
  6269. var isCreate = oldVnode === emptyNode;
  6270. var isDestroy = vnode === emptyNode;
  6271. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  6272. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  6273. var dirsWithInsert = [];
  6274. var dirsWithPostpatch = [];
  6275. var key, oldDir, dir;
  6276. for (key in newDirs) {
  6277. oldDir = oldDirs[key];
  6278. dir = newDirs[key];
  6279. if (!oldDir) {
  6280. // new directive, bind
  6281. callHook$1(dir, 'bind', vnode, oldVnode);
  6282. if (dir.def && dir.def.inserted) {
  6283. dirsWithInsert.push(dir);
  6284. }
  6285. } else {
  6286. // existing directive, update
  6287. dir.oldValue = oldDir.value;
  6288. dir.oldArg = oldDir.arg;
  6289. callHook$1(dir, 'update', vnode, oldVnode);
  6290. if (dir.def && dir.def.componentUpdated) {
  6291. dirsWithPostpatch.push(dir);
  6292. }
  6293. }
  6294. }
  6295. if (dirsWithInsert.length) {
  6296. var callInsert = function () {
  6297. for (var i = 0; i < dirsWithInsert.length; i++) {
  6298. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  6299. }
  6300. };
  6301. if (isCreate) {
  6302. mergeVNodeHook(vnode, 'insert', callInsert);
  6303. } else {
  6304. callInsert();
  6305. }
  6306. }
  6307. if (dirsWithPostpatch.length) {
  6308. mergeVNodeHook(vnode, 'postpatch', function () {
  6309. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  6310. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  6311. }
  6312. });
  6313. }
  6314. if (!isCreate) {
  6315. for (key in oldDirs) {
  6316. if (!newDirs[key]) {
  6317. // no longer present, unbind
  6318. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  6319. }
  6320. }
  6321. }
  6322. }
  6323. var emptyModifiers = Object.create(null);
  6324. function normalizeDirectives$1 (
  6325. dirs,
  6326. vm
  6327. ) {
  6328. var res = Object.create(null);
  6329. if (!dirs) {
  6330. // $flow-disable-line
  6331. return res
  6332. }
  6333. var i, dir;
  6334. for (i = 0; i < dirs.length; i++) {
  6335. dir = dirs[i];
  6336. if (!dir.modifiers) {
  6337. // $flow-disable-line
  6338. dir.modifiers = emptyModifiers;
  6339. }
  6340. res[getRawDirName(dir)] = dir;
  6341. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  6342. }
  6343. // $flow-disable-line
  6344. return res
  6345. }
  6346. function getRawDirName (dir) {
  6347. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  6348. }
  6349. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  6350. var fn = dir.def && dir.def[hook];
  6351. if (fn) {
  6352. try {
  6353. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  6354. } catch (e) {
  6355. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  6356. }
  6357. }
  6358. }
  6359. var baseModules = [
  6360. ref,
  6361. directives
  6362. ];
  6363. /* */
  6364. function updateWxsProps(oldVnode, vnode) {
  6365. if (
  6366. isUndef(oldVnode.data.wxsProps) &&
  6367. isUndef(vnode.data.wxsProps)
  6368. ) {
  6369. return
  6370. }
  6371. var oldWxsWatches = oldVnode.$wxsWatches;
  6372. var wxsPropsKey = Object.keys(vnode.data.wxsProps);
  6373. if (!oldWxsWatches && !wxsPropsKey.length) {
  6374. return
  6375. }
  6376. if (!oldWxsWatches) {
  6377. oldWxsWatches = {};
  6378. }
  6379. var wxsProps = vnode.data.wxsProps;
  6380. vnode.$wxsWatches = {};
  6381. Object.keys(wxsProps).forEach(function (prop) {
  6382. var watchProp = wxsProps[prop];
  6383. vnode.$wxsWatches[prop] = oldWxsWatches[prop] || vnode.context.$watch(watchProp, function() {
  6384. this.$forceUpdate();
  6385. }, {
  6386. deep: true
  6387. });
  6388. });
  6389. Object.keys(oldWxsWatches).forEach(function (oldName) {
  6390. if (!vnode.$wxsWatches[oldName]) {
  6391. oldWxsWatches[oldName]();
  6392. delete oldWxsWatches[oldName];
  6393. }
  6394. });
  6395. }
  6396. var wxs = {
  6397. create: updateWxsProps,
  6398. update: updateWxsProps
  6399. };
  6400. function parseDataset(attrs) {
  6401. var dataset = Object.create(null);
  6402. Object.keys(attrs).forEach(function (name) {
  6403. if (name.indexOf('data-') === 0) {
  6404. var camelizeName = camelize(name.replace('data-', ''));
  6405. try {
  6406. dataset[camelizeName] = JSON.parse(attrs[name]);
  6407. } catch (e) {
  6408. dataset[camelizeName] = attrs[name];
  6409. }
  6410. }
  6411. });
  6412. return dataset
  6413. }
  6414. function updateAttrs(oldVnode, vnode) {
  6415. var attrs = vnode.data.attrs;
  6416. if (isUndef(attrs)) {
  6417. return
  6418. }
  6419. var id = attrs['_i'];
  6420. if (isUndef(id)) {
  6421. return
  6422. }
  6423. var elm = vnode.elm;
  6424. elm.dataset = Object.assign(elm.dataset || {}, parseDataset(attrs));
  6425. }
  6426. var attrs = {
  6427. create: updateAttrs,
  6428. update: updateAttrs
  6429. };
  6430. /* */
  6431. /* */
  6432. /* */
  6433. /* */
  6434. // in some cases, the event used has to be determined at runtime
  6435. // so we used some reserved tokens during compile.
  6436. var RANGE_TOKEN = '__r';
  6437. var CHECKBOX_RADIO_TOKEN = '__c';
  6438. /* */
  6439. // normalize v-model event tokens that can only be determined at runtime.
  6440. // it's important to place the event as the first in the array because
  6441. // the whole point is ensuring the v-model callback gets called before
  6442. // user-attached handlers.
  6443. function normalizeEvents (on) {
  6444. /* istanbul ignore if */
  6445. if (isDef(on[RANGE_TOKEN])) {
  6446. var event = 'input';
  6447. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  6448. delete on[RANGE_TOKEN];
  6449. }
  6450. // This was originally intended to fix #4521 but no longer necessary
  6451. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  6452. /* istanbul ignore if */
  6453. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  6454. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  6455. delete on[CHECKBOX_RADIO_TOKEN];
  6456. }
  6457. }
  6458. var target$1;
  6459. function createOnceHandler$1 (event, handler, capture) {
  6460. var _target = target$1; // save current target element in closure
  6461. return function onceHandler () {
  6462. var res = handler.apply(null, arguments);
  6463. if (res !== null) {
  6464. remove$2(event, onceHandler, capture, _target);
  6465. }
  6466. }
  6467. }
  6468. function add$1 (name,handler) {
  6469. target$1.addEventListener(name, handler);
  6470. }
  6471. function remove$2 (
  6472. name,
  6473. handler,
  6474. capture,
  6475. _target
  6476. ) {
  6477. if (!handler) {
  6478. return
  6479. }
  6480. (_target || target$1).removeEventListener(
  6481. name,
  6482. handler._wrapper || handler
  6483. );
  6484. }
  6485. function updateDOMListeners (oldVnode, vnode) {
  6486. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  6487. return
  6488. }
  6489. var on = vnode.data.on || {};
  6490. var oldOn = oldVnode.data.on || {};
  6491. target$1 = vnode.elm;
  6492. // fixed by xxxxxx 存储 vd
  6493. target$1._$vd = vnode.context._$vd;
  6494. var context = vnode.context;
  6495. // 存储事件标记
  6496. var nid = (vnode.data.attrs || {})['_i'];
  6497. var parent = vnode.parent;
  6498. while (parent && parent.componentInstance) { // 使用组件外壳节点id
  6499. var parentId = parent.data.attrs && parent.data.attrs['_i'];
  6500. isDef(parentId) && (nid = 'r-' + parentId);
  6501. parent = parent.parent;
  6502. }
  6503. target$1.setAttribute('nid', String(nid));
  6504. target$1.setAttribute('cid', context._$id);
  6505. normalizeEvents(on);
  6506. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  6507. target$1 = undefined;
  6508. }
  6509. var events = {
  6510. create: updateDOMListeners,
  6511. update: updateDOMListeners
  6512. };
  6513. var platformModules = [
  6514. wxs,
  6515. attrs,
  6516. events
  6517. ];
  6518. /* */
  6519. // the directive module should be applied last, after all
  6520. // built-in modules have been applied.
  6521. var modules = platformModules.concat(baseModules);
  6522. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  6523. var model$1 = {};
  6524. var show = {};
  6525. var platformDirectives = {
  6526. model: model$1,
  6527. show: show
  6528. };
  6529. var platformComponents = {
  6530. };
  6531. /* */
  6532. function stringifyClass (value) {
  6533. if (Array.isArray(value)) {
  6534. return stringifyArray(value)
  6535. }
  6536. if (isObject(value)) {
  6537. return stringifyObject(value)
  6538. }
  6539. if (typeof value === 'string') {
  6540. return value
  6541. }
  6542. /* istanbul ignore next */
  6543. return ''
  6544. }
  6545. function stringifyArray (value) {
  6546. var res = '';
  6547. var stringified;
  6548. for (var i = 0, l = value.length; i < l; i++) {
  6549. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  6550. if (res) { res += ' '; }
  6551. res += stringified;
  6552. }
  6553. }
  6554. return res
  6555. }
  6556. function stringifyObject (value) {
  6557. var res = '';
  6558. for (var key in value) {
  6559. if (value[key]) {
  6560. if (res) { res += ' '; }
  6561. res += key;
  6562. }
  6563. }
  6564. return res
  6565. }
  6566. /* */
  6567. var parseStyleText = cached(function (cssText) {
  6568. var res = {};
  6569. var listDelimiter = /;(?![^(]*\))/g;
  6570. var propertyDelimiter = /:(.+)/;
  6571. cssText.split(listDelimiter).forEach(function (item) {
  6572. if (item) {
  6573. var tmp = item.split(propertyDelimiter);
  6574. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  6575. }
  6576. });
  6577. return res
  6578. });
  6579. // normalize possible array / string values into Object
  6580. function normalizeStyleBinding (bindingStyle) {
  6581. if (Array.isArray(bindingStyle)) {
  6582. return toObject(bindingStyle)
  6583. }
  6584. if (typeof bindingStyle === 'string') {
  6585. return parseStyleText(bindingStyle)
  6586. }
  6587. return bindingStyle
  6588. }
  6589. function callHook$2(hook, args) {
  6590. var vm = this;
  6591. // #7573 disable dep collection when invoking lifecycle hooks
  6592. pushTarget();
  6593. var handlers = vm.$options[hook];
  6594. var info = hook + " hook";
  6595. var ret;
  6596. if (handlers) {
  6597. for (var i = 0, j = handlers.length; i < j; i++) {
  6598. ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
  6599. }
  6600. }
  6601. if (vm._hasHookEvent) {
  6602. vm.$emit('hook:' + hook, args);
  6603. }
  6604. popTarget();
  6605. return ret
  6606. }
  6607. var plugin = {
  6608. install: function install(Vue) {
  6609. Vue.prototype._$queue = queue;
  6610. Vue.prototype.__call_hook = callHook$2;
  6611. // 运行时需要格式化 class,style
  6612. Vue.prototype._$stringifyClass = stringifyClass;
  6613. Vue.prototype._$normalizeStyleBinding = normalizeStyleBinding;
  6614. }
  6615. };
  6616. /* */
  6617. // install platform specific utils
  6618. Vue.config.mustUseProp = mustUseProp$1;
  6619. Vue.config.isReservedTag = isReservedTag;
  6620. Vue.config.isReservedAttr = isReservedAttr;
  6621. Vue.config.getTagNamespace = getTagNamespace;
  6622. Vue.config.isUnknownElement = isUnknownElement;
  6623. // install platform runtime directives & components
  6624. extend(Vue.options.directives, platformDirectives);
  6625. extend(Vue.options.components, platformComponents);
  6626. // install platform patch function
  6627. Vue.prototype.__patch__ = patch;
  6628. // public mount method
  6629. Vue.prototype.$mount = function (
  6630. el,
  6631. hydrating
  6632. ) {
  6633. if (this.$options.mpType === 'page') {
  6634. var doc = new Document(this.$options.pageId, this.$options.pagePath);
  6635. el = doc.createComment('root');
  6636. el.hasAttribute = el.removeAttribute = function(){}; // hack for patch
  6637. doc.documentElement.appendChild(el);
  6638. }
  6639. return mountComponent(this, el, hydrating)
  6640. };
  6641. Vue.use(plugin);
  6642. // this entry is built and wrapped with a factory function
  6643. exports.Vue = Vue;
  6644. }