vendor.js 323 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826
  1. (global["webpackJsonp"] = global["webpackJsonp"] || []).push([["common/vendor"],[
  2. /* 0 */,
  3. /* 1 */
  4. /*!************************************************************!*\
  5. !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js ***!
  6. \************************************************************/
  7. /*! no static exports found */
  8. /***/ (function(module, exports, __webpack_require__) {
  9. "use strict";
  10. Object.defineProperty(exports, "__esModule", { value: true });exports.createApp = createApp;exports.createComponent = createComponent;exports.createPage = createPage;exports.default = void 0;var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 2));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;});keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {ownKeys(Object(source), true).forEach(function (key) {_defineProperty(target, key, source[key]);});} else if (Object.getOwnPropertyDescriptors) {Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));} else {ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}}return target;}function _slicedToArray(arr, i) {return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArrayLimit(arr, i) {if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"] != null) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}function _arrayWithHoles(arr) {if (Array.isArray(arr)) return arr;}function _defineProperty(obj, key, value) {if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}function _toConsumableArray(arr) {return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();}function _nonIterableSpread() {throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o, minLen) {if (!o) return;if (typeof o === "string") return _arrayLikeToArray(o, minLen);var n = Object.prototype.toString.call(o).slice(8, -1);if (n === "Object" && o.constructor) n = o.constructor.name;if (n === "Map" || n === "Set") return Array.from(n);if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);}function _iterableToArray(iter) {if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);}function _arrayWithoutHoles(arr) {if (Array.isArray(arr)) return _arrayLikeToArray(arr);}function _arrayLikeToArray(arr, len) {if (len == null || len > arr.length) len = arr.length;for (var i = 0, arr2 = new Array(len); i < len; i++) {arr2[i] = arr[i];}return arr2;}
  11. var _toString = Object.prototype.toString;
  12. var hasOwnProperty = Object.prototype.hasOwnProperty;
  13. function isFn(fn) {
  14. return typeof fn === 'function';
  15. }
  16. function isStr(str) {
  17. return typeof str === 'string';
  18. }
  19. function isPlainObject(obj) {
  20. return _toString.call(obj) === '[object Object]';
  21. }
  22. function hasOwn(obj, key) {
  23. return hasOwnProperty.call(obj, key);
  24. }
  25. function noop() {}
  26. /**
  27. * Create a cached version of a pure function.
  28. */
  29. function cached(fn) {
  30. var cache = Object.create(null);
  31. return function cachedFn(str) {
  32. var hit = cache[str];
  33. return hit || (cache[str] = fn(str));
  34. };
  35. }
  36. /**
  37. * Camelize a hyphen-delimited string.
  38. */
  39. var camelizeRE = /-(\w)/g;
  40. var camelize = cached(function (str) {
  41. return str.replace(camelizeRE, function (_, c) {return c ? c.toUpperCase() : '';});
  42. });
  43. var HOOKS = [
  44. 'invoke',
  45. 'success',
  46. 'fail',
  47. 'complete',
  48. 'returnValue'];
  49. var globalInterceptors = {};
  50. var scopedInterceptors = {};
  51. function mergeHook(parentVal, childVal) {
  52. var res = childVal ?
  53. parentVal ?
  54. parentVal.concat(childVal) :
  55. Array.isArray(childVal) ?
  56. childVal : [childVal] :
  57. parentVal;
  58. return res ?
  59. dedupeHooks(res) :
  60. res;
  61. }
  62. function dedupeHooks(hooks) {
  63. var res = [];
  64. for (var i = 0; i < hooks.length; i++) {
  65. if (res.indexOf(hooks[i]) === -1) {
  66. res.push(hooks[i]);
  67. }
  68. }
  69. return res;
  70. }
  71. function removeHook(hooks, hook) {
  72. var index = hooks.indexOf(hook);
  73. if (index !== -1) {
  74. hooks.splice(index, 1);
  75. }
  76. }
  77. function mergeInterceptorHook(interceptor, option) {
  78. Object.keys(option).forEach(function (hook) {
  79. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  80. interceptor[hook] = mergeHook(interceptor[hook], option[hook]);
  81. }
  82. });
  83. }
  84. function removeInterceptorHook(interceptor, option) {
  85. if (!interceptor || !option) {
  86. return;
  87. }
  88. Object.keys(option).forEach(function (hook) {
  89. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  90. removeHook(interceptor[hook], option[hook]);
  91. }
  92. });
  93. }
  94. function addInterceptor(method, option) {
  95. if (typeof method === 'string' && isPlainObject(option)) {
  96. mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), option);
  97. } else if (isPlainObject(method)) {
  98. mergeInterceptorHook(globalInterceptors, method);
  99. }
  100. }
  101. function removeInterceptor(method, option) {
  102. if (typeof method === 'string') {
  103. if (isPlainObject(option)) {
  104. removeInterceptorHook(scopedInterceptors[method], option);
  105. } else {
  106. delete scopedInterceptors[method];
  107. }
  108. } else if (isPlainObject(method)) {
  109. removeInterceptorHook(globalInterceptors, method);
  110. }
  111. }
  112. function wrapperHook(hook) {
  113. return function (data) {
  114. return hook(data) || data;
  115. };
  116. }
  117. function isPromise(obj) {
  118. return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
  119. }
  120. function queue(hooks, data) {
  121. var promise = false;
  122. for (var i = 0; i < hooks.length; i++) {
  123. var hook = hooks[i];
  124. if (promise) {
  125. promise = Promise.resolve(wrapperHook(hook));
  126. } else {
  127. var res = hook(data);
  128. if (isPromise(res)) {
  129. promise = Promise.resolve(res);
  130. }
  131. if (res === false) {
  132. return {
  133. then: function then() {} };
  134. }
  135. }
  136. }
  137. return promise || {
  138. then: function then(callback) {
  139. return callback(data);
  140. } };
  141. }
  142. function wrapperOptions(interceptor) {var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  143. ['success', 'fail', 'complete'].forEach(function (name) {
  144. if (Array.isArray(interceptor[name])) {
  145. var oldCallback = options[name];
  146. options[name] = function callbackInterceptor(res) {
  147. queue(interceptor[name], res).then(function (res) {
  148. /* eslint-disable no-mixed-operators */
  149. return isFn(oldCallback) && oldCallback(res) || res;
  150. });
  151. };
  152. }
  153. });
  154. return options;
  155. }
  156. function wrapperReturnValue(method, returnValue) {
  157. var returnValueHooks = [];
  158. if (Array.isArray(globalInterceptors.returnValue)) {
  159. returnValueHooks.push.apply(returnValueHooks, _toConsumableArray(globalInterceptors.returnValue));
  160. }
  161. var interceptor = scopedInterceptors[method];
  162. if (interceptor && Array.isArray(interceptor.returnValue)) {
  163. returnValueHooks.push.apply(returnValueHooks, _toConsumableArray(interceptor.returnValue));
  164. }
  165. returnValueHooks.forEach(function (hook) {
  166. returnValue = hook(returnValue) || returnValue;
  167. });
  168. return returnValue;
  169. }
  170. function getApiInterceptorHooks(method) {
  171. var interceptor = Object.create(null);
  172. Object.keys(globalInterceptors).forEach(function (hook) {
  173. if (hook !== 'returnValue') {
  174. interceptor[hook] = globalInterceptors[hook].slice();
  175. }
  176. });
  177. var scopedInterceptor = scopedInterceptors[method];
  178. if (scopedInterceptor) {
  179. Object.keys(scopedInterceptor).forEach(function (hook) {
  180. if (hook !== 'returnValue') {
  181. interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
  182. }
  183. });
  184. }
  185. return interceptor;
  186. }
  187. function invokeApi(method, api, options) {for (var _len = arguments.length, params = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {params[_key - 3] = arguments[_key];}
  188. var interceptor = getApiInterceptorHooks(method);
  189. if (interceptor && Object.keys(interceptor).length) {
  190. if (Array.isArray(interceptor.invoke)) {
  191. var res = queue(interceptor.invoke, options);
  192. return res.then(function (options) {
  193. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  194. });
  195. } else {
  196. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  197. }
  198. }
  199. return api.apply(void 0, [options].concat(params));
  200. }
  201. var promiseInterceptor = {
  202. returnValue: function returnValue(res) {
  203. if (!isPromise(res)) {
  204. return res;
  205. }
  206. return res.then(function (res) {
  207. return res[1];
  208. }).catch(function (res) {
  209. return res[0];
  210. });
  211. } };
  212. var SYNC_API_RE =
  213. /^\$|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
  214. var CONTEXT_API_RE = /^create|Manager$/;
  215. // Context例外情况
  216. var CONTEXT_API_RE_EXC = ['createBLEConnection'];
  217. // 同步例外情况
  218. var ASYNC_API = ['createBLEConnection'];
  219. var CALLBACK_API_RE = /^on|^off/;
  220. function isContextApi(name) {
  221. return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1;
  222. }
  223. function isSyncApi(name) {
  224. return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1;
  225. }
  226. function isCallbackApi(name) {
  227. return CALLBACK_API_RE.test(name) && name !== 'onPush';
  228. }
  229. function handlePromise(promise) {
  230. return promise.then(function (data) {
  231. return [null, data];
  232. }).
  233. catch(function (err) {return [err];});
  234. }
  235. function shouldPromise(name) {
  236. if (
  237. isContextApi(name) ||
  238. isSyncApi(name) ||
  239. isCallbackApi(name))
  240. {
  241. return false;
  242. }
  243. return true;
  244. }
  245. /* eslint-disable no-extend-native */
  246. if (!Promise.prototype.finally) {
  247. Promise.prototype.finally = function (callback) {
  248. var promise = this.constructor;
  249. return this.then(
  250. function (value) {return promise.resolve(callback()).then(function () {return value;});},
  251. function (reason) {return promise.resolve(callback()).then(function () {
  252. throw reason;
  253. });});
  254. };
  255. }
  256. function promisify(name, api) {
  257. if (!shouldPromise(name)) {
  258. return api;
  259. }
  260. return function promiseApi() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {params[_key2 - 1] = arguments[_key2];}
  261. if (isFn(options.success) || isFn(options.fail) || isFn(options.complete)) {
  262. return wrapperReturnValue(name, invokeApi.apply(void 0, [name, api, options].concat(params)));
  263. }
  264. return wrapperReturnValue(name, handlePromise(new Promise(function (resolve, reject) {
  265. invokeApi.apply(void 0, [name, api, Object.assign({}, options, {
  266. success: resolve,
  267. fail: reject })].concat(
  268. params));
  269. })));
  270. };
  271. }
  272. var EPS = 1e-4;
  273. var BASE_DEVICE_WIDTH = 750;
  274. var isIOS = false;
  275. var deviceWidth = 0;
  276. var deviceDPR = 0;
  277. function checkDeviceWidth() {var _wx$getSystemInfoSync =
  278. wx.getSystemInfoSync(),platform = _wx$getSystemInfoSync.platform,pixelRatio = _wx$getSystemInfoSync.pixelRatio,windowWidth = _wx$getSystemInfoSync.windowWidth; // uni=>wx runtime 编译目标是 uni 对象,内部不允许直接使用 uni
  279. deviceWidth = windowWidth;
  280. deviceDPR = pixelRatio;
  281. isIOS = platform === 'ios';
  282. }
  283. function upx2px(number, newDeviceWidth) {
  284. if (deviceWidth === 0) {
  285. checkDeviceWidth();
  286. }
  287. number = Number(number);
  288. if (number === 0) {
  289. return 0;
  290. }
  291. var result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth);
  292. if (result < 0) {
  293. result = -result;
  294. }
  295. result = Math.floor(result + EPS);
  296. if (result === 0) {
  297. if (deviceDPR === 1 || !isIOS) {
  298. result = 1;
  299. } else {
  300. result = 0.5;
  301. }
  302. }
  303. return number < 0 ? -result : result;
  304. }
  305. var interceptors = {
  306. promiseInterceptor: promiseInterceptor };
  307. var baseApi = /*#__PURE__*/Object.freeze({
  308. __proto__: null,
  309. upx2px: upx2px,
  310. addInterceptor: addInterceptor,
  311. removeInterceptor: removeInterceptor,
  312. interceptors: interceptors });
  313. var previewImage = {
  314. args: function args(fromArgs) {
  315. var currentIndex = parseInt(fromArgs.current);
  316. if (isNaN(currentIndex)) {
  317. return;
  318. }
  319. var urls = fromArgs.urls;
  320. if (!Array.isArray(urls)) {
  321. return;
  322. }
  323. var len = urls.length;
  324. if (!len) {
  325. return;
  326. }
  327. if (currentIndex < 0) {
  328. currentIndex = 0;
  329. } else if (currentIndex >= len) {
  330. currentIndex = len - 1;
  331. }
  332. if (currentIndex > 0) {
  333. fromArgs.current = urls[currentIndex];
  334. fromArgs.urls = urls.filter(
  335. function (item, index) {return index < currentIndex ? item !== urls[currentIndex] : true;});
  336. } else {
  337. fromArgs.current = urls[0];
  338. }
  339. return {
  340. indicator: false,
  341. loop: false };
  342. } };
  343. function addSafeAreaInsets(result) {
  344. if (result.safeArea) {
  345. var safeArea = result.safeArea;
  346. result.safeAreaInsets = {
  347. top: safeArea.top,
  348. left: safeArea.left,
  349. right: result.windowWidth - safeArea.right,
  350. bottom: result.windowHeight - safeArea.bottom };
  351. }
  352. }
  353. var protocols = {
  354. previewImage: previewImage,
  355. getSystemInfo: {
  356. returnValue: addSafeAreaInsets },
  357. getSystemInfoSync: {
  358. returnValue: addSafeAreaInsets } };
  359. var todos = [
  360. 'vibrate',
  361. 'preloadPage',
  362. 'unPreloadPage',
  363. 'loadSubPackage'];
  364. var canIUses = [];
  365. var CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
  366. function processCallback(methodName, method, returnValue) {
  367. return function (res) {
  368. return method(processReturnValue(methodName, res, returnValue));
  369. };
  370. }
  371. function processArgs(methodName, fromArgs) {var argsOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};var returnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};var keepFromArgs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  372. if (isPlainObject(fromArgs)) {// 一般 api 的参数解析
  373. var toArgs = keepFromArgs === true ? fromArgs : {}; // returnValue 为 false 时,说明是格式化返回值,直接在返回值对象上修改赋值
  374. if (isFn(argsOption)) {
  375. argsOption = argsOption(fromArgs, toArgs) || {};
  376. }
  377. for (var key in fromArgs) {
  378. if (hasOwn(argsOption, key)) {
  379. var keyOption = argsOption[key];
  380. if (isFn(keyOption)) {
  381. keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
  382. }
  383. if (!keyOption) {// 不支持的参数
  384. console.warn("\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F ".concat(methodName, "\u6682\u4E0D\u652F\u6301").concat(key));
  385. } else if (isStr(keyOption)) {// 重写参数 key
  386. toArgs[keyOption] = fromArgs[key];
  387. } else if (isPlainObject(keyOption)) {// {name:newName,value:value}可重新指定参数 key:value
  388. toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
  389. }
  390. } else if (CALLBACKS.indexOf(key) !== -1) {
  391. if (isFn(fromArgs[key])) {
  392. toArgs[key] = processCallback(methodName, fromArgs[key], returnValue);
  393. }
  394. } else {
  395. if (!keepFromArgs) {
  396. toArgs[key] = fromArgs[key];
  397. }
  398. }
  399. }
  400. return toArgs;
  401. } else if (isFn(fromArgs)) {
  402. fromArgs = processCallback(methodName, fromArgs, returnValue);
  403. }
  404. return fromArgs;
  405. }
  406. function processReturnValue(methodName, res, returnValue) {var keepReturnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  407. if (isFn(protocols.returnValue)) {// 处理通用 returnValue
  408. res = protocols.returnValue(methodName, res);
  409. }
  410. return processArgs(methodName, res, returnValue, {}, keepReturnValue);
  411. }
  412. function wrapper(methodName, method) {
  413. if (hasOwn(protocols, methodName)) {
  414. var protocol = protocols[methodName];
  415. if (!protocol) {// 暂不支持的 api
  416. return function () {
  417. console.error("\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F \u6682\u4E0D\u652F\u6301".concat(methodName));
  418. };
  419. }
  420. return function (arg1, arg2) {// 目前 api 最多两个参数
  421. var options = protocol;
  422. if (isFn(protocol)) {
  423. options = protocol(arg1);
  424. }
  425. arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
  426. var args = [arg1];
  427. if (typeof arg2 !== 'undefined') {
  428. args.push(arg2);
  429. }
  430. var returnValue = wx[options.name || methodName].apply(wx, args);
  431. if (isSyncApi(methodName)) {// 同步 api
  432. return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
  433. }
  434. return returnValue;
  435. };
  436. }
  437. return method;
  438. }
  439. var todoApis = Object.create(null);
  440. var TODOS = [
  441. 'onTabBarMidButtonTap',
  442. 'subscribePush',
  443. 'unsubscribePush',
  444. 'onPush',
  445. 'offPush',
  446. 'share'];
  447. function createTodoApi(name) {
  448. return function todoApi(_ref)
  449. {var fail = _ref.fail,complete = _ref.complete;
  450. var res = {
  451. errMsg: "".concat(name, ":fail:\u6682\u4E0D\u652F\u6301 ").concat(name, " \u65B9\u6CD5") };
  452. isFn(fail) && fail(res);
  453. isFn(complete) && complete(res);
  454. };
  455. }
  456. TODOS.forEach(function (name) {
  457. todoApis[name] = createTodoApi(name);
  458. });
  459. var providers = {
  460. oauth: ['weixin'],
  461. share: ['weixin'],
  462. payment: ['wxpay'],
  463. push: ['weixin'] };
  464. function getProvider(_ref2)
  465. {var service = _ref2.service,success = _ref2.success,fail = _ref2.fail,complete = _ref2.complete;
  466. var res = false;
  467. if (providers[service]) {
  468. res = {
  469. errMsg: 'getProvider:ok',
  470. service: service,
  471. provider: providers[service] };
  472. isFn(success) && success(res);
  473. } else {
  474. res = {
  475. errMsg: 'getProvider:fail:服务[' + service + ']不存在' };
  476. isFn(fail) && fail(res);
  477. }
  478. isFn(complete) && complete(res);
  479. }
  480. var extraApi = /*#__PURE__*/Object.freeze({
  481. __proto__: null,
  482. getProvider: getProvider });
  483. var getEmitter = function () {
  484. var Emitter;
  485. return function getUniEmitter() {
  486. if (!Emitter) {
  487. Emitter = new _vue.default();
  488. }
  489. return Emitter;
  490. };
  491. }();
  492. function apply(ctx, method, args) {
  493. return ctx[method].apply(ctx, args);
  494. }
  495. function $on() {
  496. return apply(getEmitter(), '$on', Array.prototype.slice.call(arguments));
  497. }
  498. function $off() {
  499. return apply(getEmitter(), '$off', Array.prototype.slice.call(arguments));
  500. }
  501. function $once() {
  502. return apply(getEmitter(), '$once', Array.prototype.slice.call(arguments));
  503. }
  504. function $emit() {
  505. return apply(getEmitter(), '$emit', Array.prototype.slice.call(arguments));
  506. }
  507. var eventApi = /*#__PURE__*/Object.freeze({
  508. __proto__: null,
  509. $on: $on,
  510. $off: $off,
  511. $once: $once,
  512. $emit: $emit });
  513. var api = /*#__PURE__*/Object.freeze({
  514. __proto__: null });
  515. var MPPage = Page;
  516. var MPComponent = Component;
  517. var customizeRE = /:/g;
  518. var customize = cached(function (str) {
  519. return camelize(str.replace(customizeRE, '-'));
  520. });
  521. function initTriggerEvent(mpInstance) {
  522. {
  523. if (!wx.canIUse('nextTick')) {
  524. return;
  525. }
  526. }
  527. var oldTriggerEvent = mpInstance.triggerEvent;
  528. mpInstance.triggerEvent = function (event) {for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {args[_key3 - 1] = arguments[_key3];}
  529. return oldTriggerEvent.apply(mpInstance, [customize(event)].concat(args));
  530. };
  531. }
  532. function initHook(name, options) {
  533. var oldHook = options[name];
  534. if (!oldHook) {
  535. options[name] = function () {
  536. initTriggerEvent(this);
  537. };
  538. } else {
  539. options[name] = function () {
  540. initTriggerEvent(this);for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {args[_key4] = arguments[_key4];}
  541. return oldHook.apply(this, args);
  542. };
  543. }
  544. }
  545. Page = function Page() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  546. initHook('onLoad', options);
  547. return MPPage(options);
  548. };
  549. Component = function Component() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  550. initHook('created', options);
  551. return MPComponent(options);
  552. };
  553. var PAGE_EVENT_HOOKS = [
  554. 'onPullDownRefresh',
  555. 'onReachBottom',
  556. 'onAddToFavorites',
  557. 'onShareTimeline',
  558. 'onShareAppMessage',
  559. 'onPageScroll',
  560. 'onResize',
  561. 'onTabItemTap'];
  562. function initMocks(vm, mocks) {
  563. var mpInstance = vm.$mp[vm.mpType];
  564. mocks.forEach(function (mock) {
  565. if (hasOwn(mpInstance, mock)) {
  566. vm[mock] = mpInstance[mock];
  567. }
  568. });
  569. }
  570. function hasHook(hook, vueOptions) {
  571. if (!vueOptions) {
  572. return true;
  573. }
  574. if (_vue.default.options && Array.isArray(_vue.default.options[hook])) {
  575. return true;
  576. }
  577. vueOptions = vueOptions.default || vueOptions;
  578. if (isFn(vueOptions)) {
  579. if (isFn(vueOptions.extendOptions[hook])) {
  580. return true;
  581. }
  582. if (vueOptions.super &&
  583. vueOptions.super.options &&
  584. Array.isArray(vueOptions.super.options[hook])) {
  585. return true;
  586. }
  587. return false;
  588. }
  589. if (isFn(vueOptions[hook])) {
  590. return true;
  591. }
  592. var mixins = vueOptions.mixins;
  593. if (Array.isArray(mixins)) {
  594. return !!mixins.find(function (mixin) {return hasHook(hook, mixin);});
  595. }
  596. }
  597. function initHooks(mpOptions, hooks, vueOptions) {
  598. hooks.forEach(function (hook) {
  599. if (hasHook(hook, vueOptions)) {
  600. mpOptions[hook] = function (args) {
  601. return this.$vm && this.$vm.__call_hook(hook, args);
  602. };
  603. }
  604. });
  605. }
  606. function initVueComponent(Vue, vueOptions) {
  607. vueOptions = vueOptions.default || vueOptions;
  608. var VueComponent;
  609. if (isFn(vueOptions)) {
  610. VueComponent = vueOptions;
  611. } else {
  612. VueComponent = Vue.extend(vueOptions);
  613. }
  614. vueOptions = VueComponent.options;
  615. return [VueComponent, vueOptions];
  616. }
  617. function initSlots(vm, vueSlots) {
  618. if (Array.isArray(vueSlots) && vueSlots.length) {
  619. var $slots = Object.create(null);
  620. vueSlots.forEach(function (slotName) {
  621. $slots[slotName] = true;
  622. });
  623. vm.$scopedSlots = vm.$slots = $slots;
  624. }
  625. }
  626. function initVueIds(vueIds, mpInstance) {
  627. vueIds = (vueIds || '').split(',');
  628. var len = vueIds.length;
  629. if (len === 1) {
  630. mpInstance._$vueId = vueIds[0];
  631. } else if (len === 2) {
  632. mpInstance._$vueId = vueIds[0];
  633. mpInstance._$vuePid = vueIds[1];
  634. }
  635. }
  636. function initData(vueOptions, context) {
  637. var data = vueOptions.data || {};
  638. var methods = vueOptions.methods || {};
  639. if (typeof data === 'function') {
  640. try {
  641. data = data.call(context); // 支持 Vue.prototype 上挂的数据
  642. } catch (e) {
  643. if (Object({"NODE_ENV":"development","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG) {
  644. console.warn('根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。', data);
  645. }
  646. }
  647. } else {
  648. try {
  649. // 对 data 格式化
  650. data = JSON.parse(JSON.stringify(data));
  651. } catch (e) {}
  652. }
  653. if (!isPlainObject(data)) {
  654. data = {};
  655. }
  656. Object.keys(methods).forEach(function (methodName) {
  657. if (context.__lifecycle_hooks__.indexOf(methodName) === -1 && !hasOwn(data, methodName)) {
  658. data[methodName] = methods[methodName];
  659. }
  660. });
  661. return data;
  662. }
  663. var PROP_TYPES = [String, Number, Boolean, Object, Array, null];
  664. function createObserver(name) {
  665. return function observer(newVal, oldVal) {
  666. if (this.$vm) {
  667. this.$vm[name] = newVal; // 为了触发其他非 render watcher
  668. }
  669. };
  670. }
  671. function initBehaviors(vueOptions, initBehavior) {
  672. var vueBehaviors = vueOptions.behaviors;
  673. var vueExtends = vueOptions.extends;
  674. var vueMixins = vueOptions.mixins;
  675. var vueProps = vueOptions.props;
  676. if (!vueProps) {
  677. vueOptions.props = vueProps = [];
  678. }
  679. var behaviors = [];
  680. if (Array.isArray(vueBehaviors)) {
  681. vueBehaviors.forEach(function (behavior) {
  682. behaviors.push(behavior.replace('uni://', "wx".concat("://")));
  683. if (behavior === 'uni://form-field') {
  684. if (Array.isArray(vueProps)) {
  685. vueProps.push('name');
  686. vueProps.push('value');
  687. } else {
  688. vueProps.name = {
  689. type: String,
  690. default: '' };
  691. vueProps.value = {
  692. type: [String, Number, Boolean, Array, Object, Date],
  693. default: '' };
  694. }
  695. }
  696. });
  697. }
  698. if (isPlainObject(vueExtends) && vueExtends.props) {
  699. behaviors.push(
  700. initBehavior({
  701. properties: initProperties(vueExtends.props, true) }));
  702. }
  703. if (Array.isArray(vueMixins)) {
  704. vueMixins.forEach(function (vueMixin) {
  705. if (isPlainObject(vueMixin) && vueMixin.props) {
  706. behaviors.push(
  707. initBehavior({
  708. properties: initProperties(vueMixin.props, true) }));
  709. }
  710. });
  711. }
  712. return behaviors;
  713. }
  714. function parsePropType(key, type, defaultValue, file) {
  715. // [String]=>String
  716. if (Array.isArray(type) && type.length === 1) {
  717. return type[0];
  718. }
  719. return type;
  720. }
  721. function initProperties(props) {var isBehavior = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;var file = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
  722. var properties = {};
  723. if (!isBehavior) {
  724. properties.vueId = {
  725. type: String,
  726. value: '' };
  727. // 用于字节跳动小程序模拟抽象节点
  728. properties.generic = {
  729. type: Object,
  730. value: null };
  731. properties.vueSlots = { // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
  732. type: null,
  733. value: [],
  734. observer: function observer(newVal, oldVal) {
  735. var $slots = Object.create(null);
  736. newVal.forEach(function (slotName) {
  737. $slots[slotName] = true;
  738. });
  739. this.setData({
  740. $slots: $slots });
  741. } };
  742. }
  743. if (Array.isArray(props)) {// ['title']
  744. props.forEach(function (key) {
  745. properties[key] = {
  746. type: null,
  747. observer: createObserver(key) };
  748. });
  749. } else if (isPlainObject(props)) {// {title:{type:String,default:''},content:String}
  750. Object.keys(props).forEach(function (key) {
  751. var opts = props[key];
  752. if (isPlainObject(opts)) {// title:{type:String,default:''}
  753. var value = opts.default;
  754. if (isFn(value)) {
  755. value = value();
  756. }
  757. opts.type = parsePropType(key, opts.type);
  758. properties[key] = {
  759. type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
  760. value: value,
  761. observer: createObserver(key) };
  762. } else {// content:String
  763. var type = parsePropType(key, opts);
  764. properties[key] = {
  765. type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
  766. observer: createObserver(key) };
  767. }
  768. });
  769. }
  770. return properties;
  771. }
  772. function wrapper$1(event) {
  773. // TODO 又得兼容 mpvue 的 mp 对象
  774. try {
  775. event.mp = JSON.parse(JSON.stringify(event));
  776. } catch (e) {}
  777. event.stopPropagation = noop;
  778. event.preventDefault = noop;
  779. event.target = event.target || {};
  780. if (!hasOwn(event, 'detail')) {
  781. event.detail = {};
  782. }
  783. if (hasOwn(event, 'markerId')) {
  784. event.detail = typeof event.detail === 'object' ? event.detail : {};
  785. event.detail.markerId = event.markerId;
  786. }
  787. if (isPlainObject(event.detail)) {
  788. event.target = Object.assign({}, event.target, event.detail);
  789. }
  790. return event;
  791. }
  792. function getExtraValue(vm, dataPathsArray) {
  793. var context = vm;
  794. dataPathsArray.forEach(function (dataPathArray) {
  795. var dataPath = dataPathArray[0];
  796. var value = dataPathArray[2];
  797. if (dataPath || typeof value !== 'undefined') {// ['','',index,'disable']
  798. var propPath = dataPathArray[1];
  799. var valuePath = dataPathArray[3];
  800. var vFor;
  801. if (Number.isInteger(dataPath)) {
  802. vFor = dataPath;
  803. } else if (!dataPath) {
  804. vFor = context;
  805. } else if (typeof dataPath === 'string' && dataPath) {
  806. if (dataPath.indexOf('#s#') === 0) {
  807. vFor = dataPath.substr(3);
  808. } else {
  809. vFor = vm.__get_value(dataPath, context);
  810. }
  811. }
  812. if (Number.isInteger(vFor)) {
  813. context = value;
  814. } else if (!propPath) {
  815. context = vFor[value];
  816. } else {
  817. if (Array.isArray(vFor)) {
  818. context = vFor.find(function (vForItem) {
  819. return vm.__get_value(propPath, vForItem) === value;
  820. });
  821. } else if (isPlainObject(vFor)) {
  822. context = Object.keys(vFor).find(function (vForKey) {
  823. return vm.__get_value(propPath, vFor[vForKey]) === value;
  824. });
  825. } else {
  826. console.error('v-for 暂不支持循环数据:', vFor);
  827. }
  828. }
  829. if (valuePath) {
  830. context = vm.__get_value(valuePath, context);
  831. }
  832. }
  833. });
  834. return context;
  835. }
  836. function processEventExtra(vm, extra, event) {
  837. var extraObj = {};
  838. if (Array.isArray(extra) && extra.length) {
  839. /**
  840. *[
  841. * ['data.items', 'data.id', item.data.id],
  842. * ['metas', 'id', meta.id]
  843. *],
  844. *[
  845. * ['data.items', 'data.id', item.data.id],
  846. * ['metas', 'id', meta.id]
  847. *],
  848. *'test'
  849. */
  850. extra.forEach(function (dataPath, index) {
  851. if (typeof dataPath === 'string') {
  852. if (!dataPath) {// model,prop.sync
  853. extraObj['$' + index] = vm;
  854. } else {
  855. if (dataPath === '$event') {// $event
  856. extraObj['$' + index] = event;
  857. } else if (dataPath === 'arguments') {
  858. if (event.detail && event.detail.__args__) {
  859. extraObj['$' + index] = event.detail.__args__;
  860. } else {
  861. extraObj['$' + index] = [event];
  862. }
  863. } else if (dataPath.indexOf('$event.') === 0) {// $event.target.value
  864. extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
  865. } else {
  866. extraObj['$' + index] = vm.__get_value(dataPath);
  867. }
  868. }
  869. } else {
  870. extraObj['$' + index] = getExtraValue(vm, dataPath);
  871. }
  872. });
  873. }
  874. return extraObj;
  875. }
  876. function getObjByArray(arr) {
  877. var obj = {};
  878. for (var i = 1; i < arr.length; i++) {
  879. var element = arr[i];
  880. obj[element[0]] = element[1];
  881. }
  882. return obj;
  883. }
  884. function processEventArgs(vm, event) {var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];var extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];var isCustom = arguments.length > 4 ? arguments[4] : undefined;var methodName = arguments.length > 5 ? arguments[5] : undefined;
  885. var isCustomMPEvent = false; // wxcomponent 组件,传递原始 event 对象
  886. if (isCustom) {// 自定义事件
  887. isCustomMPEvent = event.currentTarget &&
  888. event.currentTarget.dataset &&
  889. event.currentTarget.dataset.comType === 'wx';
  890. if (!args.length) {// 无参数,直接传入 event 或 detail 数组
  891. if (isCustomMPEvent) {
  892. return [event];
  893. }
  894. return event.detail.__args__ || event.detail;
  895. }
  896. }
  897. var extraObj = processEventExtra(vm, extra, event);
  898. var ret = [];
  899. args.forEach(function (arg) {
  900. if (arg === '$event') {
  901. if (methodName === '__set_model' && !isCustom) {// input v-model value
  902. ret.push(event.target.value);
  903. } else {
  904. if (isCustom && !isCustomMPEvent) {
  905. ret.push(event.detail.__args__[0]);
  906. } else {// wxcomponent 组件或内置组件
  907. ret.push(event);
  908. }
  909. }
  910. } else {
  911. if (Array.isArray(arg) && arg[0] === 'o') {
  912. ret.push(getObjByArray(arg));
  913. } else if (typeof arg === 'string' && hasOwn(extraObj, arg)) {
  914. ret.push(extraObj[arg]);
  915. } else {
  916. ret.push(arg);
  917. }
  918. }
  919. });
  920. return ret;
  921. }
  922. var ONCE = '~';
  923. var CUSTOM = '^';
  924. function isMatchEventType(eventType, optType) {
  925. return eventType === optType ||
  926. optType === 'regionchange' && (
  927. eventType === 'begin' ||
  928. eventType === 'end');
  929. }
  930. function getContextVm(vm) {
  931. var $parent = vm.$parent;
  932. // 父组件是 scoped slots 或者其他自定义组件时继续查找
  933. while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) {
  934. $parent = $parent.$parent;
  935. }
  936. return $parent && $parent.$parent;
  937. }
  938. function handleEvent(event) {var _this = this;
  939. event = wrapper$1(event);
  940. // [['tap',[['handle',[1,2,a]],['handle1',[1,2,a]]]]]
  941. var dataset = (event.currentTarget || event.target).dataset;
  942. if (!dataset) {
  943. return console.warn('事件信息不存在');
  944. }
  945. var eventOpts = dataset.eventOpts || dataset['event-opts']; // 支付宝 web-view 组件 dataset 非驼峰
  946. if (!eventOpts) {
  947. return console.warn('事件信息不存在');
  948. }
  949. // [['handle',[1,2,a]],['handle1',[1,2,a]]]
  950. var eventType = event.type;
  951. var ret = [];
  952. eventOpts.forEach(function (eventOpt) {
  953. var type = eventOpt[0];
  954. var eventsArray = eventOpt[1];
  955. var isCustom = type.charAt(0) === CUSTOM;
  956. type = isCustom ? type.slice(1) : type;
  957. var isOnce = type.charAt(0) === ONCE;
  958. type = isOnce ? type.slice(1) : type;
  959. if (eventsArray && isMatchEventType(eventType, type)) {
  960. eventsArray.forEach(function (eventArray) {
  961. var methodName = eventArray[0];
  962. if (methodName) {
  963. var handlerCtx = _this.$vm;
  964. if (handlerCtx.$options.generic) {// mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
  965. handlerCtx = getContextVm(handlerCtx) || handlerCtx;
  966. }
  967. if (methodName === '$emit') {
  968. handlerCtx.$emit.apply(handlerCtx,
  969. processEventArgs(
  970. _this.$vm,
  971. event,
  972. eventArray[1],
  973. eventArray[2],
  974. isCustom,
  975. methodName));
  976. return;
  977. }
  978. var handler = handlerCtx[methodName];
  979. if (!isFn(handler)) {
  980. throw new Error(" _vm.".concat(methodName, " is not a function"));
  981. }
  982. if (isOnce) {
  983. if (handler.once) {
  984. return;
  985. }
  986. handler.once = true;
  987. }
  988. var params = processEventArgs(
  989. _this.$vm,
  990. event,
  991. eventArray[1],
  992. eventArray[2],
  993. isCustom,
  994. methodName);
  995. // 参数尾部增加原始事件对象用于复杂表达式内获取额外数据
  996. // eslint-disable-next-line no-sparse-arrays
  997. ret.push(handler.apply(handlerCtx, (Array.isArray(params) ? params : []).concat([,,,,,,,,,, event])));
  998. }
  999. });
  1000. }
  1001. });
  1002. if (
  1003. eventType === 'input' &&
  1004. ret.length === 1 &&
  1005. typeof ret[0] !== 'undefined')
  1006. {
  1007. return ret[0];
  1008. }
  1009. }
  1010. var hooks = [
  1011. 'onShow',
  1012. 'onHide',
  1013. 'onError',
  1014. 'onPageNotFound',
  1015. 'onThemeChange',
  1016. 'onUnhandledRejection'];
  1017. function parseBaseApp(vm, _ref3)
  1018. {var mocks = _ref3.mocks,initRefs = _ref3.initRefs;
  1019. if (vm.$options.store) {
  1020. _vue.default.prototype.$store = vm.$options.store;
  1021. }
  1022. _vue.default.prototype.mpHost = "mp-weixin";
  1023. _vue.default.mixin({
  1024. beforeCreate: function beforeCreate() {
  1025. if (!this.$options.mpType) {
  1026. return;
  1027. }
  1028. this.mpType = this.$options.mpType;
  1029. this.$mp = _defineProperty({
  1030. data: {} },
  1031. this.mpType, this.$options.mpInstance);
  1032. this.$scope = this.$options.mpInstance;
  1033. delete this.$options.mpType;
  1034. delete this.$options.mpInstance;
  1035. if (this.mpType !== 'app') {
  1036. initRefs(this);
  1037. initMocks(this, mocks);
  1038. }
  1039. } });
  1040. var appOptions = {
  1041. onLaunch: function onLaunch(args) {
  1042. if (this.$vm) {// 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
  1043. return;
  1044. }
  1045. {
  1046. if (!wx.canIUse('nextTick')) {// 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断
  1047. console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上');
  1048. }
  1049. }
  1050. this.$vm = vm;
  1051. this.$vm.$mp = {
  1052. app: this };
  1053. this.$vm.$scope = this;
  1054. // vm 上也挂载 globalData
  1055. this.$vm.globalData = this.globalData;
  1056. this.$vm._isMounted = true;
  1057. this.$vm.__call_hook('mounted', args);
  1058. this.$vm.__call_hook('onLaunch', args);
  1059. } };
  1060. // 兼容旧版本 globalData
  1061. appOptions.globalData = vm.$options.globalData || {};
  1062. // 将 methods 中的方法挂在 getApp() 中
  1063. var methods = vm.$options.methods;
  1064. if (methods) {
  1065. Object.keys(methods).forEach(function (name) {
  1066. appOptions[name] = methods[name];
  1067. });
  1068. }
  1069. initHooks(appOptions, hooks);
  1070. return appOptions;
  1071. }
  1072. var mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
  1073. function findVmByVueId(vm, vuePid) {
  1074. var $children = vm.$children;
  1075. // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
  1076. for (var i = $children.length - 1; i >= 0; i--) {
  1077. var childVm = $children[i];
  1078. if (childVm.$scope._$vueId === vuePid) {
  1079. return childVm;
  1080. }
  1081. }
  1082. // 反向递归查找
  1083. var parentVm;
  1084. for (var _i = $children.length - 1; _i >= 0; _i--) {
  1085. parentVm = findVmByVueId($children[_i], vuePid);
  1086. if (parentVm) {
  1087. return parentVm;
  1088. }
  1089. }
  1090. }
  1091. function initBehavior(options) {
  1092. return Behavior(options);
  1093. }
  1094. function isPage() {
  1095. return !!this.route;
  1096. }
  1097. function initRelation(detail) {
  1098. this.triggerEvent('__l', detail);
  1099. }
  1100. function initRefs(vm) {
  1101. var mpInstance = vm.$scope;
  1102. Object.defineProperty(vm, '$refs', {
  1103. get: function get() {
  1104. var $refs = {};
  1105. var components = mpInstance.selectAllComponents('.vue-ref');
  1106. components.forEach(function (component) {
  1107. var ref = component.dataset.ref;
  1108. $refs[ref] = component.$vm || component;
  1109. });
  1110. var forComponents = mpInstance.selectAllComponents('.vue-ref-in-for');
  1111. forComponents.forEach(function (component) {
  1112. var ref = component.dataset.ref;
  1113. if (!$refs[ref]) {
  1114. $refs[ref] = [];
  1115. }
  1116. $refs[ref].push(component.$vm || component);
  1117. });
  1118. return $refs;
  1119. } });
  1120. }
  1121. function handleLink(event) {var _ref4 =
  1122. event.detail || event.value,vuePid = _ref4.vuePid,vueOptions = _ref4.vueOptions; // detail 是微信,value 是百度(dipatch)
  1123. var parentVm;
  1124. if (vuePid) {
  1125. parentVm = findVmByVueId(this.$vm, vuePid);
  1126. }
  1127. if (!parentVm) {
  1128. parentVm = this.$vm;
  1129. }
  1130. vueOptions.parent = parentVm;
  1131. }
  1132. function parseApp(vm) {
  1133. return parseBaseApp(vm, {
  1134. mocks: mocks,
  1135. initRefs: initRefs });
  1136. }
  1137. function createApp(vm) {
  1138. App(parseApp(vm));
  1139. return vm;
  1140. }
  1141. function parseBaseComponent(vueComponentOptions)
  1142. {var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},isPage = _ref5.isPage,initRelation = _ref5.initRelation;var _initVueComponent =
  1143. initVueComponent(_vue.default, vueComponentOptions),_initVueComponent2 = _slicedToArray(_initVueComponent, 2),VueComponent = _initVueComponent2[0],vueOptions = _initVueComponent2[1];
  1144. var options = _objectSpread({
  1145. multipleSlots: true,
  1146. addGlobalClass: true },
  1147. vueOptions.options || {});
  1148. {
  1149. // 微信 multipleSlots 部分情况有 bug,导致内容顺序错乱 如 u-list,提供覆盖选项
  1150. if (vueOptions['mp-weixin'] && vueOptions['mp-weixin'].options) {
  1151. Object.assign(options, vueOptions['mp-weixin'].options);
  1152. }
  1153. }
  1154. var componentOptions = {
  1155. options: options,
  1156. data: initData(vueOptions, _vue.default.prototype),
  1157. behaviors: initBehaviors(vueOptions, initBehavior),
  1158. properties: initProperties(vueOptions.props, false, vueOptions.__file),
  1159. lifetimes: {
  1160. attached: function attached() {
  1161. var properties = this.properties;
  1162. var options = {
  1163. mpType: isPage.call(this) ? 'page' : 'component',
  1164. mpInstance: this,
  1165. propsData: properties };
  1166. initVueIds(properties.vueId, this);
  1167. // 处理父子关系
  1168. initRelation.call(this, {
  1169. vuePid: this._$vuePid,
  1170. vueOptions: options });
  1171. // 初始化 vue 实例
  1172. this.$vm = new VueComponent(options);
  1173. // 处理$slots,$scopedSlots(暂不支持动态变化$slots)
  1174. initSlots(this.$vm, properties.vueSlots);
  1175. // 触发首次 setData
  1176. this.$vm.$mount();
  1177. },
  1178. ready: function ready() {
  1179. // 当组件 props 默认值为 true,初始化时传入 false 会导致 created,ready 触发, 但 attached 不触发
  1180. // https://developers.weixin.qq.com/community/develop/doc/00066ae2844cc0f8eb883e2a557800
  1181. if (this.$vm) {
  1182. this.$vm._isMounted = true;
  1183. this.$vm.__call_hook('mounted');
  1184. this.$vm.__call_hook('onReady');
  1185. }
  1186. },
  1187. detached: function detached() {
  1188. this.$vm && this.$vm.$destroy();
  1189. } },
  1190. pageLifetimes: {
  1191. show: function show(args) {
  1192. this.$vm && this.$vm.__call_hook('onPageShow', args);
  1193. },
  1194. hide: function hide() {
  1195. this.$vm && this.$vm.__call_hook('onPageHide');
  1196. },
  1197. resize: function resize(size) {
  1198. this.$vm && this.$vm.__call_hook('onPageResize', size);
  1199. } },
  1200. methods: {
  1201. __l: handleLink,
  1202. __e: handleEvent } };
  1203. // externalClasses
  1204. if (vueOptions.externalClasses) {
  1205. componentOptions.externalClasses = vueOptions.externalClasses;
  1206. }
  1207. if (Array.isArray(vueOptions.wxsCallMethods)) {
  1208. vueOptions.wxsCallMethods.forEach(function (callMethod) {
  1209. componentOptions.methods[callMethod] = function (args) {
  1210. return this.$vm[callMethod](args);
  1211. };
  1212. });
  1213. }
  1214. if (isPage) {
  1215. return componentOptions;
  1216. }
  1217. return [componentOptions, VueComponent];
  1218. }
  1219. function parseComponent(vueComponentOptions) {
  1220. return parseBaseComponent(vueComponentOptions, {
  1221. isPage: isPage,
  1222. initRelation: initRelation });
  1223. }
  1224. var hooks$1 = [
  1225. 'onShow',
  1226. 'onHide',
  1227. 'onUnload'];
  1228. hooks$1.push.apply(hooks$1, PAGE_EVENT_HOOKS);
  1229. function parseBasePage(vuePageOptions, _ref6)
  1230. {var isPage = _ref6.isPage,initRelation = _ref6.initRelation;
  1231. var pageOptions = parseComponent(vuePageOptions);
  1232. initHooks(pageOptions.methods, hooks$1, vuePageOptions);
  1233. pageOptions.methods.onLoad = function (args) {
  1234. this.$vm.$mp.query = args; // 兼容 mpvue
  1235. this.$vm.__call_hook('onLoad', args);
  1236. };
  1237. return pageOptions;
  1238. }
  1239. function parsePage(vuePageOptions) {
  1240. return parseBasePage(vuePageOptions, {
  1241. isPage: isPage,
  1242. initRelation: initRelation });
  1243. }
  1244. function createPage(vuePageOptions) {
  1245. {
  1246. return Component(parsePage(vuePageOptions));
  1247. }
  1248. }
  1249. function createComponent(vueOptions) {
  1250. {
  1251. return Component(parseComponent(vueOptions));
  1252. }
  1253. }
  1254. todos.forEach(function (todoApi) {
  1255. protocols[todoApi] = false;
  1256. });
  1257. canIUses.forEach(function (canIUseApi) {
  1258. var apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name :
  1259. canIUseApi;
  1260. if (!wx.canIUse(apiName)) {
  1261. protocols[canIUseApi] = false;
  1262. }
  1263. });
  1264. var uni = {};
  1265. if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') {
  1266. uni = new Proxy({}, {
  1267. get: function get(target, name) {
  1268. if (hasOwn(target, name)) {
  1269. return target[name];
  1270. }
  1271. if (baseApi[name]) {
  1272. return baseApi[name];
  1273. }
  1274. if (api[name]) {
  1275. return promisify(name, api[name]);
  1276. }
  1277. {
  1278. if (extraApi[name]) {
  1279. return promisify(name, extraApi[name]);
  1280. }
  1281. if (todoApis[name]) {
  1282. return promisify(name, todoApis[name]);
  1283. }
  1284. }
  1285. if (eventApi[name]) {
  1286. return eventApi[name];
  1287. }
  1288. if (!hasOwn(wx, name) && !hasOwn(protocols, name)) {
  1289. return;
  1290. }
  1291. return promisify(name, wrapper(name, wx[name]));
  1292. },
  1293. set: function set(target, name, value) {
  1294. target[name] = value;
  1295. return true;
  1296. } });
  1297. } else {
  1298. Object.keys(baseApi).forEach(function (name) {
  1299. uni[name] = baseApi[name];
  1300. });
  1301. {
  1302. Object.keys(todoApis).forEach(function (name) {
  1303. uni[name] = promisify(name, todoApis[name]);
  1304. });
  1305. Object.keys(extraApi).forEach(function (name) {
  1306. uni[name] = promisify(name, todoApis[name]);
  1307. });
  1308. }
  1309. Object.keys(eventApi).forEach(function (name) {
  1310. uni[name] = eventApi[name];
  1311. });
  1312. Object.keys(api).forEach(function (name) {
  1313. uni[name] = promisify(name, api[name]);
  1314. });
  1315. Object.keys(wx).forEach(function (name) {
  1316. if (hasOwn(wx, name) || hasOwn(protocols, name)) {
  1317. uni[name] = promisify(name, wrapper(name, wx[name]));
  1318. }
  1319. });
  1320. }
  1321. wx.createApp = createApp;
  1322. wx.createPage = createPage;
  1323. wx.createComponent = createComponent;
  1324. var uni$1 = uni;var _default =
  1325. uni$1;exports.default = _default;
  1326. /***/ }),
  1327. /* 2 */
  1328. /*!******************************************************************************************!*\
  1329. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js ***!
  1330. \******************************************************************************************/
  1331. /*! exports provided: default */
  1332. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1333. "use strict";
  1334. __webpack_require__.r(__webpack_exports__);
  1335. /* WEBPACK VAR INJECTION */(function(global) {/*!
  1336. * Vue.js v2.6.11
  1337. * (c) 2014-2020 Evan You
  1338. * Released under the MIT License.
  1339. */
  1340. /* */
  1341. var emptyObject = Object.freeze({});
  1342. // These helpers produce better VM code in JS engines due to their
  1343. // explicitness and function inlining.
  1344. function isUndef (v) {
  1345. return v === undefined || v === null
  1346. }
  1347. function isDef (v) {
  1348. return v !== undefined && v !== null
  1349. }
  1350. function isTrue (v) {
  1351. return v === true
  1352. }
  1353. function isFalse (v) {
  1354. return v === false
  1355. }
  1356. /**
  1357. * Check if value is primitive.
  1358. */
  1359. function isPrimitive (value) {
  1360. return (
  1361. typeof value === 'string' ||
  1362. typeof value === 'number' ||
  1363. // $flow-disable-line
  1364. typeof value === 'symbol' ||
  1365. typeof value === 'boolean'
  1366. )
  1367. }
  1368. /**
  1369. * Quick object check - this is primarily used to tell
  1370. * Objects from primitive values when we know the value
  1371. * is a JSON-compliant type.
  1372. */
  1373. function isObject (obj) {
  1374. return obj !== null && typeof obj === 'object'
  1375. }
  1376. /**
  1377. * Get the raw type string of a value, e.g., [object Object].
  1378. */
  1379. var _toString = Object.prototype.toString;
  1380. function toRawType (value) {
  1381. return _toString.call(value).slice(8, -1)
  1382. }
  1383. /**
  1384. * Strict object type check. Only returns true
  1385. * for plain JavaScript objects.
  1386. */
  1387. function isPlainObject (obj) {
  1388. return _toString.call(obj) === '[object Object]'
  1389. }
  1390. function isRegExp (v) {
  1391. return _toString.call(v) === '[object RegExp]'
  1392. }
  1393. /**
  1394. * Check if val is a valid array index.
  1395. */
  1396. function isValidArrayIndex (val) {
  1397. var n = parseFloat(String(val));
  1398. return n >= 0 && Math.floor(n) === n && isFinite(val)
  1399. }
  1400. function isPromise (val) {
  1401. return (
  1402. isDef(val) &&
  1403. typeof val.then === 'function' &&
  1404. typeof val.catch === 'function'
  1405. )
  1406. }
  1407. /**
  1408. * Convert a value to a string that is actually rendered.
  1409. */
  1410. function toString (val) {
  1411. return val == null
  1412. ? ''
  1413. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  1414. ? JSON.stringify(val, null, 2)
  1415. : String(val)
  1416. }
  1417. /**
  1418. * Convert an input value to a number for persistence.
  1419. * If the conversion fails, return original string.
  1420. */
  1421. function toNumber (val) {
  1422. var n = parseFloat(val);
  1423. return isNaN(n) ? val : n
  1424. }
  1425. /**
  1426. * Make a map and return a function for checking if a key
  1427. * is in that map.
  1428. */
  1429. function makeMap (
  1430. str,
  1431. expectsLowerCase
  1432. ) {
  1433. var map = Object.create(null);
  1434. var list = str.split(',');
  1435. for (var i = 0; i < list.length; i++) {
  1436. map[list[i]] = true;
  1437. }
  1438. return expectsLowerCase
  1439. ? function (val) { return map[val.toLowerCase()]; }
  1440. : function (val) { return map[val]; }
  1441. }
  1442. /**
  1443. * Check if a tag is a built-in tag.
  1444. */
  1445. var isBuiltInTag = makeMap('slot,component', true);
  1446. /**
  1447. * Check if an attribute is a reserved attribute.
  1448. */
  1449. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  1450. /**
  1451. * Remove an item from an array.
  1452. */
  1453. function remove (arr, item) {
  1454. if (arr.length) {
  1455. var index = arr.indexOf(item);
  1456. if (index > -1) {
  1457. return arr.splice(index, 1)
  1458. }
  1459. }
  1460. }
  1461. /**
  1462. * Check whether an object has the property.
  1463. */
  1464. var hasOwnProperty = Object.prototype.hasOwnProperty;
  1465. function hasOwn (obj, key) {
  1466. return hasOwnProperty.call(obj, key)
  1467. }
  1468. /**
  1469. * Create a cached version of a pure function.
  1470. */
  1471. function cached (fn) {
  1472. var cache = Object.create(null);
  1473. return (function cachedFn (str) {
  1474. var hit = cache[str];
  1475. return hit || (cache[str] = fn(str))
  1476. })
  1477. }
  1478. /**
  1479. * Camelize a hyphen-delimited string.
  1480. */
  1481. var camelizeRE = /-(\w)/g;
  1482. var camelize = cached(function (str) {
  1483. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  1484. });
  1485. /**
  1486. * Capitalize a string.
  1487. */
  1488. var capitalize = cached(function (str) {
  1489. return str.charAt(0).toUpperCase() + str.slice(1)
  1490. });
  1491. /**
  1492. * Hyphenate a camelCase string.
  1493. */
  1494. var hyphenateRE = /\B([A-Z])/g;
  1495. var hyphenate = cached(function (str) {
  1496. return str.replace(hyphenateRE, '-$1').toLowerCase()
  1497. });
  1498. /**
  1499. * Simple bind polyfill for environments that do not support it,
  1500. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  1501. * since native bind is now performant enough in most browsers.
  1502. * But removing it would mean breaking code that was able to run in
  1503. * PhantomJS 1.x, so this must be kept for backward compatibility.
  1504. */
  1505. /* istanbul ignore next */
  1506. function polyfillBind (fn, ctx) {
  1507. function boundFn (a) {
  1508. var l = arguments.length;
  1509. return l
  1510. ? l > 1
  1511. ? fn.apply(ctx, arguments)
  1512. : fn.call(ctx, a)
  1513. : fn.call(ctx)
  1514. }
  1515. boundFn._length = fn.length;
  1516. return boundFn
  1517. }
  1518. function nativeBind (fn, ctx) {
  1519. return fn.bind(ctx)
  1520. }
  1521. var bind = Function.prototype.bind
  1522. ? nativeBind
  1523. : polyfillBind;
  1524. /**
  1525. * Convert an Array-like object to a real Array.
  1526. */
  1527. function toArray (list, start) {
  1528. start = start || 0;
  1529. var i = list.length - start;
  1530. var ret = new Array(i);
  1531. while (i--) {
  1532. ret[i] = list[i + start];
  1533. }
  1534. return ret
  1535. }
  1536. /**
  1537. * Mix properties into target object.
  1538. */
  1539. function extend (to, _from) {
  1540. for (var key in _from) {
  1541. to[key] = _from[key];
  1542. }
  1543. return to
  1544. }
  1545. /**
  1546. * Merge an Array of Objects into a single Object.
  1547. */
  1548. function toObject (arr) {
  1549. var res = {};
  1550. for (var i = 0; i < arr.length; i++) {
  1551. if (arr[i]) {
  1552. extend(res, arr[i]);
  1553. }
  1554. }
  1555. return res
  1556. }
  1557. /* eslint-disable no-unused-vars */
  1558. /**
  1559. * Perform no operation.
  1560. * Stubbing args to make Flow happy without leaving useless transpiled code
  1561. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  1562. */
  1563. function noop (a, b, c) {}
  1564. /**
  1565. * Always return false.
  1566. */
  1567. var no = function (a, b, c) { return false; };
  1568. /* eslint-enable no-unused-vars */
  1569. /**
  1570. * Return the same value.
  1571. */
  1572. var identity = function (_) { return _; };
  1573. /**
  1574. * Check if two values are loosely equal - that is,
  1575. * if they are plain objects, do they have the same shape?
  1576. */
  1577. function looseEqual (a, b) {
  1578. if (a === b) { return true }
  1579. var isObjectA = isObject(a);
  1580. var isObjectB = isObject(b);
  1581. if (isObjectA && isObjectB) {
  1582. try {
  1583. var isArrayA = Array.isArray(a);
  1584. var isArrayB = Array.isArray(b);
  1585. if (isArrayA && isArrayB) {
  1586. return a.length === b.length && a.every(function (e, i) {
  1587. return looseEqual(e, b[i])
  1588. })
  1589. } else if (a instanceof Date && b instanceof Date) {
  1590. return a.getTime() === b.getTime()
  1591. } else if (!isArrayA && !isArrayB) {
  1592. var keysA = Object.keys(a);
  1593. var keysB = Object.keys(b);
  1594. return keysA.length === keysB.length && keysA.every(function (key) {
  1595. return looseEqual(a[key], b[key])
  1596. })
  1597. } else {
  1598. /* istanbul ignore next */
  1599. return false
  1600. }
  1601. } catch (e) {
  1602. /* istanbul ignore next */
  1603. return false
  1604. }
  1605. } else if (!isObjectA && !isObjectB) {
  1606. return String(a) === String(b)
  1607. } else {
  1608. return false
  1609. }
  1610. }
  1611. /**
  1612. * Return the first index at which a loosely equal value can be
  1613. * found in the array (if value is a plain object, the array must
  1614. * contain an object of the same shape), or -1 if it is not present.
  1615. */
  1616. function looseIndexOf (arr, val) {
  1617. for (var i = 0; i < arr.length; i++) {
  1618. if (looseEqual(arr[i], val)) { return i }
  1619. }
  1620. return -1
  1621. }
  1622. /**
  1623. * Ensure a function is called only once.
  1624. */
  1625. function once (fn) {
  1626. var called = false;
  1627. return function () {
  1628. if (!called) {
  1629. called = true;
  1630. fn.apply(this, arguments);
  1631. }
  1632. }
  1633. }
  1634. var ASSET_TYPES = [
  1635. 'component',
  1636. 'directive',
  1637. 'filter'
  1638. ];
  1639. var LIFECYCLE_HOOKS = [
  1640. 'beforeCreate',
  1641. 'created',
  1642. 'beforeMount',
  1643. 'mounted',
  1644. 'beforeUpdate',
  1645. 'updated',
  1646. 'beforeDestroy',
  1647. 'destroyed',
  1648. 'activated',
  1649. 'deactivated',
  1650. 'errorCaptured',
  1651. 'serverPrefetch'
  1652. ];
  1653. /* */
  1654. var config = ({
  1655. /**
  1656. * Option merge strategies (used in core/util/options)
  1657. */
  1658. // $flow-disable-line
  1659. optionMergeStrategies: Object.create(null),
  1660. /**
  1661. * Whether to suppress warnings.
  1662. */
  1663. silent: false,
  1664. /**
  1665. * Show production mode tip message on boot?
  1666. */
  1667. productionTip: "development" !== 'production',
  1668. /**
  1669. * Whether to enable devtools
  1670. */
  1671. devtools: "development" !== 'production',
  1672. /**
  1673. * Whether to record perf
  1674. */
  1675. performance: false,
  1676. /**
  1677. * Error handler for watcher errors
  1678. */
  1679. errorHandler: null,
  1680. /**
  1681. * Warn handler for watcher warns
  1682. */
  1683. warnHandler: null,
  1684. /**
  1685. * Ignore certain custom elements
  1686. */
  1687. ignoredElements: [],
  1688. /**
  1689. * Custom user key aliases for v-on
  1690. */
  1691. // $flow-disable-line
  1692. keyCodes: Object.create(null),
  1693. /**
  1694. * Check if a tag is reserved so that it cannot be registered as a
  1695. * component. This is platform-dependent and may be overwritten.
  1696. */
  1697. isReservedTag: no,
  1698. /**
  1699. * Check if an attribute is reserved so that it cannot be used as a component
  1700. * prop. This is platform-dependent and may be overwritten.
  1701. */
  1702. isReservedAttr: no,
  1703. /**
  1704. * Check if a tag is an unknown element.
  1705. * Platform-dependent.
  1706. */
  1707. isUnknownElement: no,
  1708. /**
  1709. * Get the namespace of an element
  1710. */
  1711. getTagNamespace: noop,
  1712. /**
  1713. * Parse the real tag name for the specific platform.
  1714. */
  1715. parsePlatformTagName: identity,
  1716. /**
  1717. * Check if an attribute must be bound using property, e.g. value
  1718. * Platform-dependent.
  1719. */
  1720. mustUseProp: no,
  1721. /**
  1722. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  1723. * This will significantly reduce performance if set to false.
  1724. */
  1725. async: true,
  1726. /**
  1727. * Exposed for legacy reasons
  1728. */
  1729. _lifecycleHooks: LIFECYCLE_HOOKS
  1730. });
  1731. /* */
  1732. /**
  1733. * unicode letters used for parsing html tags, component names and property paths.
  1734. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  1735. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  1736. */
  1737. 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/;
  1738. /**
  1739. * Check if a string starts with $ or _
  1740. */
  1741. function isReserved (str) {
  1742. var c = (str + '').charCodeAt(0);
  1743. return c === 0x24 || c === 0x5F
  1744. }
  1745. /**
  1746. * Define a property.
  1747. */
  1748. function def (obj, key, val, enumerable) {
  1749. Object.defineProperty(obj, key, {
  1750. value: val,
  1751. enumerable: !!enumerable,
  1752. writable: true,
  1753. configurable: true
  1754. });
  1755. }
  1756. /**
  1757. * Parse simple path.
  1758. */
  1759. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  1760. function parsePath (path) {
  1761. if (bailRE.test(path)) {
  1762. return
  1763. }
  1764. var segments = path.split('.');
  1765. return function (obj) {
  1766. for (var i = 0; i < segments.length; i++) {
  1767. if (!obj) { return }
  1768. obj = obj[segments[i]];
  1769. }
  1770. return obj
  1771. }
  1772. }
  1773. /* */
  1774. // can we use __proto__?
  1775. var hasProto = '__proto__' in {};
  1776. // Browser environment sniffing
  1777. var inBrowser = typeof window !== 'undefined';
  1778. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  1779. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  1780. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  1781. var isIE = UA && /msie|trident/.test(UA);
  1782. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  1783. var isEdge = UA && UA.indexOf('edge/') > 0;
  1784. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  1785. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  1786. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  1787. var isPhantomJS = UA && /phantomjs/.test(UA);
  1788. var isFF = UA && UA.match(/firefox\/(\d+)/);
  1789. // Firefox has a "watch" function on Object.prototype...
  1790. var nativeWatch = ({}).watch;
  1791. if (inBrowser) {
  1792. try {
  1793. var opts = {};
  1794. Object.defineProperty(opts, 'passive', ({
  1795. get: function get () {
  1796. }
  1797. })); // https://github.com/facebook/flow/issues/285
  1798. window.addEventListener('test-passive', null, opts);
  1799. } catch (e) {}
  1800. }
  1801. // this needs to be lazy-evaled because vue may be required before
  1802. // vue-server-renderer can set VUE_ENV
  1803. var _isServer;
  1804. var isServerRendering = function () {
  1805. if (_isServer === undefined) {
  1806. /* istanbul ignore if */
  1807. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  1808. // detect presence of vue-server-renderer and avoid
  1809. // Webpack shimming the process
  1810. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  1811. } else {
  1812. _isServer = false;
  1813. }
  1814. }
  1815. return _isServer
  1816. };
  1817. // detect devtools
  1818. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  1819. /* istanbul ignore next */
  1820. function isNative (Ctor) {
  1821. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  1822. }
  1823. var hasSymbol =
  1824. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  1825. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  1826. var _Set;
  1827. /* istanbul ignore if */ // $flow-disable-line
  1828. if (typeof Set !== 'undefined' && isNative(Set)) {
  1829. // use native Set when available.
  1830. _Set = Set;
  1831. } else {
  1832. // a non-standard Set polyfill that only works with primitive keys.
  1833. _Set = /*@__PURE__*/(function () {
  1834. function Set () {
  1835. this.set = Object.create(null);
  1836. }
  1837. Set.prototype.has = function has (key) {
  1838. return this.set[key] === true
  1839. };
  1840. Set.prototype.add = function add (key) {
  1841. this.set[key] = true;
  1842. };
  1843. Set.prototype.clear = function clear () {
  1844. this.set = Object.create(null);
  1845. };
  1846. return Set;
  1847. }());
  1848. }
  1849. /* */
  1850. var warn = noop;
  1851. var tip = noop;
  1852. var generateComponentTrace = (noop); // work around flow check
  1853. var formatComponentName = (noop);
  1854. if (true) {
  1855. var hasConsole = typeof console !== 'undefined';
  1856. var classifyRE = /(?:^|[-_])(\w)/g;
  1857. var classify = function (str) { return str
  1858. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  1859. .replace(/[-_]/g, ''); };
  1860. warn = function (msg, vm) {
  1861. var trace = vm ? generateComponentTrace(vm) : '';
  1862. if (config.warnHandler) {
  1863. config.warnHandler.call(null, msg, vm, trace);
  1864. } else if (hasConsole && (!config.silent)) {
  1865. console.error(("[Vue warn]: " + msg + trace));
  1866. }
  1867. };
  1868. tip = function (msg, vm) {
  1869. if (hasConsole && (!config.silent)) {
  1870. console.warn("[Vue tip]: " + msg + (
  1871. vm ? generateComponentTrace(vm) : ''
  1872. ));
  1873. }
  1874. };
  1875. formatComponentName = function (vm, includeFile) {
  1876. if (vm.$root === vm) {
  1877. if (vm.$options && vm.$options.__file) { // fixed by xxxxxx
  1878. return ('') + vm.$options.__file
  1879. }
  1880. return '<Root>'
  1881. }
  1882. var options = typeof vm === 'function' && vm.cid != null
  1883. ? vm.options
  1884. : vm._isVue
  1885. ? vm.$options || vm.constructor.options
  1886. : vm;
  1887. var name = options.name || options._componentTag;
  1888. var file = options.__file;
  1889. if (!name && file) {
  1890. var match = file.match(/([^/\\]+)\.vue$/);
  1891. name = match && match[1];
  1892. }
  1893. return (
  1894. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  1895. (file && includeFile !== false ? (" at " + file) : '')
  1896. )
  1897. };
  1898. var repeat = function (str, n) {
  1899. var res = '';
  1900. while (n) {
  1901. if (n % 2 === 1) { res += str; }
  1902. if (n > 1) { str += str; }
  1903. n >>= 1;
  1904. }
  1905. return res
  1906. };
  1907. generateComponentTrace = function (vm) {
  1908. if (vm._isVue && vm.$parent) {
  1909. var tree = [];
  1910. var currentRecursiveSequence = 0;
  1911. while (vm && vm.$options.name !== 'PageBody') {
  1912. if (tree.length > 0) {
  1913. var last = tree[tree.length - 1];
  1914. if (last.constructor === vm.constructor) {
  1915. currentRecursiveSequence++;
  1916. vm = vm.$parent;
  1917. continue
  1918. } else if (currentRecursiveSequence > 0) {
  1919. tree[tree.length - 1] = [last, currentRecursiveSequence];
  1920. currentRecursiveSequence = 0;
  1921. }
  1922. }
  1923. !vm.$options.isReserved && tree.push(vm);
  1924. vm = vm.$parent;
  1925. }
  1926. return '\n\nfound in\n\n' + tree
  1927. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  1928. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  1929. : formatComponentName(vm))); })
  1930. .join('\n')
  1931. } else {
  1932. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  1933. }
  1934. };
  1935. }
  1936. /* */
  1937. var uid = 0;
  1938. /**
  1939. * A dep is an observable that can have multiple
  1940. * directives subscribing to it.
  1941. */
  1942. var Dep = function Dep () {
  1943. this.id = uid++;
  1944. this.subs = [];
  1945. };
  1946. Dep.prototype.addSub = function addSub (sub) {
  1947. this.subs.push(sub);
  1948. };
  1949. Dep.prototype.removeSub = function removeSub (sub) {
  1950. remove(this.subs, sub);
  1951. };
  1952. Dep.prototype.depend = function depend () {
  1953. if (Dep.SharedObject.target) {
  1954. Dep.SharedObject.target.addDep(this);
  1955. }
  1956. };
  1957. Dep.prototype.notify = function notify () {
  1958. // stabilize the subscriber list first
  1959. var subs = this.subs.slice();
  1960. if ( true && !config.async) {
  1961. // subs aren't sorted in scheduler if not running async
  1962. // we need to sort them now to make sure they fire in correct
  1963. // order
  1964. subs.sort(function (a, b) { return a.id - b.id; });
  1965. }
  1966. for (var i = 0, l = subs.length; i < l; i++) {
  1967. subs[i].update();
  1968. }
  1969. };
  1970. // The current target watcher being evaluated.
  1971. // This is globally unique because only one watcher
  1972. // can be evaluated at a time.
  1973. // fixed by xxxxxx (nvue shared vuex)
  1974. /* eslint-disable no-undef */
  1975. Dep.SharedObject = {};
  1976. Dep.SharedObject.target = null;
  1977. Dep.SharedObject.targetStack = [];
  1978. function pushTarget (target) {
  1979. Dep.SharedObject.targetStack.push(target);
  1980. Dep.SharedObject.target = target;
  1981. }
  1982. function popTarget () {
  1983. Dep.SharedObject.targetStack.pop();
  1984. Dep.SharedObject.target = Dep.SharedObject.targetStack[Dep.SharedObject.targetStack.length - 1];
  1985. }
  1986. /* */
  1987. var VNode = function VNode (
  1988. tag,
  1989. data,
  1990. children,
  1991. text,
  1992. elm,
  1993. context,
  1994. componentOptions,
  1995. asyncFactory
  1996. ) {
  1997. this.tag = tag;
  1998. this.data = data;
  1999. this.children = children;
  2000. this.text = text;
  2001. this.elm = elm;
  2002. this.ns = undefined;
  2003. this.context = context;
  2004. this.fnContext = undefined;
  2005. this.fnOptions = undefined;
  2006. this.fnScopeId = undefined;
  2007. this.key = data && data.key;
  2008. this.componentOptions = componentOptions;
  2009. this.componentInstance = undefined;
  2010. this.parent = undefined;
  2011. this.raw = false;
  2012. this.isStatic = false;
  2013. this.isRootInsert = true;
  2014. this.isComment = false;
  2015. this.isCloned = false;
  2016. this.isOnce = false;
  2017. this.asyncFactory = asyncFactory;
  2018. this.asyncMeta = undefined;
  2019. this.isAsyncPlaceholder = false;
  2020. };
  2021. var prototypeAccessors = { child: { configurable: true } };
  2022. // DEPRECATED: alias for componentInstance for backwards compat.
  2023. /* istanbul ignore next */
  2024. prototypeAccessors.child.get = function () {
  2025. return this.componentInstance
  2026. };
  2027. Object.defineProperties( VNode.prototype, prototypeAccessors );
  2028. var createEmptyVNode = function (text) {
  2029. if ( text === void 0 ) text = '';
  2030. var node = new VNode();
  2031. node.text = text;
  2032. node.isComment = true;
  2033. return node
  2034. };
  2035. function createTextVNode (val) {
  2036. return new VNode(undefined, undefined, undefined, String(val))
  2037. }
  2038. // optimized shallow clone
  2039. // used for static nodes and slot nodes because they may be reused across
  2040. // multiple renders, cloning them avoids errors when DOM manipulations rely
  2041. // on their elm reference.
  2042. function cloneVNode (vnode) {
  2043. var cloned = new VNode(
  2044. vnode.tag,
  2045. vnode.data,
  2046. // #7975
  2047. // clone children array to avoid mutating original in case of cloning
  2048. // a child.
  2049. vnode.children && vnode.children.slice(),
  2050. vnode.text,
  2051. vnode.elm,
  2052. vnode.context,
  2053. vnode.componentOptions,
  2054. vnode.asyncFactory
  2055. );
  2056. cloned.ns = vnode.ns;
  2057. cloned.isStatic = vnode.isStatic;
  2058. cloned.key = vnode.key;
  2059. cloned.isComment = vnode.isComment;
  2060. cloned.fnContext = vnode.fnContext;
  2061. cloned.fnOptions = vnode.fnOptions;
  2062. cloned.fnScopeId = vnode.fnScopeId;
  2063. cloned.asyncMeta = vnode.asyncMeta;
  2064. cloned.isCloned = true;
  2065. return cloned
  2066. }
  2067. /*
  2068. * not type checking this file because flow doesn't play well with
  2069. * dynamically accessing methods on Array prototype
  2070. */
  2071. var arrayProto = Array.prototype;
  2072. var arrayMethods = Object.create(arrayProto);
  2073. var methodsToPatch = [
  2074. 'push',
  2075. 'pop',
  2076. 'shift',
  2077. 'unshift',
  2078. 'splice',
  2079. 'sort',
  2080. 'reverse'
  2081. ];
  2082. /**
  2083. * Intercept mutating methods and emit events
  2084. */
  2085. methodsToPatch.forEach(function (method) {
  2086. // cache original method
  2087. var original = arrayProto[method];
  2088. def(arrayMethods, method, function mutator () {
  2089. var args = [], len = arguments.length;
  2090. while ( len-- ) args[ len ] = arguments[ len ];
  2091. var result = original.apply(this, args);
  2092. var ob = this.__ob__;
  2093. var inserted;
  2094. switch (method) {
  2095. case 'push':
  2096. case 'unshift':
  2097. inserted = args;
  2098. break
  2099. case 'splice':
  2100. inserted = args.slice(2);
  2101. break
  2102. }
  2103. if (inserted) { ob.observeArray(inserted); }
  2104. // notify change
  2105. ob.dep.notify();
  2106. return result
  2107. });
  2108. });
  2109. /* */
  2110. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  2111. /**
  2112. * In some cases we may want to disable observation inside a component's
  2113. * update computation.
  2114. */
  2115. var shouldObserve = true;
  2116. function toggleObserving (value) {
  2117. shouldObserve = value;
  2118. }
  2119. /**
  2120. * Observer class that is attached to each observed
  2121. * object. Once attached, the observer converts the target
  2122. * object's property keys into getter/setters that
  2123. * collect dependencies and dispatch updates.
  2124. */
  2125. var Observer = function Observer (value) {
  2126. this.value = value;
  2127. this.dep = new Dep();
  2128. this.vmCount = 0;
  2129. def(value, '__ob__', this);
  2130. if (Array.isArray(value)) {
  2131. if (hasProto) {
  2132. {// fixed by xxxxxx 微信小程序使用 plugins 之后,数组方法被直接挂载到了数组对象上,需要执行 copyAugment 逻辑
  2133. if(value.push !== value.__proto__.push){
  2134. copyAugment(value, arrayMethods, arrayKeys);
  2135. } else {
  2136. protoAugment(value, arrayMethods);
  2137. }
  2138. }
  2139. } else {
  2140. copyAugment(value, arrayMethods, arrayKeys);
  2141. }
  2142. this.observeArray(value);
  2143. } else {
  2144. this.walk(value);
  2145. }
  2146. };
  2147. /**
  2148. * Walk through all properties and convert them into
  2149. * getter/setters. This method should only be called when
  2150. * value type is Object.
  2151. */
  2152. Observer.prototype.walk = function walk (obj) {
  2153. var keys = Object.keys(obj);
  2154. for (var i = 0; i < keys.length; i++) {
  2155. defineReactive$$1(obj, keys[i]);
  2156. }
  2157. };
  2158. /**
  2159. * Observe a list of Array items.
  2160. */
  2161. Observer.prototype.observeArray = function observeArray (items) {
  2162. for (var i = 0, l = items.length; i < l; i++) {
  2163. observe(items[i]);
  2164. }
  2165. };
  2166. // helpers
  2167. /**
  2168. * Augment a target Object or Array by intercepting
  2169. * the prototype chain using __proto__
  2170. */
  2171. function protoAugment (target, src) {
  2172. /* eslint-disable no-proto */
  2173. target.__proto__ = src;
  2174. /* eslint-enable no-proto */
  2175. }
  2176. /**
  2177. * Augment a target Object or Array by defining
  2178. * hidden properties.
  2179. */
  2180. /* istanbul ignore next */
  2181. function copyAugment (target, src, keys) {
  2182. for (var i = 0, l = keys.length; i < l; i++) {
  2183. var key = keys[i];
  2184. def(target, key, src[key]);
  2185. }
  2186. }
  2187. /**
  2188. * Attempt to create an observer instance for a value,
  2189. * returns the new observer if successfully observed,
  2190. * or the existing observer if the value already has one.
  2191. */
  2192. function observe (value, asRootData) {
  2193. if (!isObject(value) || value instanceof VNode) {
  2194. return
  2195. }
  2196. var ob;
  2197. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  2198. ob = value.__ob__;
  2199. } else if (
  2200. shouldObserve &&
  2201. !isServerRendering() &&
  2202. (Array.isArray(value) || isPlainObject(value)) &&
  2203. Object.isExtensible(value) &&
  2204. !value._isVue
  2205. ) {
  2206. ob = new Observer(value);
  2207. }
  2208. if (asRootData && ob) {
  2209. ob.vmCount++;
  2210. }
  2211. return ob
  2212. }
  2213. /**
  2214. * Define a reactive property on an Object.
  2215. */
  2216. function defineReactive$$1 (
  2217. obj,
  2218. key,
  2219. val,
  2220. customSetter,
  2221. shallow
  2222. ) {
  2223. var dep = new Dep();
  2224. var property = Object.getOwnPropertyDescriptor(obj, key);
  2225. if (property && property.configurable === false) {
  2226. return
  2227. }
  2228. // cater for pre-defined getter/setters
  2229. var getter = property && property.get;
  2230. var setter = property && property.set;
  2231. if ((!getter || setter) && arguments.length === 2) {
  2232. val = obj[key];
  2233. }
  2234. var childOb = !shallow && observe(val);
  2235. Object.defineProperty(obj, key, {
  2236. enumerable: true,
  2237. configurable: true,
  2238. get: function reactiveGetter () {
  2239. var value = getter ? getter.call(obj) : val;
  2240. if (Dep.SharedObject.target) { // fixed by xxxxxx
  2241. dep.depend();
  2242. if (childOb) {
  2243. childOb.dep.depend();
  2244. if (Array.isArray(value)) {
  2245. dependArray(value);
  2246. }
  2247. }
  2248. }
  2249. return value
  2250. },
  2251. set: function reactiveSetter (newVal) {
  2252. var value = getter ? getter.call(obj) : val;
  2253. /* eslint-disable no-self-compare */
  2254. if (newVal === value || (newVal !== newVal && value !== value)) {
  2255. return
  2256. }
  2257. /* eslint-enable no-self-compare */
  2258. if ( true && customSetter) {
  2259. customSetter();
  2260. }
  2261. // #7981: for accessor properties without setter
  2262. if (getter && !setter) { return }
  2263. if (setter) {
  2264. setter.call(obj, newVal);
  2265. } else {
  2266. val = newVal;
  2267. }
  2268. childOb = !shallow && observe(newVal);
  2269. dep.notify();
  2270. }
  2271. });
  2272. }
  2273. /**
  2274. * Set a property on an object. Adds the new property and
  2275. * triggers change notification if the property doesn't
  2276. * already exist.
  2277. */
  2278. function set (target, key, val) {
  2279. if ( true &&
  2280. (isUndef(target) || isPrimitive(target))
  2281. ) {
  2282. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  2283. }
  2284. if (Array.isArray(target) && isValidArrayIndex(key)) {
  2285. target.length = Math.max(target.length, key);
  2286. target.splice(key, 1, val);
  2287. return val
  2288. }
  2289. if (key in target && !(key in Object.prototype)) {
  2290. target[key] = val;
  2291. return val
  2292. }
  2293. var ob = (target).__ob__;
  2294. if (target._isVue || (ob && ob.vmCount)) {
  2295. true && warn(
  2296. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  2297. 'at runtime - declare it upfront in the data option.'
  2298. );
  2299. return val
  2300. }
  2301. if (!ob) {
  2302. target[key] = val;
  2303. return val
  2304. }
  2305. defineReactive$$1(ob.value, key, val);
  2306. ob.dep.notify();
  2307. return val
  2308. }
  2309. /**
  2310. * Delete a property and trigger change if necessary.
  2311. */
  2312. function del (target, key) {
  2313. if ( true &&
  2314. (isUndef(target) || isPrimitive(target))
  2315. ) {
  2316. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  2317. }
  2318. if (Array.isArray(target) && isValidArrayIndex(key)) {
  2319. target.splice(key, 1);
  2320. return
  2321. }
  2322. var ob = (target).__ob__;
  2323. if (target._isVue || (ob && ob.vmCount)) {
  2324. true && warn(
  2325. 'Avoid deleting properties on a Vue instance or its root $data ' +
  2326. '- just set it to null.'
  2327. );
  2328. return
  2329. }
  2330. if (!hasOwn(target, key)) {
  2331. return
  2332. }
  2333. delete target[key];
  2334. if (!ob) {
  2335. return
  2336. }
  2337. ob.dep.notify();
  2338. }
  2339. /**
  2340. * Collect dependencies on array elements when the array is touched, since
  2341. * we cannot intercept array element access like property getters.
  2342. */
  2343. function dependArray (value) {
  2344. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  2345. e = value[i];
  2346. e && e.__ob__ && e.__ob__.dep.depend();
  2347. if (Array.isArray(e)) {
  2348. dependArray(e);
  2349. }
  2350. }
  2351. }
  2352. /* */
  2353. /**
  2354. * Option overwriting strategies are functions that handle
  2355. * how to merge a parent option value and a child option
  2356. * value into the final value.
  2357. */
  2358. var strats = config.optionMergeStrategies;
  2359. /**
  2360. * Options with restrictions
  2361. */
  2362. if (true) {
  2363. strats.el = strats.propsData = function (parent, child, vm, key) {
  2364. if (!vm) {
  2365. warn(
  2366. "option \"" + key + "\" can only be used during instance " +
  2367. 'creation with the `new` keyword.'
  2368. );
  2369. }
  2370. return defaultStrat(parent, child)
  2371. };
  2372. }
  2373. /**
  2374. * Helper that recursively merges two data objects together.
  2375. */
  2376. function mergeData (to, from) {
  2377. if (!from) { return to }
  2378. var key, toVal, fromVal;
  2379. var keys = hasSymbol
  2380. ? Reflect.ownKeys(from)
  2381. : Object.keys(from);
  2382. for (var i = 0; i < keys.length; i++) {
  2383. key = keys[i];
  2384. // in case the object is already observed...
  2385. if (key === '__ob__') { continue }
  2386. toVal = to[key];
  2387. fromVal = from[key];
  2388. if (!hasOwn(to, key)) {
  2389. set(to, key, fromVal);
  2390. } else if (
  2391. toVal !== fromVal &&
  2392. isPlainObject(toVal) &&
  2393. isPlainObject(fromVal)
  2394. ) {
  2395. mergeData(toVal, fromVal);
  2396. }
  2397. }
  2398. return to
  2399. }
  2400. /**
  2401. * Data
  2402. */
  2403. function mergeDataOrFn (
  2404. parentVal,
  2405. childVal,
  2406. vm
  2407. ) {
  2408. if (!vm) {
  2409. // in a Vue.extend merge, both should be functions
  2410. if (!childVal) {
  2411. return parentVal
  2412. }
  2413. if (!parentVal) {
  2414. return childVal
  2415. }
  2416. // when parentVal & childVal are both present,
  2417. // we need to return a function that returns the
  2418. // merged result of both functions... no need to
  2419. // check if parentVal is a function here because
  2420. // it has to be a function to pass previous merges.
  2421. return function mergedDataFn () {
  2422. return mergeData(
  2423. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  2424. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  2425. )
  2426. }
  2427. } else {
  2428. return function mergedInstanceDataFn () {
  2429. // instance merge
  2430. var instanceData = typeof childVal === 'function'
  2431. ? childVal.call(vm, vm)
  2432. : childVal;
  2433. var defaultData = typeof parentVal === 'function'
  2434. ? parentVal.call(vm, vm)
  2435. : parentVal;
  2436. if (instanceData) {
  2437. return mergeData(instanceData, defaultData)
  2438. } else {
  2439. return defaultData
  2440. }
  2441. }
  2442. }
  2443. }
  2444. strats.data = function (
  2445. parentVal,
  2446. childVal,
  2447. vm
  2448. ) {
  2449. if (!vm) {
  2450. if (childVal && typeof childVal !== 'function') {
  2451. true && warn(
  2452. 'The "data" option should be a function ' +
  2453. 'that returns a per-instance value in component ' +
  2454. 'definitions.',
  2455. vm
  2456. );
  2457. return parentVal
  2458. }
  2459. return mergeDataOrFn(parentVal, childVal)
  2460. }
  2461. return mergeDataOrFn(parentVal, childVal, vm)
  2462. };
  2463. /**
  2464. * Hooks and props are merged as arrays.
  2465. */
  2466. function mergeHook (
  2467. parentVal,
  2468. childVal
  2469. ) {
  2470. var res = childVal
  2471. ? parentVal
  2472. ? parentVal.concat(childVal)
  2473. : Array.isArray(childVal)
  2474. ? childVal
  2475. : [childVal]
  2476. : parentVal;
  2477. return res
  2478. ? dedupeHooks(res)
  2479. : res
  2480. }
  2481. function dedupeHooks (hooks) {
  2482. var res = [];
  2483. for (var i = 0; i < hooks.length; i++) {
  2484. if (res.indexOf(hooks[i]) === -1) {
  2485. res.push(hooks[i]);
  2486. }
  2487. }
  2488. return res
  2489. }
  2490. LIFECYCLE_HOOKS.forEach(function (hook) {
  2491. strats[hook] = mergeHook;
  2492. });
  2493. /**
  2494. * Assets
  2495. *
  2496. * When a vm is present (instance creation), we need to do
  2497. * a three-way merge between constructor options, instance
  2498. * options and parent options.
  2499. */
  2500. function mergeAssets (
  2501. parentVal,
  2502. childVal,
  2503. vm,
  2504. key
  2505. ) {
  2506. var res = Object.create(parentVal || null);
  2507. if (childVal) {
  2508. true && assertObjectType(key, childVal, vm);
  2509. return extend(res, childVal)
  2510. } else {
  2511. return res
  2512. }
  2513. }
  2514. ASSET_TYPES.forEach(function (type) {
  2515. strats[type + 's'] = mergeAssets;
  2516. });
  2517. /**
  2518. * Watchers.
  2519. *
  2520. * Watchers hashes should not overwrite one
  2521. * another, so we merge them as arrays.
  2522. */
  2523. strats.watch = function (
  2524. parentVal,
  2525. childVal,
  2526. vm,
  2527. key
  2528. ) {
  2529. // work around Firefox's Object.prototype.watch...
  2530. if (parentVal === nativeWatch) { parentVal = undefined; }
  2531. if (childVal === nativeWatch) { childVal = undefined; }
  2532. /* istanbul ignore if */
  2533. if (!childVal) { return Object.create(parentVal || null) }
  2534. if (true) {
  2535. assertObjectType(key, childVal, vm);
  2536. }
  2537. if (!parentVal) { return childVal }
  2538. var ret = {};
  2539. extend(ret, parentVal);
  2540. for (var key$1 in childVal) {
  2541. var parent = ret[key$1];
  2542. var child = childVal[key$1];
  2543. if (parent && !Array.isArray(parent)) {
  2544. parent = [parent];
  2545. }
  2546. ret[key$1] = parent
  2547. ? parent.concat(child)
  2548. : Array.isArray(child) ? child : [child];
  2549. }
  2550. return ret
  2551. };
  2552. /**
  2553. * Other object hashes.
  2554. */
  2555. strats.props =
  2556. strats.methods =
  2557. strats.inject =
  2558. strats.computed = function (
  2559. parentVal,
  2560. childVal,
  2561. vm,
  2562. key
  2563. ) {
  2564. if (childVal && "development" !== 'production') {
  2565. assertObjectType(key, childVal, vm);
  2566. }
  2567. if (!parentVal) { return childVal }
  2568. var ret = Object.create(null);
  2569. extend(ret, parentVal);
  2570. if (childVal) { extend(ret, childVal); }
  2571. return ret
  2572. };
  2573. strats.provide = mergeDataOrFn;
  2574. /**
  2575. * Default strategy.
  2576. */
  2577. var defaultStrat = function (parentVal, childVal) {
  2578. return childVal === undefined
  2579. ? parentVal
  2580. : childVal
  2581. };
  2582. /**
  2583. * Validate component names
  2584. */
  2585. function checkComponents (options) {
  2586. for (var key in options.components) {
  2587. validateComponentName(key);
  2588. }
  2589. }
  2590. function validateComponentName (name) {
  2591. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  2592. warn(
  2593. 'Invalid component name: "' + name + '". Component names ' +
  2594. 'should conform to valid custom element name in html5 specification.'
  2595. );
  2596. }
  2597. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  2598. warn(
  2599. 'Do not use built-in or reserved HTML elements as component ' +
  2600. 'id: ' + name
  2601. );
  2602. }
  2603. }
  2604. /**
  2605. * Ensure all props option syntax are normalized into the
  2606. * Object-based format.
  2607. */
  2608. function normalizeProps (options, vm) {
  2609. var props = options.props;
  2610. if (!props) { return }
  2611. var res = {};
  2612. var i, val, name;
  2613. if (Array.isArray(props)) {
  2614. i = props.length;
  2615. while (i--) {
  2616. val = props[i];
  2617. if (typeof val === 'string') {
  2618. name = camelize(val);
  2619. res[name] = { type: null };
  2620. } else if (true) {
  2621. warn('props must be strings when using array syntax.');
  2622. }
  2623. }
  2624. } else if (isPlainObject(props)) {
  2625. for (var key in props) {
  2626. val = props[key];
  2627. name = camelize(key);
  2628. res[name] = isPlainObject(val)
  2629. ? val
  2630. : { type: val };
  2631. }
  2632. } else if (true) {
  2633. warn(
  2634. "Invalid value for option \"props\": expected an Array or an Object, " +
  2635. "but got " + (toRawType(props)) + ".",
  2636. vm
  2637. );
  2638. }
  2639. options.props = res;
  2640. }
  2641. /**
  2642. * Normalize all injections into Object-based format
  2643. */
  2644. function normalizeInject (options, vm) {
  2645. var inject = options.inject;
  2646. if (!inject) { return }
  2647. var normalized = options.inject = {};
  2648. if (Array.isArray(inject)) {
  2649. for (var i = 0; i < inject.length; i++) {
  2650. normalized[inject[i]] = { from: inject[i] };
  2651. }
  2652. } else if (isPlainObject(inject)) {
  2653. for (var key in inject) {
  2654. var val = inject[key];
  2655. normalized[key] = isPlainObject(val)
  2656. ? extend({ from: key }, val)
  2657. : { from: val };
  2658. }
  2659. } else if (true) {
  2660. warn(
  2661. "Invalid value for option \"inject\": expected an Array or an Object, " +
  2662. "but got " + (toRawType(inject)) + ".",
  2663. vm
  2664. );
  2665. }
  2666. }
  2667. /**
  2668. * Normalize raw function directives into object format.
  2669. */
  2670. function normalizeDirectives (options) {
  2671. var dirs = options.directives;
  2672. if (dirs) {
  2673. for (var key in dirs) {
  2674. var def$$1 = dirs[key];
  2675. if (typeof def$$1 === 'function') {
  2676. dirs[key] = { bind: def$$1, update: def$$1 };
  2677. }
  2678. }
  2679. }
  2680. }
  2681. function assertObjectType (name, value, vm) {
  2682. if (!isPlainObject(value)) {
  2683. warn(
  2684. "Invalid value for option \"" + name + "\": expected an Object, " +
  2685. "but got " + (toRawType(value)) + ".",
  2686. vm
  2687. );
  2688. }
  2689. }
  2690. /**
  2691. * Merge two option objects into a new one.
  2692. * Core utility used in both instantiation and inheritance.
  2693. */
  2694. function mergeOptions (
  2695. parent,
  2696. child,
  2697. vm
  2698. ) {
  2699. if (true) {
  2700. checkComponents(child);
  2701. }
  2702. if (typeof child === 'function') {
  2703. child = child.options;
  2704. }
  2705. normalizeProps(child, vm);
  2706. normalizeInject(child, vm);
  2707. normalizeDirectives(child);
  2708. // Apply extends and mixins on the child options,
  2709. // but only if it is a raw options object that isn't
  2710. // the result of another mergeOptions call.
  2711. // Only merged options has the _base property.
  2712. if (!child._base) {
  2713. if (child.extends) {
  2714. parent = mergeOptions(parent, child.extends, vm);
  2715. }
  2716. if (child.mixins) {
  2717. for (var i = 0, l = child.mixins.length; i < l; i++) {
  2718. parent = mergeOptions(parent, child.mixins[i], vm);
  2719. }
  2720. }
  2721. }
  2722. var options = {};
  2723. var key;
  2724. for (key in parent) {
  2725. mergeField(key);
  2726. }
  2727. for (key in child) {
  2728. if (!hasOwn(parent, key)) {
  2729. mergeField(key);
  2730. }
  2731. }
  2732. function mergeField (key) {
  2733. var strat = strats[key] || defaultStrat;
  2734. options[key] = strat(parent[key], child[key], vm, key);
  2735. }
  2736. return options
  2737. }
  2738. /**
  2739. * Resolve an asset.
  2740. * This function is used because child instances need access
  2741. * to assets defined in its ancestor chain.
  2742. */
  2743. function resolveAsset (
  2744. options,
  2745. type,
  2746. id,
  2747. warnMissing
  2748. ) {
  2749. /* istanbul ignore if */
  2750. if (typeof id !== 'string') {
  2751. return
  2752. }
  2753. var assets = options[type];
  2754. // check local registration variations first
  2755. if (hasOwn(assets, id)) { return assets[id] }
  2756. var camelizedId = camelize(id);
  2757. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  2758. var PascalCaseId = capitalize(camelizedId);
  2759. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  2760. // fallback to prototype chain
  2761. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  2762. if ( true && warnMissing && !res) {
  2763. warn(
  2764. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  2765. options
  2766. );
  2767. }
  2768. return res
  2769. }
  2770. /* */
  2771. function validateProp (
  2772. key,
  2773. propOptions,
  2774. propsData,
  2775. vm
  2776. ) {
  2777. var prop = propOptions[key];
  2778. var absent = !hasOwn(propsData, key);
  2779. var value = propsData[key];
  2780. // boolean casting
  2781. var booleanIndex = getTypeIndex(Boolean, prop.type);
  2782. if (booleanIndex > -1) {
  2783. if (absent && !hasOwn(prop, 'default')) {
  2784. value = false;
  2785. } else if (value === '' || value === hyphenate(key)) {
  2786. // only cast empty string / same name to boolean if
  2787. // boolean has higher priority
  2788. var stringIndex = getTypeIndex(String, prop.type);
  2789. if (stringIndex < 0 || booleanIndex < stringIndex) {
  2790. value = true;
  2791. }
  2792. }
  2793. }
  2794. // check default value
  2795. if (value === undefined) {
  2796. value = getPropDefaultValue(vm, prop, key);
  2797. // since the default value is a fresh copy,
  2798. // make sure to observe it.
  2799. var prevShouldObserve = shouldObserve;
  2800. toggleObserving(true);
  2801. observe(value);
  2802. toggleObserving(prevShouldObserve);
  2803. }
  2804. if (
  2805. true
  2806. ) {
  2807. assertProp(prop, key, value, vm, absent);
  2808. }
  2809. return value
  2810. }
  2811. /**
  2812. * Get the default value of a prop.
  2813. */
  2814. function getPropDefaultValue (vm, prop, key) {
  2815. // no default, return undefined
  2816. if (!hasOwn(prop, 'default')) {
  2817. return undefined
  2818. }
  2819. var def = prop.default;
  2820. // warn against non-factory defaults for Object & Array
  2821. if ( true && isObject(def)) {
  2822. warn(
  2823. 'Invalid default value for prop "' + key + '": ' +
  2824. 'Props with type Object/Array must use a factory function ' +
  2825. 'to return the default value.',
  2826. vm
  2827. );
  2828. }
  2829. // the raw prop value was also undefined from previous render,
  2830. // return previous default value to avoid unnecessary watcher trigger
  2831. if (vm && vm.$options.propsData &&
  2832. vm.$options.propsData[key] === undefined &&
  2833. vm._props[key] !== undefined
  2834. ) {
  2835. return vm._props[key]
  2836. }
  2837. // call factory function for non-Function types
  2838. // a value is Function if its prototype is function even across different execution context
  2839. return typeof def === 'function' && getType(prop.type) !== 'Function'
  2840. ? def.call(vm)
  2841. : def
  2842. }
  2843. /**
  2844. * Assert whether a prop is valid.
  2845. */
  2846. function assertProp (
  2847. prop,
  2848. name,
  2849. value,
  2850. vm,
  2851. absent
  2852. ) {
  2853. if (prop.required && absent) {
  2854. warn(
  2855. 'Missing required prop: "' + name + '"',
  2856. vm
  2857. );
  2858. return
  2859. }
  2860. if (value == null && !prop.required) {
  2861. return
  2862. }
  2863. var type = prop.type;
  2864. var valid = !type || type === true;
  2865. var expectedTypes = [];
  2866. if (type) {
  2867. if (!Array.isArray(type)) {
  2868. type = [type];
  2869. }
  2870. for (var i = 0; i < type.length && !valid; i++) {
  2871. var assertedType = assertType(value, type[i]);
  2872. expectedTypes.push(assertedType.expectedType || '');
  2873. valid = assertedType.valid;
  2874. }
  2875. }
  2876. if (!valid) {
  2877. warn(
  2878. getInvalidTypeMessage(name, value, expectedTypes),
  2879. vm
  2880. );
  2881. return
  2882. }
  2883. var validator = prop.validator;
  2884. if (validator) {
  2885. if (!validator(value)) {
  2886. warn(
  2887. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  2888. vm
  2889. );
  2890. }
  2891. }
  2892. }
  2893. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  2894. function assertType (value, type) {
  2895. var valid;
  2896. var expectedType = getType(type);
  2897. if (simpleCheckRE.test(expectedType)) {
  2898. var t = typeof value;
  2899. valid = t === expectedType.toLowerCase();
  2900. // for primitive wrapper objects
  2901. if (!valid && t === 'object') {
  2902. valid = value instanceof type;
  2903. }
  2904. } else if (expectedType === 'Object') {
  2905. valid = isPlainObject(value);
  2906. } else if (expectedType === 'Array') {
  2907. valid = Array.isArray(value);
  2908. } else {
  2909. valid = value instanceof type;
  2910. }
  2911. return {
  2912. valid: valid,
  2913. expectedType: expectedType
  2914. }
  2915. }
  2916. /**
  2917. * Use function string name to check built-in types,
  2918. * because a simple equality check will fail when running
  2919. * across different vms / iframes.
  2920. */
  2921. function getType (fn) {
  2922. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  2923. return match ? match[1] : ''
  2924. }
  2925. function isSameType (a, b) {
  2926. return getType(a) === getType(b)
  2927. }
  2928. function getTypeIndex (type, expectedTypes) {
  2929. if (!Array.isArray(expectedTypes)) {
  2930. return isSameType(expectedTypes, type) ? 0 : -1
  2931. }
  2932. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  2933. if (isSameType(expectedTypes[i], type)) {
  2934. return i
  2935. }
  2936. }
  2937. return -1
  2938. }
  2939. function getInvalidTypeMessage (name, value, expectedTypes) {
  2940. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  2941. " Expected " + (expectedTypes.map(capitalize).join(', '));
  2942. var expectedType = expectedTypes[0];
  2943. var receivedType = toRawType(value);
  2944. var expectedValue = styleValue(value, expectedType);
  2945. var receivedValue = styleValue(value, receivedType);
  2946. // check if we need to specify expected value
  2947. if (expectedTypes.length === 1 &&
  2948. isExplicable(expectedType) &&
  2949. !isBoolean(expectedType, receivedType)) {
  2950. message += " with value " + expectedValue;
  2951. }
  2952. message += ", got " + receivedType + " ";
  2953. // check if we need to specify received value
  2954. if (isExplicable(receivedType)) {
  2955. message += "with value " + receivedValue + ".";
  2956. }
  2957. return message
  2958. }
  2959. function styleValue (value, type) {
  2960. if (type === 'String') {
  2961. return ("\"" + value + "\"")
  2962. } else if (type === 'Number') {
  2963. return ("" + (Number(value)))
  2964. } else {
  2965. return ("" + value)
  2966. }
  2967. }
  2968. function isExplicable (value) {
  2969. var explicitTypes = ['string', 'number', 'boolean'];
  2970. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  2971. }
  2972. function isBoolean () {
  2973. var args = [], len = arguments.length;
  2974. while ( len-- ) args[ len ] = arguments[ len ];
  2975. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  2976. }
  2977. /* */
  2978. function handleError (err, vm, info) {
  2979. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  2980. // See: https://github.com/vuejs/vuex/issues/1505
  2981. pushTarget();
  2982. try {
  2983. if (vm) {
  2984. var cur = vm;
  2985. while ((cur = cur.$parent)) {
  2986. var hooks = cur.$options.errorCaptured;
  2987. if (hooks) {
  2988. for (var i = 0; i < hooks.length; i++) {
  2989. try {
  2990. var capture = hooks[i].call(cur, err, vm, info) === false;
  2991. if (capture) { return }
  2992. } catch (e) {
  2993. globalHandleError(e, cur, 'errorCaptured hook');
  2994. }
  2995. }
  2996. }
  2997. }
  2998. }
  2999. globalHandleError(err, vm, info);
  3000. } finally {
  3001. popTarget();
  3002. }
  3003. }
  3004. function invokeWithErrorHandling (
  3005. handler,
  3006. context,
  3007. args,
  3008. vm,
  3009. info
  3010. ) {
  3011. var res;
  3012. try {
  3013. res = args ? handler.apply(context, args) : handler.call(context);
  3014. if (res && !res._isVue && isPromise(res) && !res._handled) {
  3015. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  3016. // issue #9511
  3017. // avoid catch triggering multiple times when nested calls
  3018. res._handled = true;
  3019. }
  3020. } catch (e) {
  3021. handleError(e, vm, info);
  3022. }
  3023. return res
  3024. }
  3025. function globalHandleError (err, vm, info) {
  3026. if (config.errorHandler) {
  3027. try {
  3028. return config.errorHandler.call(null, err, vm, info)
  3029. } catch (e) {
  3030. // if the user intentionally throws the original error in the handler,
  3031. // do not log it twice
  3032. if (e !== err) {
  3033. logError(e, null, 'config.errorHandler');
  3034. }
  3035. }
  3036. }
  3037. logError(err, vm, info);
  3038. }
  3039. function logError (err, vm, info) {
  3040. if (true) {
  3041. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  3042. }
  3043. /* istanbul ignore else */
  3044. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  3045. console.error(err);
  3046. } else {
  3047. throw err
  3048. }
  3049. }
  3050. /* */
  3051. var callbacks = [];
  3052. var pending = false;
  3053. function flushCallbacks () {
  3054. pending = false;
  3055. var copies = callbacks.slice(0);
  3056. callbacks.length = 0;
  3057. for (var i = 0; i < copies.length; i++) {
  3058. copies[i]();
  3059. }
  3060. }
  3061. // Here we have async deferring wrappers using microtasks.
  3062. // In 2.5 we used (macro) tasks (in combination with microtasks).
  3063. // However, it has subtle problems when state is changed right before repaint
  3064. // (e.g. #6813, out-in transitions).
  3065. // Also, using (macro) tasks in event handler would cause some weird behaviors
  3066. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  3067. // So we now use microtasks everywhere, again.
  3068. // A major drawback of this tradeoff is that there are some scenarios
  3069. // where microtasks have too high a priority and fire in between supposedly
  3070. // sequential events (e.g. #4521, #6690, which have workarounds)
  3071. // or even between bubbling of the same event (#6566).
  3072. var timerFunc;
  3073. // The nextTick behavior leverages the microtask queue, which can be accessed
  3074. // via either native Promise.then or MutationObserver.
  3075. // MutationObserver has wider support, however it is seriously bugged in
  3076. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  3077. // completely stops working after triggering a few times... so, if native
  3078. // Promise is available, we will use it:
  3079. /* istanbul ignore next, $flow-disable-line */
  3080. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  3081. var p = Promise.resolve();
  3082. timerFunc = function () {
  3083. p.then(flushCallbacks);
  3084. // In problematic UIWebViews, Promise.then doesn't completely break, but
  3085. // it can get stuck in a weird state where callbacks are pushed into the
  3086. // microtask queue but the queue isn't being flushed, until the browser
  3087. // needs to do some other work, e.g. handle a timer. Therefore we can
  3088. // "force" the microtask queue to be flushed by adding an empty timer.
  3089. if (isIOS) { setTimeout(noop); }
  3090. };
  3091. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  3092. isNative(MutationObserver) ||
  3093. // PhantomJS and iOS 7.x
  3094. MutationObserver.toString() === '[object MutationObserverConstructor]'
  3095. )) {
  3096. // Use MutationObserver where native Promise is not available,
  3097. // e.g. PhantomJS, iOS7, Android 4.4
  3098. // (#6466 MutationObserver is unreliable in IE11)
  3099. var counter = 1;
  3100. var observer = new MutationObserver(flushCallbacks);
  3101. var textNode = document.createTextNode(String(counter));
  3102. observer.observe(textNode, {
  3103. characterData: true
  3104. });
  3105. timerFunc = function () {
  3106. counter = (counter + 1) % 2;
  3107. textNode.data = String(counter);
  3108. };
  3109. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  3110. // Fallback to setImmediate.
  3111. // Technically it leverages the (macro) task queue,
  3112. // but it is still a better choice than setTimeout.
  3113. timerFunc = function () {
  3114. setImmediate(flushCallbacks);
  3115. };
  3116. } else {
  3117. // Fallback to setTimeout.
  3118. timerFunc = function () {
  3119. setTimeout(flushCallbacks, 0);
  3120. };
  3121. }
  3122. function nextTick (cb, ctx) {
  3123. var _resolve;
  3124. callbacks.push(function () {
  3125. if (cb) {
  3126. try {
  3127. cb.call(ctx);
  3128. } catch (e) {
  3129. handleError(e, ctx, 'nextTick');
  3130. }
  3131. } else if (_resolve) {
  3132. _resolve(ctx);
  3133. }
  3134. });
  3135. if (!pending) {
  3136. pending = true;
  3137. timerFunc();
  3138. }
  3139. // $flow-disable-line
  3140. if (!cb && typeof Promise !== 'undefined') {
  3141. return new Promise(function (resolve) {
  3142. _resolve = resolve;
  3143. })
  3144. }
  3145. }
  3146. /* */
  3147. /* not type checking this file because flow doesn't play well with Proxy */
  3148. var initProxy;
  3149. if (true) {
  3150. var allowedGlobals = makeMap(
  3151. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  3152. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  3153. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  3154. 'require' // for Webpack/Browserify
  3155. );
  3156. var warnNonPresent = function (target, key) {
  3157. warn(
  3158. "Property or method \"" + key + "\" is not defined on the instance but " +
  3159. 'referenced during render. Make sure that this property is reactive, ' +
  3160. 'either in the data option, or for class-based components, by ' +
  3161. 'initializing the property. ' +
  3162. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  3163. target
  3164. );
  3165. };
  3166. var warnReservedPrefix = function (target, key) {
  3167. warn(
  3168. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  3169. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  3170. 'prevent conflicts with Vue internals. ' +
  3171. 'See: https://vuejs.org/v2/api/#data',
  3172. target
  3173. );
  3174. };
  3175. var hasProxy =
  3176. typeof Proxy !== 'undefined' && isNative(Proxy);
  3177. if (hasProxy) {
  3178. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  3179. config.keyCodes = new Proxy(config.keyCodes, {
  3180. set: function set (target, key, value) {
  3181. if (isBuiltInModifier(key)) {
  3182. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  3183. return false
  3184. } else {
  3185. target[key] = value;
  3186. return true
  3187. }
  3188. }
  3189. });
  3190. }
  3191. var hasHandler = {
  3192. has: function has (target, key) {
  3193. var has = key in target;
  3194. var isAllowed = allowedGlobals(key) ||
  3195. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  3196. if (!has && !isAllowed) {
  3197. if (key in target.$data) { warnReservedPrefix(target, key); }
  3198. else { warnNonPresent(target, key); }
  3199. }
  3200. return has || !isAllowed
  3201. }
  3202. };
  3203. var getHandler = {
  3204. get: function get (target, key) {
  3205. if (typeof key === 'string' && !(key in target)) {
  3206. if (key in target.$data) { warnReservedPrefix(target, key); }
  3207. else { warnNonPresent(target, key); }
  3208. }
  3209. return target[key]
  3210. }
  3211. };
  3212. initProxy = function initProxy (vm) {
  3213. if (hasProxy) {
  3214. // determine which proxy handler to use
  3215. var options = vm.$options;
  3216. var handlers = options.render && options.render._withStripped
  3217. ? getHandler
  3218. : hasHandler;
  3219. vm._renderProxy = new Proxy(vm, handlers);
  3220. } else {
  3221. vm._renderProxy = vm;
  3222. }
  3223. };
  3224. }
  3225. /* */
  3226. var seenObjects = new _Set();
  3227. /**
  3228. * Recursively traverse an object to evoke all converted
  3229. * getters, so that every nested property inside the object
  3230. * is collected as a "deep" dependency.
  3231. */
  3232. function traverse (val) {
  3233. _traverse(val, seenObjects);
  3234. seenObjects.clear();
  3235. }
  3236. function _traverse (val, seen) {
  3237. var i, keys;
  3238. var isA = Array.isArray(val);
  3239. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  3240. return
  3241. }
  3242. if (val.__ob__) {
  3243. var depId = val.__ob__.dep.id;
  3244. if (seen.has(depId)) {
  3245. return
  3246. }
  3247. seen.add(depId);
  3248. }
  3249. if (isA) {
  3250. i = val.length;
  3251. while (i--) { _traverse(val[i], seen); }
  3252. } else {
  3253. keys = Object.keys(val);
  3254. i = keys.length;
  3255. while (i--) { _traverse(val[keys[i]], seen); }
  3256. }
  3257. }
  3258. var mark;
  3259. var measure;
  3260. if (true) {
  3261. var perf = inBrowser && window.performance;
  3262. /* istanbul ignore if */
  3263. if (
  3264. perf &&
  3265. perf.mark &&
  3266. perf.measure &&
  3267. perf.clearMarks &&
  3268. perf.clearMeasures
  3269. ) {
  3270. mark = function (tag) { return perf.mark(tag); };
  3271. measure = function (name, startTag, endTag) {
  3272. perf.measure(name, startTag, endTag);
  3273. perf.clearMarks(startTag);
  3274. perf.clearMarks(endTag);
  3275. // perf.clearMeasures(name)
  3276. };
  3277. }
  3278. }
  3279. /* */
  3280. var normalizeEvent = cached(function (name) {
  3281. var passive = name.charAt(0) === '&';
  3282. name = passive ? name.slice(1) : name;
  3283. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  3284. name = once$$1 ? name.slice(1) : name;
  3285. var capture = name.charAt(0) === '!';
  3286. name = capture ? name.slice(1) : name;
  3287. return {
  3288. name: name,
  3289. once: once$$1,
  3290. capture: capture,
  3291. passive: passive
  3292. }
  3293. });
  3294. function createFnInvoker (fns, vm) {
  3295. function invoker () {
  3296. var arguments$1 = arguments;
  3297. var fns = invoker.fns;
  3298. if (Array.isArray(fns)) {
  3299. var cloned = fns.slice();
  3300. for (var i = 0; i < cloned.length; i++) {
  3301. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  3302. }
  3303. } else {
  3304. // return handler return value for single handlers
  3305. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  3306. }
  3307. }
  3308. invoker.fns = fns;
  3309. return invoker
  3310. }
  3311. function updateListeners (
  3312. on,
  3313. oldOn,
  3314. add,
  3315. remove$$1,
  3316. createOnceHandler,
  3317. vm
  3318. ) {
  3319. var name, def$$1, cur, old, event;
  3320. for (name in on) {
  3321. def$$1 = cur = on[name];
  3322. old = oldOn[name];
  3323. event = normalizeEvent(name);
  3324. if (isUndef(cur)) {
  3325. true && warn(
  3326. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  3327. vm
  3328. );
  3329. } else if (isUndef(old)) {
  3330. if (isUndef(cur.fns)) {
  3331. cur = on[name] = createFnInvoker(cur, vm);
  3332. }
  3333. if (isTrue(event.once)) {
  3334. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  3335. }
  3336. add(event.name, cur, event.capture, event.passive, event.params);
  3337. } else if (cur !== old) {
  3338. old.fns = cur;
  3339. on[name] = old;
  3340. }
  3341. }
  3342. for (name in oldOn) {
  3343. if (isUndef(on[name])) {
  3344. event = normalizeEvent(name);
  3345. remove$$1(event.name, oldOn[name], event.capture);
  3346. }
  3347. }
  3348. }
  3349. /* */
  3350. /* */
  3351. // fixed by xxxxxx (mp properties)
  3352. function extractPropertiesFromVNodeData(data, Ctor, res, context) {
  3353. var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties;
  3354. if (isUndef(propOptions)) {
  3355. return res
  3356. }
  3357. var externalClasses = Ctor.options.mpOptions.externalClasses || [];
  3358. var attrs = data.attrs;
  3359. var props = data.props;
  3360. if (isDef(attrs) || isDef(props)) {
  3361. for (var key in propOptions) {
  3362. var altKey = hyphenate(key);
  3363. var result = checkProp(res, props, key, altKey, true) ||
  3364. checkProp(res, attrs, key, altKey, false);
  3365. // externalClass
  3366. if (
  3367. result &&
  3368. res[key] &&
  3369. externalClasses.indexOf(altKey) !== -1 &&
  3370. context[camelize(res[key])]
  3371. ) {
  3372. // 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串)
  3373. res[key] = context[camelize(res[key])];
  3374. }
  3375. }
  3376. }
  3377. return res
  3378. }
  3379. function extractPropsFromVNodeData (
  3380. data,
  3381. Ctor,
  3382. tag,
  3383. context// fixed by xxxxxx
  3384. ) {
  3385. // we are only extracting raw values here.
  3386. // validation and default values are handled in the child
  3387. // component itself.
  3388. var propOptions = Ctor.options.props;
  3389. if (isUndef(propOptions)) {
  3390. // fixed by xxxxxx
  3391. return extractPropertiesFromVNodeData(data, Ctor, {}, context)
  3392. }
  3393. var res = {};
  3394. var attrs = data.attrs;
  3395. var props = data.props;
  3396. if (isDef(attrs) || isDef(props)) {
  3397. for (var key in propOptions) {
  3398. var altKey = hyphenate(key);
  3399. if (true) {
  3400. var keyInLowerCase = key.toLowerCase();
  3401. if (
  3402. key !== keyInLowerCase &&
  3403. attrs && hasOwn(attrs, keyInLowerCase)
  3404. ) {
  3405. tip(
  3406. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  3407. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  3408. " \"" + key + "\". " +
  3409. "Note that HTML attributes are case-insensitive and camelCased " +
  3410. "props need to use their kebab-case equivalents when using in-DOM " +
  3411. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  3412. );
  3413. }
  3414. }
  3415. checkProp(res, props, key, altKey, true) ||
  3416. checkProp(res, attrs, key, altKey, false);
  3417. }
  3418. }
  3419. // fixed by xxxxxx
  3420. return extractPropertiesFromVNodeData(data, Ctor, res, context)
  3421. }
  3422. function checkProp (
  3423. res,
  3424. hash,
  3425. key,
  3426. altKey,
  3427. preserve
  3428. ) {
  3429. if (isDef(hash)) {
  3430. if (hasOwn(hash, key)) {
  3431. res[key] = hash[key];
  3432. if (!preserve) {
  3433. delete hash[key];
  3434. }
  3435. return true
  3436. } else if (hasOwn(hash, altKey)) {
  3437. res[key] = hash[altKey];
  3438. if (!preserve) {
  3439. delete hash[altKey];
  3440. }
  3441. return true
  3442. }
  3443. }
  3444. return false
  3445. }
  3446. /* */
  3447. // The template compiler attempts to minimize the need for normalization by
  3448. // statically analyzing the template at compile time.
  3449. //
  3450. // For plain HTML markup, normalization can be completely skipped because the
  3451. // generated render function is guaranteed to return Array<VNode>. There are
  3452. // two cases where extra normalization is needed:
  3453. // 1. When the children contains components - because a functional component
  3454. // may return an Array instead of a single root. In this case, just a simple
  3455. // normalization is needed - if any child is an Array, we flatten the whole
  3456. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  3457. // because functional components already normalize their own children.
  3458. function simpleNormalizeChildren (children) {
  3459. for (var i = 0; i < children.length; i++) {
  3460. if (Array.isArray(children[i])) {
  3461. return Array.prototype.concat.apply([], children)
  3462. }
  3463. }
  3464. return children
  3465. }
  3466. // 2. When the children contains constructs that always generated nested Arrays,
  3467. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  3468. // with hand-written render functions / JSX. In such cases a full normalization
  3469. // is needed to cater to all possible types of children values.
  3470. function normalizeChildren (children) {
  3471. return isPrimitive(children)
  3472. ? [createTextVNode(children)]
  3473. : Array.isArray(children)
  3474. ? normalizeArrayChildren(children)
  3475. : undefined
  3476. }
  3477. function isTextNode (node) {
  3478. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  3479. }
  3480. function normalizeArrayChildren (children, nestedIndex) {
  3481. var res = [];
  3482. var i, c, lastIndex, last;
  3483. for (i = 0; i < children.length; i++) {
  3484. c = children[i];
  3485. if (isUndef(c) || typeof c === 'boolean') { continue }
  3486. lastIndex = res.length - 1;
  3487. last = res[lastIndex];
  3488. // nested
  3489. if (Array.isArray(c)) {
  3490. if (c.length > 0) {
  3491. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  3492. // merge adjacent text nodes
  3493. if (isTextNode(c[0]) && isTextNode(last)) {
  3494. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  3495. c.shift();
  3496. }
  3497. res.push.apply(res, c);
  3498. }
  3499. } else if (isPrimitive(c)) {
  3500. if (isTextNode(last)) {
  3501. // merge adjacent text nodes
  3502. // this is necessary for SSR hydration because text nodes are
  3503. // essentially merged when rendered to HTML strings
  3504. res[lastIndex] = createTextVNode(last.text + c);
  3505. } else if (c !== '') {
  3506. // convert primitive to vnode
  3507. res.push(createTextVNode(c));
  3508. }
  3509. } else {
  3510. if (isTextNode(c) && isTextNode(last)) {
  3511. // merge adjacent text nodes
  3512. res[lastIndex] = createTextVNode(last.text + c.text);
  3513. } else {
  3514. // default key for nested array children (likely generated by v-for)
  3515. if (isTrue(children._isVList) &&
  3516. isDef(c.tag) &&
  3517. isUndef(c.key) &&
  3518. isDef(nestedIndex)) {
  3519. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  3520. }
  3521. res.push(c);
  3522. }
  3523. }
  3524. }
  3525. return res
  3526. }
  3527. /* */
  3528. function initProvide (vm) {
  3529. var provide = vm.$options.provide;
  3530. if (provide) {
  3531. vm._provided = typeof provide === 'function'
  3532. ? provide.call(vm)
  3533. : provide;
  3534. }
  3535. }
  3536. function initInjections (vm) {
  3537. var result = resolveInject(vm.$options.inject, vm);
  3538. if (result) {
  3539. toggleObserving(false);
  3540. Object.keys(result).forEach(function (key) {
  3541. /* istanbul ignore else */
  3542. if (true) {
  3543. defineReactive$$1(vm, key, result[key], function () {
  3544. warn(
  3545. "Avoid mutating an injected value directly since the changes will be " +
  3546. "overwritten whenever the provided component re-renders. " +
  3547. "injection being mutated: \"" + key + "\"",
  3548. vm
  3549. );
  3550. });
  3551. } else {}
  3552. });
  3553. toggleObserving(true);
  3554. }
  3555. }
  3556. function resolveInject (inject, vm) {
  3557. if (inject) {
  3558. // inject is :any because flow is not smart enough to figure out cached
  3559. var result = Object.create(null);
  3560. var keys = hasSymbol
  3561. ? Reflect.ownKeys(inject)
  3562. : Object.keys(inject);
  3563. for (var i = 0; i < keys.length; i++) {
  3564. var key = keys[i];
  3565. // #6574 in case the inject object is observed...
  3566. if (key === '__ob__') { continue }
  3567. var provideKey = inject[key].from;
  3568. var source = vm;
  3569. while (source) {
  3570. if (source._provided && hasOwn(source._provided, provideKey)) {
  3571. result[key] = source._provided[provideKey];
  3572. break
  3573. }
  3574. source = source.$parent;
  3575. }
  3576. if (!source) {
  3577. if ('default' in inject[key]) {
  3578. var provideDefault = inject[key].default;
  3579. result[key] = typeof provideDefault === 'function'
  3580. ? provideDefault.call(vm)
  3581. : provideDefault;
  3582. } else if (true) {
  3583. warn(("Injection \"" + key + "\" not found"), vm);
  3584. }
  3585. }
  3586. }
  3587. return result
  3588. }
  3589. }
  3590. /* */
  3591. /**
  3592. * Runtime helper for resolving raw children VNodes into a slot object.
  3593. */
  3594. function resolveSlots (
  3595. children,
  3596. context
  3597. ) {
  3598. if (!children || !children.length) {
  3599. return {}
  3600. }
  3601. var slots = {};
  3602. for (var i = 0, l = children.length; i < l; i++) {
  3603. var child = children[i];
  3604. var data = child.data;
  3605. // remove slot attribute if the node is resolved as a Vue slot node
  3606. if (data && data.attrs && data.attrs.slot) {
  3607. delete data.attrs.slot;
  3608. }
  3609. // named slots should only be respected if the vnode was rendered in the
  3610. // same context.
  3611. if ((child.context === context || child.fnContext === context) &&
  3612. data && data.slot != null
  3613. ) {
  3614. var name = data.slot;
  3615. var slot = (slots[name] || (slots[name] = []));
  3616. if (child.tag === 'template') {
  3617. slot.push.apply(slot, child.children || []);
  3618. } else {
  3619. slot.push(child);
  3620. }
  3621. } else {
  3622. // fixed by xxxxxx 临时 hack 掉 uni-app 中的异步 name slot page
  3623. if(child.asyncMeta && child.asyncMeta.data && child.asyncMeta.data.slot === 'page'){
  3624. (slots['page'] || (slots['page'] = [])).push(child);
  3625. }else{
  3626. (slots.default || (slots.default = [])).push(child);
  3627. }
  3628. }
  3629. }
  3630. // ignore slots that contains only whitespace
  3631. for (var name$1 in slots) {
  3632. if (slots[name$1].every(isWhitespace)) {
  3633. delete slots[name$1];
  3634. }
  3635. }
  3636. return slots
  3637. }
  3638. function isWhitespace (node) {
  3639. return (node.isComment && !node.asyncFactory) || node.text === ' '
  3640. }
  3641. /* */
  3642. function normalizeScopedSlots (
  3643. slots,
  3644. normalSlots,
  3645. prevSlots
  3646. ) {
  3647. var res;
  3648. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  3649. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  3650. var key = slots && slots.$key;
  3651. if (!slots) {
  3652. res = {};
  3653. } else if (slots._normalized) {
  3654. // fast path 1: child component re-render only, parent did not change
  3655. return slots._normalized
  3656. } else if (
  3657. isStable &&
  3658. prevSlots &&
  3659. prevSlots !== emptyObject &&
  3660. key === prevSlots.$key &&
  3661. !hasNormalSlots &&
  3662. !prevSlots.$hasNormal
  3663. ) {
  3664. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  3665. // only need to normalize once
  3666. return prevSlots
  3667. } else {
  3668. res = {};
  3669. for (var key$1 in slots) {
  3670. if (slots[key$1] && key$1[0] !== '$') {
  3671. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  3672. }
  3673. }
  3674. }
  3675. // expose normal slots on scopedSlots
  3676. for (var key$2 in normalSlots) {
  3677. if (!(key$2 in res)) {
  3678. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  3679. }
  3680. }
  3681. // avoriaz seems to mock a non-extensible $scopedSlots object
  3682. // and when that is passed down this would cause an error
  3683. if (slots && Object.isExtensible(slots)) {
  3684. (slots)._normalized = res;
  3685. }
  3686. def(res, '$stable', isStable);
  3687. def(res, '$key', key);
  3688. def(res, '$hasNormal', hasNormalSlots);
  3689. return res
  3690. }
  3691. function normalizeScopedSlot(normalSlots, key, fn) {
  3692. var normalized = function () {
  3693. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  3694. res = res && typeof res === 'object' && !Array.isArray(res)
  3695. ? [res] // single vnode
  3696. : normalizeChildren(res);
  3697. return res && (
  3698. res.length === 0 ||
  3699. (res.length === 1 && res[0].isComment) // #9658
  3700. ) ? undefined
  3701. : res
  3702. };
  3703. // this is a slot using the new v-slot syntax without scope. although it is
  3704. // compiled as a scoped slot, render fn users would expect it to be present
  3705. // on this.$slots because the usage is semantically a normal slot.
  3706. if (fn.proxy) {
  3707. Object.defineProperty(normalSlots, key, {
  3708. get: normalized,
  3709. enumerable: true,
  3710. configurable: true
  3711. });
  3712. }
  3713. return normalized
  3714. }
  3715. function proxyNormalSlot(slots, key) {
  3716. return function () { return slots[key]; }
  3717. }
  3718. /* */
  3719. /**
  3720. * Runtime helper for rendering v-for lists.
  3721. */
  3722. function renderList (
  3723. val,
  3724. render
  3725. ) {
  3726. var ret, i, l, keys, key;
  3727. if (Array.isArray(val) || typeof val === 'string') {
  3728. ret = new Array(val.length);
  3729. for (i = 0, l = val.length; i < l; i++) {
  3730. ret[i] = render(val[i], i, i, i); // fixed by xxxxxx
  3731. }
  3732. } else if (typeof val === 'number') {
  3733. ret = new Array(val);
  3734. for (i = 0; i < val; i++) {
  3735. ret[i] = render(i + 1, i, i, i); // fixed by xxxxxx
  3736. }
  3737. } else if (isObject(val)) {
  3738. if (hasSymbol && val[Symbol.iterator]) {
  3739. ret = [];
  3740. var iterator = val[Symbol.iterator]();
  3741. var result = iterator.next();
  3742. while (!result.done) {
  3743. ret.push(render(result.value, ret.length, i++, i)); // fixed by xxxxxx
  3744. result = iterator.next();
  3745. }
  3746. } else {
  3747. keys = Object.keys(val);
  3748. ret = new Array(keys.length);
  3749. for (i = 0, l = keys.length; i < l; i++) {
  3750. key = keys[i];
  3751. ret[i] = render(val[key], key, i, i); // fixed by xxxxxx
  3752. }
  3753. }
  3754. }
  3755. if (!isDef(ret)) {
  3756. ret = [];
  3757. }
  3758. (ret)._isVList = true;
  3759. return ret
  3760. }
  3761. /* */
  3762. /**
  3763. * Runtime helper for rendering <slot>
  3764. */
  3765. function renderSlot (
  3766. name,
  3767. fallback,
  3768. props,
  3769. bindObject
  3770. ) {
  3771. var scopedSlotFn = this.$scopedSlots[name];
  3772. var nodes;
  3773. if (scopedSlotFn) { // scoped slot
  3774. props = props || {};
  3775. if (bindObject) {
  3776. if ( true && !isObject(bindObject)) {
  3777. warn(
  3778. 'slot v-bind without argument expects an Object',
  3779. this
  3780. );
  3781. }
  3782. props = extend(extend({}, bindObject), props);
  3783. }
  3784. // fixed by xxxxxx app-plus scopedSlot
  3785. nodes = scopedSlotFn(props, this, props._i) || fallback;
  3786. } else {
  3787. nodes = this.$slots[name] || fallback;
  3788. }
  3789. var target = props && props.slot;
  3790. if (target) {
  3791. return this.$createElement('template', { slot: target }, nodes)
  3792. } else {
  3793. return nodes
  3794. }
  3795. }
  3796. /* */
  3797. /**
  3798. * Runtime helper for resolving filters
  3799. */
  3800. function resolveFilter (id) {
  3801. return resolveAsset(this.$options, 'filters', id, true) || identity
  3802. }
  3803. /* */
  3804. function isKeyNotMatch (expect, actual) {
  3805. if (Array.isArray(expect)) {
  3806. return expect.indexOf(actual) === -1
  3807. } else {
  3808. return expect !== actual
  3809. }
  3810. }
  3811. /**
  3812. * Runtime helper for checking keyCodes from config.
  3813. * exposed as Vue.prototype._k
  3814. * passing in eventKeyName as last argument separately for backwards compat
  3815. */
  3816. function checkKeyCodes (
  3817. eventKeyCode,
  3818. key,
  3819. builtInKeyCode,
  3820. eventKeyName,
  3821. builtInKeyName
  3822. ) {
  3823. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  3824. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  3825. return isKeyNotMatch(builtInKeyName, eventKeyName)
  3826. } else if (mappedKeyCode) {
  3827. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  3828. } else if (eventKeyName) {
  3829. return hyphenate(eventKeyName) !== key
  3830. }
  3831. }
  3832. /* */
  3833. /**
  3834. * Runtime helper for merging v-bind="object" into a VNode's data.
  3835. */
  3836. function bindObjectProps (
  3837. data,
  3838. tag,
  3839. value,
  3840. asProp,
  3841. isSync
  3842. ) {
  3843. if (value) {
  3844. if (!isObject(value)) {
  3845. true && warn(
  3846. 'v-bind without argument expects an Object or Array value',
  3847. this
  3848. );
  3849. } else {
  3850. if (Array.isArray(value)) {
  3851. value = toObject(value);
  3852. }
  3853. var hash;
  3854. var loop = function ( key ) {
  3855. if (
  3856. key === 'class' ||
  3857. key === 'style' ||
  3858. isReservedAttribute(key)
  3859. ) {
  3860. hash = data;
  3861. } else {
  3862. var type = data.attrs && data.attrs.type;
  3863. hash = asProp || config.mustUseProp(tag, type, key)
  3864. ? data.domProps || (data.domProps = {})
  3865. : data.attrs || (data.attrs = {});
  3866. }
  3867. var camelizedKey = camelize(key);
  3868. var hyphenatedKey = hyphenate(key);
  3869. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  3870. hash[key] = value[key];
  3871. if (isSync) {
  3872. var on = data.on || (data.on = {});
  3873. on[("update:" + key)] = function ($event) {
  3874. value[key] = $event;
  3875. };
  3876. }
  3877. }
  3878. };
  3879. for (var key in value) loop( key );
  3880. }
  3881. }
  3882. return data
  3883. }
  3884. /* */
  3885. /**
  3886. * Runtime helper for rendering static trees.
  3887. */
  3888. function renderStatic (
  3889. index,
  3890. isInFor
  3891. ) {
  3892. var cached = this._staticTrees || (this._staticTrees = []);
  3893. var tree = cached[index];
  3894. // if has already-rendered static tree and not inside v-for,
  3895. // we can reuse the same tree.
  3896. if (tree && !isInFor) {
  3897. return tree
  3898. }
  3899. // otherwise, render a fresh tree.
  3900. tree = cached[index] = this.$options.staticRenderFns[index].call(
  3901. this._renderProxy,
  3902. null,
  3903. this // for render fns generated for functional component templates
  3904. );
  3905. markStatic(tree, ("__static__" + index), false);
  3906. return tree
  3907. }
  3908. /**
  3909. * Runtime helper for v-once.
  3910. * Effectively it means marking the node as static with a unique key.
  3911. */
  3912. function markOnce (
  3913. tree,
  3914. index,
  3915. key
  3916. ) {
  3917. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  3918. return tree
  3919. }
  3920. function markStatic (
  3921. tree,
  3922. key,
  3923. isOnce
  3924. ) {
  3925. if (Array.isArray(tree)) {
  3926. for (var i = 0; i < tree.length; i++) {
  3927. if (tree[i] && typeof tree[i] !== 'string') {
  3928. markStaticNode(tree[i], (key + "_" + i), isOnce);
  3929. }
  3930. }
  3931. } else {
  3932. markStaticNode(tree, key, isOnce);
  3933. }
  3934. }
  3935. function markStaticNode (node, key, isOnce) {
  3936. node.isStatic = true;
  3937. node.key = key;
  3938. node.isOnce = isOnce;
  3939. }
  3940. /* */
  3941. function bindObjectListeners (data, value) {
  3942. if (value) {
  3943. if (!isPlainObject(value)) {
  3944. true && warn(
  3945. 'v-on without argument expects an Object value',
  3946. this
  3947. );
  3948. } else {
  3949. var on = data.on = data.on ? extend({}, data.on) : {};
  3950. for (var key in value) {
  3951. var existing = on[key];
  3952. var ours = value[key];
  3953. on[key] = existing ? [].concat(existing, ours) : ours;
  3954. }
  3955. }
  3956. }
  3957. return data
  3958. }
  3959. /* */
  3960. function resolveScopedSlots (
  3961. fns, // see flow/vnode
  3962. res,
  3963. // the following are added in 2.6
  3964. hasDynamicKeys,
  3965. contentHashKey
  3966. ) {
  3967. res = res || { $stable: !hasDynamicKeys };
  3968. for (var i = 0; i < fns.length; i++) {
  3969. var slot = fns[i];
  3970. if (Array.isArray(slot)) {
  3971. resolveScopedSlots(slot, res, hasDynamicKeys);
  3972. } else if (slot) {
  3973. // marker for reverse proxying v-slot without scope on this.$slots
  3974. if (slot.proxy) {
  3975. slot.fn.proxy = true;
  3976. }
  3977. res[slot.key] = slot.fn;
  3978. }
  3979. }
  3980. if (contentHashKey) {
  3981. (res).$key = contentHashKey;
  3982. }
  3983. return res
  3984. }
  3985. /* */
  3986. function bindDynamicKeys (baseObj, values) {
  3987. for (var i = 0; i < values.length; i += 2) {
  3988. var key = values[i];
  3989. if (typeof key === 'string' && key) {
  3990. baseObj[values[i]] = values[i + 1];
  3991. } else if ( true && key !== '' && key !== null) {
  3992. // null is a special value for explicitly removing a binding
  3993. warn(
  3994. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  3995. this
  3996. );
  3997. }
  3998. }
  3999. return baseObj
  4000. }
  4001. // helper to dynamically append modifier runtime markers to event names.
  4002. // ensure only append when value is already string, otherwise it will be cast
  4003. // to string and cause the type check to miss.
  4004. function prependModifier (value, symbol) {
  4005. return typeof value === 'string' ? symbol + value : value
  4006. }
  4007. /* */
  4008. function installRenderHelpers (target) {
  4009. target._o = markOnce;
  4010. target._n = toNumber;
  4011. target._s = toString;
  4012. target._l = renderList;
  4013. target._t = renderSlot;
  4014. target._q = looseEqual;
  4015. target._i = looseIndexOf;
  4016. target._m = renderStatic;
  4017. target._f = resolveFilter;
  4018. target._k = checkKeyCodes;
  4019. target._b = bindObjectProps;
  4020. target._v = createTextVNode;
  4021. target._e = createEmptyVNode;
  4022. target._u = resolveScopedSlots;
  4023. target._g = bindObjectListeners;
  4024. target._d = bindDynamicKeys;
  4025. target._p = prependModifier;
  4026. }
  4027. /* */
  4028. function FunctionalRenderContext (
  4029. data,
  4030. props,
  4031. children,
  4032. parent,
  4033. Ctor
  4034. ) {
  4035. var this$1 = this;
  4036. var options = Ctor.options;
  4037. // ensure the createElement function in functional components
  4038. // gets a unique context - this is necessary for correct named slot check
  4039. var contextVm;
  4040. if (hasOwn(parent, '_uid')) {
  4041. contextVm = Object.create(parent);
  4042. // $flow-disable-line
  4043. contextVm._original = parent;
  4044. } else {
  4045. // the context vm passed in is a functional context as well.
  4046. // in this case we want to make sure we are able to get a hold to the
  4047. // real context instance.
  4048. contextVm = parent;
  4049. // $flow-disable-line
  4050. parent = parent._original;
  4051. }
  4052. var isCompiled = isTrue(options._compiled);
  4053. var needNormalization = !isCompiled;
  4054. this.data = data;
  4055. this.props = props;
  4056. this.children = children;
  4057. this.parent = parent;
  4058. this.listeners = data.on || emptyObject;
  4059. this.injections = resolveInject(options.inject, parent);
  4060. this.slots = function () {
  4061. if (!this$1.$slots) {
  4062. normalizeScopedSlots(
  4063. data.scopedSlots,
  4064. this$1.$slots = resolveSlots(children, parent)
  4065. );
  4066. }
  4067. return this$1.$slots
  4068. };
  4069. Object.defineProperty(this, 'scopedSlots', ({
  4070. enumerable: true,
  4071. get: function get () {
  4072. return normalizeScopedSlots(data.scopedSlots, this.slots())
  4073. }
  4074. }));
  4075. // support for compiled functional template
  4076. if (isCompiled) {
  4077. // exposing $options for renderStatic()
  4078. this.$options = options;
  4079. // pre-resolve slots for renderSlot()
  4080. this.$slots = this.slots();
  4081. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  4082. }
  4083. if (options._scopeId) {
  4084. this._c = function (a, b, c, d) {
  4085. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  4086. if (vnode && !Array.isArray(vnode)) {
  4087. vnode.fnScopeId = options._scopeId;
  4088. vnode.fnContext = parent;
  4089. }
  4090. return vnode
  4091. };
  4092. } else {
  4093. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  4094. }
  4095. }
  4096. installRenderHelpers(FunctionalRenderContext.prototype);
  4097. function createFunctionalComponent (
  4098. Ctor,
  4099. propsData,
  4100. data,
  4101. contextVm,
  4102. children
  4103. ) {
  4104. var options = Ctor.options;
  4105. var props = {};
  4106. var propOptions = options.props;
  4107. if (isDef(propOptions)) {
  4108. for (var key in propOptions) {
  4109. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  4110. }
  4111. } else {
  4112. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  4113. if (isDef(data.props)) { mergeProps(props, data.props); }
  4114. }
  4115. var renderContext = new FunctionalRenderContext(
  4116. data,
  4117. props,
  4118. children,
  4119. contextVm,
  4120. Ctor
  4121. );
  4122. var vnode = options.render.call(null, renderContext._c, renderContext);
  4123. if (vnode instanceof VNode) {
  4124. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  4125. } else if (Array.isArray(vnode)) {
  4126. var vnodes = normalizeChildren(vnode) || [];
  4127. var res = new Array(vnodes.length);
  4128. for (var i = 0; i < vnodes.length; i++) {
  4129. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  4130. }
  4131. return res
  4132. }
  4133. }
  4134. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  4135. // #7817 clone node before setting fnContext, otherwise if the node is reused
  4136. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  4137. // that should not be matched to match.
  4138. var clone = cloneVNode(vnode);
  4139. clone.fnContext = contextVm;
  4140. clone.fnOptions = options;
  4141. if (true) {
  4142. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  4143. }
  4144. if (data.slot) {
  4145. (clone.data || (clone.data = {})).slot = data.slot;
  4146. }
  4147. return clone
  4148. }
  4149. function mergeProps (to, from) {
  4150. for (var key in from) {
  4151. to[camelize(key)] = from[key];
  4152. }
  4153. }
  4154. /* */
  4155. /* */
  4156. /* */
  4157. /* */
  4158. // inline hooks to be invoked on component VNodes during patch
  4159. var componentVNodeHooks = {
  4160. init: function init (vnode, hydrating) {
  4161. if (
  4162. vnode.componentInstance &&
  4163. !vnode.componentInstance._isDestroyed &&
  4164. vnode.data.keepAlive
  4165. ) {
  4166. // kept-alive components, treat as a patch
  4167. var mountedNode = vnode; // work around flow
  4168. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  4169. } else {
  4170. var child = vnode.componentInstance = createComponentInstanceForVnode(
  4171. vnode,
  4172. activeInstance
  4173. );
  4174. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  4175. }
  4176. },
  4177. prepatch: function prepatch (oldVnode, vnode) {
  4178. var options = vnode.componentOptions;
  4179. var child = vnode.componentInstance = oldVnode.componentInstance;
  4180. updateChildComponent(
  4181. child,
  4182. options.propsData, // updated props
  4183. options.listeners, // updated listeners
  4184. vnode, // new parent vnode
  4185. options.children // new children
  4186. );
  4187. },
  4188. insert: function insert (vnode) {
  4189. var context = vnode.context;
  4190. var componentInstance = vnode.componentInstance;
  4191. if (!componentInstance._isMounted) {
  4192. callHook(componentInstance, 'onServiceCreated');
  4193. callHook(componentInstance, 'onServiceAttached');
  4194. componentInstance._isMounted = true;
  4195. callHook(componentInstance, 'mounted');
  4196. }
  4197. if (vnode.data.keepAlive) {
  4198. if (context._isMounted) {
  4199. // vue-router#1212
  4200. // During updates, a kept-alive component's child components may
  4201. // change, so directly walking the tree here may call activated hooks
  4202. // on incorrect children. Instead we push them into a queue which will
  4203. // be processed after the whole patch process ended.
  4204. queueActivatedComponent(componentInstance);
  4205. } else {
  4206. activateChildComponent(componentInstance, true /* direct */);
  4207. }
  4208. }
  4209. },
  4210. destroy: function destroy (vnode) {
  4211. var componentInstance = vnode.componentInstance;
  4212. if (!componentInstance._isDestroyed) {
  4213. if (!vnode.data.keepAlive) {
  4214. componentInstance.$destroy();
  4215. } else {
  4216. deactivateChildComponent(componentInstance, true /* direct */);
  4217. }
  4218. }
  4219. }
  4220. };
  4221. var hooksToMerge = Object.keys(componentVNodeHooks);
  4222. function createComponent (
  4223. Ctor,
  4224. data,
  4225. context,
  4226. children,
  4227. tag
  4228. ) {
  4229. if (isUndef(Ctor)) {
  4230. return
  4231. }
  4232. var baseCtor = context.$options._base;
  4233. // plain options object: turn it into a constructor
  4234. if (isObject(Ctor)) {
  4235. Ctor = baseCtor.extend(Ctor);
  4236. }
  4237. // if at this stage it's not a constructor or an async component factory,
  4238. // reject.
  4239. if (typeof Ctor !== 'function') {
  4240. if (true) {
  4241. warn(("Invalid Component definition: " + (String(Ctor))), context);
  4242. }
  4243. return
  4244. }
  4245. // async component
  4246. var asyncFactory;
  4247. if (isUndef(Ctor.cid)) {
  4248. asyncFactory = Ctor;
  4249. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  4250. if (Ctor === undefined) {
  4251. // return a placeholder node for async component, which is rendered
  4252. // as a comment node but preserves all the raw information for the node.
  4253. // the information will be used for async server-rendering and hydration.
  4254. return createAsyncPlaceholder(
  4255. asyncFactory,
  4256. data,
  4257. context,
  4258. children,
  4259. tag
  4260. )
  4261. }
  4262. }
  4263. data = data || {};
  4264. // resolve constructor options in case global mixins are applied after
  4265. // component constructor creation
  4266. resolveConstructorOptions(Ctor);
  4267. // transform component v-model data into props & events
  4268. if (isDef(data.model)) {
  4269. transformModel(Ctor.options, data);
  4270. }
  4271. // extract props
  4272. var propsData = extractPropsFromVNodeData(data, Ctor, tag, context); // fixed by xxxxxx
  4273. // functional component
  4274. if (isTrue(Ctor.options.functional)) {
  4275. return createFunctionalComponent(Ctor, propsData, data, context, children)
  4276. }
  4277. // extract listeners, since these needs to be treated as
  4278. // child component listeners instead of DOM listeners
  4279. var listeners = data.on;
  4280. // replace with listeners with .native modifier
  4281. // so it gets processed during parent component patch.
  4282. data.on = data.nativeOn;
  4283. if (isTrue(Ctor.options.abstract)) {
  4284. // abstract components do not keep anything
  4285. // other than props & listeners & slot
  4286. // work around flow
  4287. var slot = data.slot;
  4288. data = {};
  4289. if (slot) {
  4290. data.slot = slot;
  4291. }
  4292. }
  4293. // install component management hooks onto the placeholder node
  4294. installComponentHooks(data);
  4295. // return a placeholder vnode
  4296. var name = Ctor.options.name || tag;
  4297. var vnode = new VNode(
  4298. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  4299. data, undefined, undefined, undefined, context,
  4300. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  4301. asyncFactory
  4302. );
  4303. return vnode
  4304. }
  4305. function createComponentInstanceForVnode (
  4306. vnode, // we know it's MountedComponentVNode but flow doesn't
  4307. parent // activeInstance in lifecycle state
  4308. ) {
  4309. var options = {
  4310. _isComponent: true,
  4311. _parentVnode: vnode,
  4312. parent: parent
  4313. };
  4314. // check inline-template render functions
  4315. var inlineTemplate = vnode.data.inlineTemplate;
  4316. if (isDef(inlineTemplate)) {
  4317. options.render = inlineTemplate.render;
  4318. options.staticRenderFns = inlineTemplate.staticRenderFns;
  4319. }
  4320. return new vnode.componentOptions.Ctor(options)
  4321. }
  4322. function installComponentHooks (data) {
  4323. var hooks = data.hook || (data.hook = {});
  4324. for (var i = 0; i < hooksToMerge.length; i++) {
  4325. var key = hooksToMerge[i];
  4326. var existing = hooks[key];
  4327. var toMerge = componentVNodeHooks[key];
  4328. if (existing !== toMerge && !(existing && existing._merged)) {
  4329. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  4330. }
  4331. }
  4332. }
  4333. function mergeHook$1 (f1, f2) {
  4334. var merged = function (a, b) {
  4335. // flow complains about extra args which is why we use any
  4336. f1(a, b);
  4337. f2(a, b);
  4338. };
  4339. merged._merged = true;
  4340. return merged
  4341. }
  4342. // transform component v-model info (value and callback) into
  4343. // prop and event handler respectively.
  4344. function transformModel (options, data) {
  4345. var prop = (options.model && options.model.prop) || 'value';
  4346. var event = (options.model && options.model.event) || 'input'
  4347. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  4348. var on = data.on || (data.on = {});
  4349. var existing = on[event];
  4350. var callback = data.model.callback;
  4351. if (isDef(existing)) {
  4352. if (
  4353. Array.isArray(existing)
  4354. ? existing.indexOf(callback) === -1
  4355. : existing !== callback
  4356. ) {
  4357. on[event] = [callback].concat(existing);
  4358. }
  4359. } else {
  4360. on[event] = callback;
  4361. }
  4362. }
  4363. /* */
  4364. var SIMPLE_NORMALIZE = 1;
  4365. var ALWAYS_NORMALIZE = 2;
  4366. // wrapper function for providing a more flexible interface
  4367. // without getting yelled at by flow
  4368. function createElement (
  4369. context,
  4370. tag,
  4371. data,
  4372. children,
  4373. normalizationType,
  4374. alwaysNormalize
  4375. ) {
  4376. if (Array.isArray(data) || isPrimitive(data)) {
  4377. normalizationType = children;
  4378. children = data;
  4379. data = undefined;
  4380. }
  4381. if (isTrue(alwaysNormalize)) {
  4382. normalizationType = ALWAYS_NORMALIZE;
  4383. }
  4384. return _createElement(context, tag, data, children, normalizationType)
  4385. }
  4386. function _createElement (
  4387. context,
  4388. tag,
  4389. data,
  4390. children,
  4391. normalizationType
  4392. ) {
  4393. if (isDef(data) && isDef((data).__ob__)) {
  4394. true && warn(
  4395. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  4396. 'Always create fresh vnode data objects in each render!',
  4397. context
  4398. );
  4399. return createEmptyVNode()
  4400. }
  4401. // object syntax in v-bind
  4402. if (isDef(data) && isDef(data.is)) {
  4403. tag = data.is;
  4404. }
  4405. if (!tag) {
  4406. // in case of component :is set to falsy value
  4407. return createEmptyVNode()
  4408. }
  4409. // warn against non-primitive key
  4410. if ( true &&
  4411. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  4412. ) {
  4413. {
  4414. warn(
  4415. 'Avoid using non-primitive value as key, ' +
  4416. 'use string/number value instead.',
  4417. context
  4418. );
  4419. }
  4420. }
  4421. // support single function children as default scoped slot
  4422. if (Array.isArray(children) &&
  4423. typeof children[0] === 'function'
  4424. ) {
  4425. data = data || {};
  4426. data.scopedSlots = { default: children[0] };
  4427. children.length = 0;
  4428. }
  4429. if (normalizationType === ALWAYS_NORMALIZE) {
  4430. children = normalizeChildren(children);
  4431. } else if (normalizationType === SIMPLE_NORMALIZE) {
  4432. children = simpleNormalizeChildren(children);
  4433. }
  4434. var vnode, ns;
  4435. if (typeof tag === 'string') {
  4436. var Ctor;
  4437. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  4438. if (config.isReservedTag(tag)) {
  4439. // platform built-in elements
  4440. if ( true && isDef(data) && isDef(data.nativeOn)) {
  4441. warn(
  4442. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  4443. context
  4444. );
  4445. }
  4446. vnode = new VNode(
  4447. config.parsePlatformTagName(tag), data, children,
  4448. undefined, undefined, context
  4449. );
  4450. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  4451. // component
  4452. vnode = createComponent(Ctor, data, context, children, tag);
  4453. } else {
  4454. // unknown or unlisted namespaced elements
  4455. // check at runtime because it may get assigned a namespace when its
  4456. // parent normalizes children
  4457. vnode = new VNode(
  4458. tag, data, children,
  4459. undefined, undefined, context
  4460. );
  4461. }
  4462. } else {
  4463. // direct component options / constructor
  4464. vnode = createComponent(tag, data, context, children);
  4465. }
  4466. if (Array.isArray(vnode)) {
  4467. return vnode
  4468. } else if (isDef(vnode)) {
  4469. if (isDef(ns)) { applyNS(vnode, ns); }
  4470. if (isDef(data)) { registerDeepBindings(data); }
  4471. return vnode
  4472. } else {
  4473. return createEmptyVNode()
  4474. }
  4475. }
  4476. function applyNS (vnode, ns, force) {
  4477. vnode.ns = ns;
  4478. if (vnode.tag === 'foreignObject') {
  4479. // use default namespace inside foreignObject
  4480. ns = undefined;
  4481. force = true;
  4482. }
  4483. if (isDef(vnode.children)) {
  4484. for (var i = 0, l = vnode.children.length; i < l; i++) {
  4485. var child = vnode.children[i];
  4486. if (isDef(child.tag) && (
  4487. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  4488. applyNS(child, ns, force);
  4489. }
  4490. }
  4491. }
  4492. }
  4493. // ref #5318
  4494. // necessary to ensure parent re-render when deep bindings like :style and
  4495. // :class are used on slot nodes
  4496. function registerDeepBindings (data) {
  4497. if (isObject(data.style)) {
  4498. traverse(data.style);
  4499. }
  4500. if (isObject(data.class)) {
  4501. traverse(data.class);
  4502. }
  4503. }
  4504. /* */
  4505. function initRender (vm) {
  4506. vm._vnode = null; // the root of the child tree
  4507. vm._staticTrees = null; // v-once cached trees
  4508. var options = vm.$options;
  4509. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  4510. var renderContext = parentVnode && parentVnode.context;
  4511. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  4512. vm.$scopedSlots = emptyObject;
  4513. // bind the createElement fn to this instance
  4514. // so that we get proper render context inside it.
  4515. // args order: tag, data, children, normalizationType, alwaysNormalize
  4516. // internal version is used by render functions compiled from templates
  4517. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  4518. // normalization is always applied for the public version, used in
  4519. // user-written render functions.
  4520. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  4521. // $attrs & $listeners are exposed for easier HOC creation.
  4522. // they need to be reactive so that HOCs using them are always updated
  4523. var parentData = parentVnode && parentVnode.data;
  4524. /* istanbul ignore else */
  4525. if (true) {
  4526. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  4527. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  4528. }, true);
  4529. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  4530. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  4531. }, true);
  4532. } else {}
  4533. }
  4534. var currentRenderingInstance = null;
  4535. function renderMixin (Vue) {
  4536. // install runtime convenience helpers
  4537. installRenderHelpers(Vue.prototype);
  4538. Vue.prototype.$nextTick = function (fn) {
  4539. return nextTick(fn, this)
  4540. };
  4541. Vue.prototype._render = function () {
  4542. var vm = this;
  4543. var ref = vm.$options;
  4544. var render = ref.render;
  4545. var _parentVnode = ref._parentVnode;
  4546. if (_parentVnode) {
  4547. vm.$scopedSlots = normalizeScopedSlots(
  4548. _parentVnode.data.scopedSlots,
  4549. vm.$slots,
  4550. vm.$scopedSlots
  4551. );
  4552. }
  4553. // set parent vnode. this allows render functions to have access
  4554. // to the data on the placeholder node.
  4555. vm.$vnode = _parentVnode;
  4556. // render self
  4557. var vnode;
  4558. try {
  4559. // There's no need to maintain a stack because all render fns are called
  4560. // separately from one another. Nested component's render fns are called
  4561. // when parent component is patched.
  4562. currentRenderingInstance = vm;
  4563. vnode = render.call(vm._renderProxy, vm.$createElement);
  4564. } catch (e) {
  4565. handleError(e, vm, "render");
  4566. // return error render result,
  4567. // or previous vnode to prevent render error causing blank component
  4568. /* istanbul ignore else */
  4569. if ( true && vm.$options.renderError) {
  4570. try {
  4571. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  4572. } catch (e) {
  4573. handleError(e, vm, "renderError");
  4574. vnode = vm._vnode;
  4575. }
  4576. } else {
  4577. vnode = vm._vnode;
  4578. }
  4579. } finally {
  4580. currentRenderingInstance = null;
  4581. }
  4582. // if the returned array contains only a single node, allow it
  4583. if (Array.isArray(vnode) && vnode.length === 1) {
  4584. vnode = vnode[0];
  4585. }
  4586. // return empty vnode in case the render function errored out
  4587. if (!(vnode instanceof VNode)) {
  4588. if ( true && Array.isArray(vnode)) {
  4589. warn(
  4590. 'Multiple root nodes returned from render function. Render function ' +
  4591. 'should return a single root node.',
  4592. vm
  4593. );
  4594. }
  4595. vnode = createEmptyVNode();
  4596. }
  4597. // set parent
  4598. vnode.parent = _parentVnode;
  4599. return vnode
  4600. };
  4601. }
  4602. /* */
  4603. function ensureCtor (comp, base) {
  4604. if (
  4605. comp.__esModule ||
  4606. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  4607. ) {
  4608. comp = comp.default;
  4609. }
  4610. return isObject(comp)
  4611. ? base.extend(comp)
  4612. : comp
  4613. }
  4614. function createAsyncPlaceholder (
  4615. factory,
  4616. data,
  4617. context,
  4618. children,
  4619. tag
  4620. ) {
  4621. var node = createEmptyVNode();
  4622. node.asyncFactory = factory;
  4623. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  4624. return node
  4625. }
  4626. function resolveAsyncComponent (
  4627. factory,
  4628. baseCtor
  4629. ) {
  4630. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  4631. return factory.errorComp
  4632. }
  4633. if (isDef(factory.resolved)) {
  4634. return factory.resolved
  4635. }
  4636. var owner = currentRenderingInstance;
  4637. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  4638. // already pending
  4639. factory.owners.push(owner);
  4640. }
  4641. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  4642. return factory.loadingComp
  4643. }
  4644. if (owner && !isDef(factory.owners)) {
  4645. var owners = factory.owners = [owner];
  4646. var sync = true;
  4647. var timerLoading = null;
  4648. var timerTimeout = null
  4649. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  4650. var forceRender = function (renderCompleted) {
  4651. for (var i = 0, l = owners.length; i < l; i++) {
  4652. (owners[i]).$forceUpdate();
  4653. }
  4654. if (renderCompleted) {
  4655. owners.length = 0;
  4656. if (timerLoading !== null) {
  4657. clearTimeout(timerLoading);
  4658. timerLoading = null;
  4659. }
  4660. if (timerTimeout !== null) {
  4661. clearTimeout(timerTimeout);
  4662. timerTimeout = null;
  4663. }
  4664. }
  4665. };
  4666. var resolve = once(function (res) {
  4667. // cache resolved
  4668. factory.resolved = ensureCtor(res, baseCtor);
  4669. // invoke callbacks only if this is not a synchronous resolve
  4670. // (async resolves are shimmed as synchronous during SSR)
  4671. if (!sync) {
  4672. forceRender(true);
  4673. } else {
  4674. owners.length = 0;
  4675. }
  4676. });
  4677. var reject = once(function (reason) {
  4678. true && warn(
  4679. "Failed to resolve async component: " + (String(factory)) +
  4680. (reason ? ("\nReason: " + reason) : '')
  4681. );
  4682. if (isDef(factory.errorComp)) {
  4683. factory.error = true;
  4684. forceRender(true);
  4685. }
  4686. });
  4687. var res = factory(resolve, reject);
  4688. if (isObject(res)) {
  4689. if (isPromise(res)) {
  4690. // () => Promise
  4691. if (isUndef(factory.resolved)) {
  4692. res.then(resolve, reject);
  4693. }
  4694. } else if (isPromise(res.component)) {
  4695. res.component.then(resolve, reject);
  4696. if (isDef(res.error)) {
  4697. factory.errorComp = ensureCtor(res.error, baseCtor);
  4698. }
  4699. if (isDef(res.loading)) {
  4700. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  4701. if (res.delay === 0) {
  4702. factory.loading = true;
  4703. } else {
  4704. timerLoading = setTimeout(function () {
  4705. timerLoading = null;
  4706. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  4707. factory.loading = true;
  4708. forceRender(false);
  4709. }
  4710. }, res.delay || 200);
  4711. }
  4712. }
  4713. if (isDef(res.timeout)) {
  4714. timerTimeout = setTimeout(function () {
  4715. timerTimeout = null;
  4716. if (isUndef(factory.resolved)) {
  4717. reject(
  4718. true
  4719. ? ("timeout (" + (res.timeout) + "ms)")
  4720. : undefined
  4721. );
  4722. }
  4723. }, res.timeout);
  4724. }
  4725. }
  4726. }
  4727. sync = false;
  4728. // return in case resolved synchronously
  4729. return factory.loading
  4730. ? factory.loadingComp
  4731. : factory.resolved
  4732. }
  4733. }
  4734. /* */
  4735. function isAsyncPlaceholder (node) {
  4736. return node.isComment && node.asyncFactory
  4737. }
  4738. /* */
  4739. function getFirstComponentChild (children) {
  4740. if (Array.isArray(children)) {
  4741. for (var i = 0; i < children.length; i++) {
  4742. var c = children[i];
  4743. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  4744. return c
  4745. }
  4746. }
  4747. }
  4748. }
  4749. /* */
  4750. /* */
  4751. function initEvents (vm) {
  4752. vm._events = Object.create(null);
  4753. vm._hasHookEvent = false;
  4754. // init parent attached events
  4755. var listeners = vm.$options._parentListeners;
  4756. if (listeners) {
  4757. updateComponentListeners(vm, listeners);
  4758. }
  4759. }
  4760. var target;
  4761. function add (event, fn) {
  4762. target.$on(event, fn);
  4763. }
  4764. function remove$1 (event, fn) {
  4765. target.$off(event, fn);
  4766. }
  4767. function createOnceHandler (event, fn) {
  4768. var _target = target;
  4769. return function onceHandler () {
  4770. var res = fn.apply(null, arguments);
  4771. if (res !== null) {
  4772. _target.$off(event, onceHandler);
  4773. }
  4774. }
  4775. }
  4776. function updateComponentListeners (
  4777. vm,
  4778. listeners,
  4779. oldListeners
  4780. ) {
  4781. target = vm;
  4782. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  4783. target = undefined;
  4784. }
  4785. function eventsMixin (Vue) {
  4786. var hookRE = /^hook:/;
  4787. Vue.prototype.$on = function (event, fn) {
  4788. var vm = this;
  4789. if (Array.isArray(event)) {
  4790. for (var i = 0, l = event.length; i < l; i++) {
  4791. vm.$on(event[i], fn);
  4792. }
  4793. } else {
  4794. (vm._events[event] || (vm._events[event] = [])).push(fn);
  4795. // optimize hook:event cost by using a boolean flag marked at registration
  4796. // instead of a hash lookup
  4797. if (hookRE.test(event)) {
  4798. vm._hasHookEvent = true;
  4799. }
  4800. }
  4801. return vm
  4802. };
  4803. Vue.prototype.$once = function (event, fn) {
  4804. var vm = this;
  4805. function on () {
  4806. vm.$off(event, on);
  4807. fn.apply(vm, arguments);
  4808. }
  4809. on.fn = fn;
  4810. vm.$on(event, on);
  4811. return vm
  4812. };
  4813. Vue.prototype.$off = function (event, fn) {
  4814. var vm = this;
  4815. // all
  4816. if (!arguments.length) {
  4817. vm._events = Object.create(null);
  4818. return vm
  4819. }
  4820. // array of events
  4821. if (Array.isArray(event)) {
  4822. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  4823. vm.$off(event[i$1], fn);
  4824. }
  4825. return vm
  4826. }
  4827. // specific event
  4828. var cbs = vm._events[event];
  4829. if (!cbs) {
  4830. return vm
  4831. }
  4832. if (!fn) {
  4833. vm._events[event] = null;
  4834. return vm
  4835. }
  4836. // specific handler
  4837. var cb;
  4838. var i = cbs.length;
  4839. while (i--) {
  4840. cb = cbs[i];
  4841. if (cb === fn || cb.fn === fn) {
  4842. cbs.splice(i, 1);
  4843. break
  4844. }
  4845. }
  4846. return vm
  4847. };
  4848. Vue.prototype.$emit = function (event) {
  4849. var vm = this;
  4850. if (true) {
  4851. var lowerCaseEvent = event.toLowerCase();
  4852. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  4853. tip(
  4854. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  4855. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  4856. "Note that HTML attributes are case-insensitive and you cannot use " +
  4857. "v-on to listen to camelCase events when using in-DOM templates. " +
  4858. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  4859. );
  4860. }
  4861. }
  4862. var cbs = vm._events[event];
  4863. if (cbs) {
  4864. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  4865. var args = toArray(arguments, 1);
  4866. var info = "event handler for \"" + event + "\"";
  4867. for (var i = 0, l = cbs.length; i < l; i++) {
  4868. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  4869. }
  4870. }
  4871. return vm
  4872. };
  4873. }
  4874. /* */
  4875. var activeInstance = null;
  4876. var isUpdatingChildComponent = false;
  4877. function setActiveInstance(vm) {
  4878. var prevActiveInstance = activeInstance;
  4879. activeInstance = vm;
  4880. return function () {
  4881. activeInstance = prevActiveInstance;
  4882. }
  4883. }
  4884. function initLifecycle (vm) {
  4885. var options = vm.$options;
  4886. // locate first non-abstract parent
  4887. var parent = options.parent;
  4888. if (parent && !options.abstract) {
  4889. while (parent.$options.abstract && parent.$parent) {
  4890. parent = parent.$parent;
  4891. }
  4892. parent.$children.push(vm);
  4893. }
  4894. vm.$parent = parent;
  4895. vm.$root = parent ? parent.$root : vm;
  4896. vm.$children = [];
  4897. vm.$refs = {};
  4898. vm._watcher = null;
  4899. vm._inactive = null;
  4900. vm._directInactive = false;
  4901. vm._isMounted = false;
  4902. vm._isDestroyed = false;
  4903. vm._isBeingDestroyed = false;
  4904. }
  4905. function lifecycleMixin (Vue) {
  4906. Vue.prototype._update = function (vnode, hydrating) {
  4907. var vm = this;
  4908. var prevEl = vm.$el;
  4909. var prevVnode = vm._vnode;
  4910. var restoreActiveInstance = setActiveInstance(vm);
  4911. vm._vnode = vnode;
  4912. // Vue.prototype.__patch__ is injected in entry points
  4913. // based on the rendering backend used.
  4914. if (!prevVnode) {
  4915. // initial render
  4916. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  4917. } else {
  4918. // updates
  4919. vm.$el = vm.__patch__(prevVnode, vnode);
  4920. }
  4921. restoreActiveInstance();
  4922. // update __vue__ reference
  4923. if (prevEl) {
  4924. prevEl.__vue__ = null;
  4925. }
  4926. if (vm.$el) {
  4927. vm.$el.__vue__ = vm;
  4928. }
  4929. // if parent is an HOC, update its $el as well
  4930. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  4931. vm.$parent.$el = vm.$el;
  4932. }
  4933. // updated hook is called by the scheduler to ensure that children are
  4934. // updated in a parent's updated hook.
  4935. };
  4936. Vue.prototype.$forceUpdate = function () {
  4937. var vm = this;
  4938. if (vm._watcher) {
  4939. vm._watcher.update();
  4940. }
  4941. };
  4942. Vue.prototype.$destroy = function () {
  4943. var vm = this;
  4944. if (vm._isBeingDestroyed) {
  4945. return
  4946. }
  4947. callHook(vm, 'beforeDestroy');
  4948. vm._isBeingDestroyed = true;
  4949. // remove self from parent
  4950. var parent = vm.$parent;
  4951. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  4952. remove(parent.$children, vm);
  4953. }
  4954. // teardown watchers
  4955. if (vm._watcher) {
  4956. vm._watcher.teardown();
  4957. }
  4958. var i = vm._watchers.length;
  4959. while (i--) {
  4960. vm._watchers[i].teardown();
  4961. }
  4962. // remove reference from data ob
  4963. // frozen object may not have observer.
  4964. if (vm._data.__ob__) {
  4965. vm._data.__ob__.vmCount--;
  4966. }
  4967. // call the last hook...
  4968. vm._isDestroyed = true;
  4969. // invoke destroy hooks on current rendered tree
  4970. vm.__patch__(vm._vnode, null);
  4971. // fire destroyed hook
  4972. callHook(vm, 'destroyed');
  4973. // turn off all instance listeners.
  4974. vm.$off();
  4975. // remove __vue__ reference
  4976. if (vm.$el) {
  4977. vm.$el.__vue__ = null;
  4978. }
  4979. // release circular reference (#6759)
  4980. if (vm.$vnode) {
  4981. vm.$vnode.parent = null;
  4982. }
  4983. };
  4984. }
  4985. function updateChildComponent (
  4986. vm,
  4987. propsData,
  4988. listeners,
  4989. parentVnode,
  4990. renderChildren
  4991. ) {
  4992. if (true) {
  4993. isUpdatingChildComponent = true;
  4994. }
  4995. // determine whether component has slot children
  4996. // we need to do this before overwriting $options._renderChildren.
  4997. // check if there are dynamic scopedSlots (hand-written or compiled but with
  4998. // dynamic slot names). Static scoped slots compiled from template has the
  4999. // "$stable" marker.
  5000. var newScopedSlots = parentVnode.data.scopedSlots;
  5001. var oldScopedSlots = vm.$scopedSlots;
  5002. var hasDynamicScopedSlot = !!(
  5003. (newScopedSlots && !newScopedSlots.$stable) ||
  5004. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  5005. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  5006. );
  5007. // Any static slot children from the parent may have changed during parent's
  5008. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  5009. // update is necessary to ensure correctness.
  5010. var needsForceUpdate = !!(
  5011. renderChildren || // has new static slots
  5012. vm.$options._renderChildren || // has old static slots
  5013. hasDynamicScopedSlot
  5014. );
  5015. vm.$options._parentVnode = parentVnode;
  5016. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  5017. if (vm._vnode) { // update child tree's parent
  5018. vm._vnode.parent = parentVnode;
  5019. }
  5020. vm.$options._renderChildren = renderChildren;
  5021. // update $attrs and $listeners hash
  5022. // these are also reactive so they may trigger child update if the child
  5023. // used them during render
  5024. vm.$attrs = parentVnode.data.attrs || emptyObject;
  5025. vm.$listeners = listeners || emptyObject;
  5026. // update props
  5027. if (propsData && vm.$options.props) {
  5028. toggleObserving(false);
  5029. var props = vm._props;
  5030. var propKeys = vm.$options._propKeys || [];
  5031. for (var i = 0; i < propKeys.length; i++) {
  5032. var key = propKeys[i];
  5033. var propOptions = vm.$options.props; // wtf flow?
  5034. props[key] = validateProp(key, propOptions, propsData, vm);
  5035. }
  5036. toggleObserving(true);
  5037. // keep a copy of raw propsData
  5038. vm.$options.propsData = propsData;
  5039. }
  5040. // fixed by xxxxxx update properties(mp runtime)
  5041. vm._$updateProperties && vm._$updateProperties(vm);
  5042. // update listeners
  5043. listeners = listeners || emptyObject;
  5044. var oldListeners = vm.$options._parentListeners;
  5045. vm.$options._parentListeners = listeners;
  5046. updateComponentListeners(vm, listeners, oldListeners);
  5047. // resolve slots + force update if has children
  5048. if (needsForceUpdate) {
  5049. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  5050. vm.$forceUpdate();
  5051. }
  5052. if (true) {
  5053. isUpdatingChildComponent = false;
  5054. }
  5055. }
  5056. function isInInactiveTree (vm) {
  5057. while (vm && (vm = vm.$parent)) {
  5058. if (vm._inactive) { return true }
  5059. }
  5060. return false
  5061. }
  5062. function activateChildComponent (vm, direct) {
  5063. if (direct) {
  5064. vm._directInactive = false;
  5065. if (isInInactiveTree(vm)) {
  5066. return
  5067. }
  5068. } else if (vm._directInactive) {
  5069. return
  5070. }
  5071. if (vm._inactive || vm._inactive === null) {
  5072. vm._inactive = false;
  5073. for (var i = 0; i < vm.$children.length; i++) {
  5074. activateChildComponent(vm.$children[i]);
  5075. }
  5076. callHook(vm, 'activated');
  5077. }
  5078. }
  5079. function deactivateChildComponent (vm, direct) {
  5080. if (direct) {
  5081. vm._directInactive = true;
  5082. if (isInInactiveTree(vm)) {
  5083. return
  5084. }
  5085. }
  5086. if (!vm._inactive) {
  5087. vm._inactive = true;
  5088. for (var i = 0; i < vm.$children.length; i++) {
  5089. deactivateChildComponent(vm.$children[i]);
  5090. }
  5091. callHook(vm, 'deactivated');
  5092. }
  5093. }
  5094. function callHook (vm, hook) {
  5095. // #7573 disable dep collection when invoking lifecycle hooks
  5096. pushTarget();
  5097. var handlers = vm.$options[hook];
  5098. var info = hook + " hook";
  5099. if (handlers) {
  5100. for (var i = 0, j = handlers.length; i < j; i++) {
  5101. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  5102. }
  5103. }
  5104. if (vm._hasHookEvent) {
  5105. vm.$emit('hook:' + hook);
  5106. }
  5107. popTarget();
  5108. }
  5109. /* */
  5110. var MAX_UPDATE_COUNT = 100;
  5111. var queue = [];
  5112. var activatedChildren = [];
  5113. var has = {};
  5114. var circular = {};
  5115. var waiting = false;
  5116. var flushing = false;
  5117. var index = 0;
  5118. /**
  5119. * Reset the scheduler's state.
  5120. */
  5121. function resetSchedulerState () {
  5122. index = queue.length = activatedChildren.length = 0;
  5123. has = {};
  5124. if (true) {
  5125. circular = {};
  5126. }
  5127. waiting = flushing = false;
  5128. }
  5129. // Async edge case #6566 requires saving the timestamp when event listeners are
  5130. // attached. However, calling performance.now() has a perf overhead especially
  5131. // if the page has thousands of event listeners. Instead, we take a timestamp
  5132. // every time the scheduler flushes and use that for all event listeners
  5133. // attached during that flush.
  5134. var currentFlushTimestamp = 0;
  5135. // Async edge case fix requires storing an event listener's attach timestamp.
  5136. var getNow = Date.now;
  5137. // Determine what event timestamp the browser is using. Annoyingly, the
  5138. // timestamp can either be hi-res (relative to page load) or low-res
  5139. // (relative to UNIX epoch), so in order to compare time we have to use the
  5140. // same timestamp type when saving the flush timestamp.
  5141. // All IE versions use low-res event timestamps, and have problematic clock
  5142. // implementations (#9632)
  5143. if (inBrowser && !isIE) {
  5144. var performance = window.performance;
  5145. if (
  5146. performance &&
  5147. typeof performance.now === 'function' &&
  5148. getNow() > document.createEvent('Event').timeStamp
  5149. ) {
  5150. // if the event timestamp, although evaluated AFTER the Date.now(), is
  5151. // smaller than it, it means the event is using a hi-res timestamp,
  5152. // and we need to use the hi-res version for event listener timestamps as
  5153. // well.
  5154. getNow = function () { return performance.now(); };
  5155. }
  5156. }
  5157. /**
  5158. * Flush both queues and run the watchers.
  5159. */
  5160. function flushSchedulerQueue () {
  5161. currentFlushTimestamp = getNow();
  5162. flushing = true;
  5163. var watcher, id;
  5164. // Sort queue before flush.
  5165. // This ensures that:
  5166. // 1. Components are updated from parent to child. (because parent is always
  5167. // created before the child)
  5168. // 2. A component's user watchers are run before its render watcher (because
  5169. // user watchers are created before the render watcher)
  5170. // 3. If a component is destroyed during a parent component's watcher run,
  5171. // its watchers can be skipped.
  5172. queue.sort(function (a, b) { return a.id - b.id; });
  5173. // do not cache length because more watchers might be pushed
  5174. // as we run existing watchers
  5175. for (index = 0; index < queue.length; index++) {
  5176. watcher = queue[index];
  5177. if (watcher.before) {
  5178. watcher.before();
  5179. }
  5180. id = watcher.id;
  5181. has[id] = null;
  5182. watcher.run();
  5183. // in dev build, check and stop circular updates.
  5184. if ( true && has[id] != null) {
  5185. circular[id] = (circular[id] || 0) + 1;
  5186. if (circular[id] > MAX_UPDATE_COUNT) {
  5187. warn(
  5188. 'You may have an infinite update loop ' + (
  5189. watcher.user
  5190. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  5191. : "in a component render function."
  5192. ),
  5193. watcher.vm
  5194. );
  5195. break
  5196. }
  5197. }
  5198. }
  5199. // keep copies of post queues before resetting state
  5200. var activatedQueue = activatedChildren.slice();
  5201. var updatedQueue = queue.slice();
  5202. resetSchedulerState();
  5203. // call component updated and activated hooks
  5204. callActivatedHooks(activatedQueue);
  5205. callUpdatedHooks(updatedQueue);
  5206. // devtool hook
  5207. /* istanbul ignore if */
  5208. if (devtools && config.devtools) {
  5209. devtools.emit('flush');
  5210. }
  5211. }
  5212. function callUpdatedHooks (queue) {
  5213. var i = queue.length;
  5214. while (i--) {
  5215. var watcher = queue[i];
  5216. var vm = watcher.vm;
  5217. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  5218. callHook(vm, 'updated');
  5219. }
  5220. }
  5221. }
  5222. /**
  5223. * Queue a kept-alive component that was activated during patch.
  5224. * The queue will be processed after the entire tree has been patched.
  5225. */
  5226. function queueActivatedComponent (vm) {
  5227. // setting _inactive to false here so that a render function can
  5228. // rely on checking whether it's in an inactive tree (e.g. router-view)
  5229. vm._inactive = false;
  5230. activatedChildren.push(vm);
  5231. }
  5232. function callActivatedHooks (queue) {
  5233. for (var i = 0; i < queue.length; i++) {
  5234. queue[i]._inactive = true;
  5235. activateChildComponent(queue[i], true /* true */);
  5236. }
  5237. }
  5238. /**
  5239. * Push a watcher into the watcher queue.
  5240. * Jobs with duplicate IDs will be skipped unless it's
  5241. * pushed when the queue is being flushed.
  5242. */
  5243. function queueWatcher (watcher) {
  5244. var id = watcher.id;
  5245. if (has[id] == null) {
  5246. has[id] = true;
  5247. if (!flushing) {
  5248. queue.push(watcher);
  5249. } else {
  5250. // if already flushing, splice the watcher based on its id
  5251. // if already past its id, it will be run next immediately.
  5252. var i = queue.length - 1;
  5253. while (i > index && queue[i].id > watcher.id) {
  5254. i--;
  5255. }
  5256. queue.splice(i + 1, 0, watcher);
  5257. }
  5258. // queue the flush
  5259. if (!waiting) {
  5260. waiting = true;
  5261. if ( true && !config.async) {
  5262. flushSchedulerQueue();
  5263. return
  5264. }
  5265. nextTick(flushSchedulerQueue);
  5266. }
  5267. }
  5268. }
  5269. /* */
  5270. var uid$2 = 0;
  5271. /**
  5272. * A watcher parses an expression, collects dependencies,
  5273. * and fires callback when the expression value changes.
  5274. * This is used for both the $watch() api and directives.
  5275. */
  5276. var Watcher = function Watcher (
  5277. vm,
  5278. expOrFn,
  5279. cb,
  5280. options,
  5281. isRenderWatcher
  5282. ) {
  5283. this.vm = vm;
  5284. if (isRenderWatcher) {
  5285. vm._watcher = this;
  5286. }
  5287. vm._watchers.push(this);
  5288. // options
  5289. if (options) {
  5290. this.deep = !!options.deep;
  5291. this.user = !!options.user;
  5292. this.lazy = !!options.lazy;
  5293. this.sync = !!options.sync;
  5294. this.before = options.before;
  5295. } else {
  5296. this.deep = this.user = this.lazy = this.sync = false;
  5297. }
  5298. this.cb = cb;
  5299. this.id = ++uid$2; // uid for batching
  5300. this.active = true;
  5301. this.dirty = this.lazy; // for lazy watchers
  5302. this.deps = [];
  5303. this.newDeps = [];
  5304. this.depIds = new _Set();
  5305. this.newDepIds = new _Set();
  5306. this.expression = true
  5307. ? expOrFn.toString()
  5308. : undefined;
  5309. // parse expression for getter
  5310. if (typeof expOrFn === 'function') {
  5311. this.getter = expOrFn;
  5312. } else {
  5313. this.getter = parsePath(expOrFn);
  5314. if (!this.getter) {
  5315. this.getter = noop;
  5316. true && warn(
  5317. "Failed watching path: \"" + expOrFn + "\" " +
  5318. 'Watcher only accepts simple dot-delimited paths. ' +
  5319. 'For full control, use a function instead.',
  5320. vm
  5321. );
  5322. }
  5323. }
  5324. this.value = this.lazy
  5325. ? undefined
  5326. : this.get();
  5327. };
  5328. /**
  5329. * Evaluate the getter, and re-collect dependencies.
  5330. */
  5331. Watcher.prototype.get = function get () {
  5332. pushTarget(this);
  5333. var value;
  5334. var vm = this.vm;
  5335. try {
  5336. value = this.getter.call(vm, vm);
  5337. } catch (e) {
  5338. if (this.user) {
  5339. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  5340. } else {
  5341. throw e
  5342. }
  5343. } finally {
  5344. // "touch" every property so they are all tracked as
  5345. // dependencies for deep watching
  5346. if (this.deep) {
  5347. traverse(value);
  5348. }
  5349. popTarget();
  5350. this.cleanupDeps();
  5351. }
  5352. return value
  5353. };
  5354. /**
  5355. * Add a dependency to this directive.
  5356. */
  5357. Watcher.prototype.addDep = function addDep (dep) {
  5358. var id = dep.id;
  5359. if (!this.newDepIds.has(id)) {
  5360. this.newDepIds.add(id);
  5361. this.newDeps.push(dep);
  5362. if (!this.depIds.has(id)) {
  5363. dep.addSub(this);
  5364. }
  5365. }
  5366. };
  5367. /**
  5368. * Clean up for dependency collection.
  5369. */
  5370. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  5371. var i = this.deps.length;
  5372. while (i--) {
  5373. var dep = this.deps[i];
  5374. if (!this.newDepIds.has(dep.id)) {
  5375. dep.removeSub(this);
  5376. }
  5377. }
  5378. var tmp = this.depIds;
  5379. this.depIds = this.newDepIds;
  5380. this.newDepIds = tmp;
  5381. this.newDepIds.clear();
  5382. tmp = this.deps;
  5383. this.deps = this.newDeps;
  5384. this.newDeps = tmp;
  5385. this.newDeps.length = 0;
  5386. };
  5387. /**
  5388. * Subscriber interface.
  5389. * Will be called when a dependency changes.
  5390. */
  5391. Watcher.prototype.update = function update () {
  5392. /* istanbul ignore else */
  5393. if (this.lazy) {
  5394. this.dirty = true;
  5395. } else if (this.sync) {
  5396. this.run();
  5397. } else {
  5398. queueWatcher(this);
  5399. }
  5400. };
  5401. /**
  5402. * Scheduler job interface.
  5403. * Will be called by the scheduler.
  5404. */
  5405. Watcher.prototype.run = function run () {
  5406. if (this.active) {
  5407. var value = this.get();
  5408. if (
  5409. value !== this.value ||
  5410. // Deep watchers and watchers on Object/Arrays should fire even
  5411. // when the value is the same, because the value may
  5412. // have mutated.
  5413. isObject(value) ||
  5414. this.deep
  5415. ) {
  5416. // set new value
  5417. var oldValue = this.value;
  5418. this.value = value;
  5419. if (this.user) {
  5420. try {
  5421. this.cb.call(this.vm, value, oldValue);
  5422. } catch (e) {
  5423. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  5424. }
  5425. } else {
  5426. this.cb.call(this.vm, value, oldValue);
  5427. }
  5428. }
  5429. }
  5430. };
  5431. /**
  5432. * Evaluate the value of the watcher.
  5433. * This only gets called for lazy watchers.
  5434. */
  5435. Watcher.prototype.evaluate = function evaluate () {
  5436. this.value = this.get();
  5437. this.dirty = false;
  5438. };
  5439. /**
  5440. * Depend on all deps collected by this watcher.
  5441. */
  5442. Watcher.prototype.depend = function depend () {
  5443. var i = this.deps.length;
  5444. while (i--) {
  5445. this.deps[i].depend();
  5446. }
  5447. };
  5448. /**
  5449. * Remove self from all dependencies' subscriber list.
  5450. */
  5451. Watcher.prototype.teardown = function teardown () {
  5452. if (this.active) {
  5453. // remove self from vm's watcher list
  5454. // this is a somewhat expensive operation so we skip it
  5455. // if the vm is being destroyed.
  5456. if (!this.vm._isBeingDestroyed) {
  5457. remove(this.vm._watchers, this);
  5458. }
  5459. var i = this.deps.length;
  5460. while (i--) {
  5461. this.deps[i].removeSub(this);
  5462. }
  5463. this.active = false;
  5464. }
  5465. };
  5466. /* */
  5467. var sharedPropertyDefinition = {
  5468. enumerable: true,
  5469. configurable: true,
  5470. get: noop,
  5471. set: noop
  5472. };
  5473. function proxy (target, sourceKey, key) {
  5474. sharedPropertyDefinition.get = function proxyGetter () {
  5475. return this[sourceKey][key]
  5476. };
  5477. sharedPropertyDefinition.set = function proxySetter (val) {
  5478. this[sourceKey][key] = val;
  5479. };
  5480. Object.defineProperty(target, key, sharedPropertyDefinition);
  5481. }
  5482. function initState (vm) {
  5483. vm._watchers = [];
  5484. var opts = vm.$options;
  5485. if (opts.props) { initProps(vm, opts.props); }
  5486. if (opts.methods) { initMethods(vm, opts.methods); }
  5487. if (opts.data) {
  5488. initData(vm);
  5489. } else {
  5490. observe(vm._data = {}, true /* asRootData */);
  5491. }
  5492. if (opts.computed) { initComputed(vm, opts.computed); }
  5493. if (opts.watch && opts.watch !== nativeWatch) {
  5494. initWatch(vm, opts.watch);
  5495. }
  5496. }
  5497. function initProps (vm, propsOptions) {
  5498. var propsData = vm.$options.propsData || {};
  5499. var props = vm._props = {};
  5500. // cache prop keys so that future props updates can iterate using Array
  5501. // instead of dynamic object key enumeration.
  5502. var keys = vm.$options._propKeys = [];
  5503. var isRoot = !vm.$parent;
  5504. // root instance props should be converted
  5505. if (!isRoot) {
  5506. toggleObserving(false);
  5507. }
  5508. var loop = function ( key ) {
  5509. keys.push(key);
  5510. var value = validateProp(key, propsOptions, propsData, vm);
  5511. /* istanbul ignore else */
  5512. if (true) {
  5513. var hyphenatedKey = hyphenate(key);
  5514. if (isReservedAttribute(hyphenatedKey) ||
  5515. config.isReservedAttr(hyphenatedKey)) {
  5516. warn(
  5517. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  5518. vm
  5519. );
  5520. }
  5521. defineReactive$$1(props, key, value, function () {
  5522. if (!isRoot && !isUpdatingChildComponent) {
  5523. {
  5524. if(vm.mpHost === 'mp-baidu'){//百度 observer 在 setData callback 之后触发,直接忽略该 warn
  5525. return
  5526. }
  5527. //fixed by xxxxxx __next_tick_pending,uni://form-field 时不告警
  5528. if(
  5529. key === 'value' &&
  5530. Array.isArray(vm.$options.behaviors) &&
  5531. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  5532. ){
  5533. return
  5534. }
  5535. if(vm._getFormData){
  5536. return
  5537. }
  5538. var $parent = vm.$parent;
  5539. while($parent){
  5540. if($parent.__next_tick_pending){
  5541. return
  5542. }
  5543. $parent = $parent.$parent;
  5544. }
  5545. }
  5546. warn(
  5547. "Avoid mutating a prop directly since the value will be " +
  5548. "overwritten whenever the parent component re-renders. " +
  5549. "Instead, use a data or computed property based on the prop's " +
  5550. "value. Prop being mutated: \"" + key + "\"",
  5551. vm
  5552. );
  5553. }
  5554. });
  5555. } else {}
  5556. // static props are already proxied on the component's prototype
  5557. // during Vue.extend(). We only need to proxy props defined at
  5558. // instantiation here.
  5559. if (!(key in vm)) {
  5560. proxy(vm, "_props", key);
  5561. }
  5562. };
  5563. for (var key in propsOptions) loop( key );
  5564. toggleObserving(true);
  5565. }
  5566. function initData (vm) {
  5567. var data = vm.$options.data;
  5568. data = vm._data = typeof data === 'function'
  5569. ? getData(data, vm)
  5570. : data || {};
  5571. if (!isPlainObject(data)) {
  5572. data = {};
  5573. true && warn(
  5574. 'data functions should return an object:\n' +
  5575. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  5576. vm
  5577. );
  5578. }
  5579. // proxy data on instance
  5580. var keys = Object.keys(data);
  5581. var props = vm.$options.props;
  5582. var methods = vm.$options.methods;
  5583. var i = keys.length;
  5584. while (i--) {
  5585. var key = keys[i];
  5586. if (true) {
  5587. if (methods && hasOwn(methods, key)) {
  5588. warn(
  5589. ("Method \"" + key + "\" has already been defined as a data property."),
  5590. vm
  5591. );
  5592. }
  5593. }
  5594. if (props && hasOwn(props, key)) {
  5595. true && warn(
  5596. "The data property \"" + key + "\" is already declared as a prop. " +
  5597. "Use prop default value instead.",
  5598. vm
  5599. );
  5600. } else if (!isReserved(key)) {
  5601. proxy(vm, "_data", key);
  5602. }
  5603. }
  5604. // observe data
  5605. observe(data, true /* asRootData */);
  5606. }
  5607. function getData (data, vm) {
  5608. // #7573 disable dep collection when invoking data getters
  5609. pushTarget();
  5610. try {
  5611. return data.call(vm, vm)
  5612. } catch (e) {
  5613. handleError(e, vm, "data()");
  5614. return {}
  5615. } finally {
  5616. popTarget();
  5617. }
  5618. }
  5619. var computedWatcherOptions = { lazy: true };
  5620. function initComputed (vm, computed) {
  5621. // $flow-disable-line
  5622. var watchers = vm._computedWatchers = Object.create(null);
  5623. // computed properties are just getters during SSR
  5624. var isSSR = isServerRendering();
  5625. for (var key in computed) {
  5626. var userDef = computed[key];
  5627. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  5628. if ( true && getter == null) {
  5629. warn(
  5630. ("Getter is missing for computed property \"" + key + "\"."),
  5631. vm
  5632. );
  5633. }
  5634. if (!isSSR) {
  5635. // create internal watcher for the computed property.
  5636. watchers[key] = new Watcher(
  5637. vm,
  5638. getter || noop,
  5639. noop,
  5640. computedWatcherOptions
  5641. );
  5642. }
  5643. // component-defined computed properties are already defined on the
  5644. // component prototype. We only need to define computed properties defined
  5645. // at instantiation here.
  5646. if (!(key in vm)) {
  5647. defineComputed(vm, key, userDef);
  5648. } else if (true) {
  5649. if (key in vm.$data) {
  5650. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  5651. } else if (vm.$options.props && key in vm.$options.props) {
  5652. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  5653. }
  5654. }
  5655. }
  5656. }
  5657. function defineComputed (
  5658. target,
  5659. key,
  5660. userDef
  5661. ) {
  5662. var shouldCache = !isServerRendering();
  5663. if (typeof userDef === 'function') {
  5664. sharedPropertyDefinition.get = shouldCache
  5665. ? createComputedGetter(key)
  5666. : createGetterInvoker(userDef);
  5667. sharedPropertyDefinition.set = noop;
  5668. } else {
  5669. sharedPropertyDefinition.get = userDef.get
  5670. ? shouldCache && userDef.cache !== false
  5671. ? createComputedGetter(key)
  5672. : createGetterInvoker(userDef.get)
  5673. : noop;
  5674. sharedPropertyDefinition.set = userDef.set || noop;
  5675. }
  5676. if ( true &&
  5677. sharedPropertyDefinition.set === noop) {
  5678. sharedPropertyDefinition.set = function () {
  5679. warn(
  5680. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  5681. this
  5682. );
  5683. };
  5684. }
  5685. Object.defineProperty(target, key, sharedPropertyDefinition);
  5686. }
  5687. function createComputedGetter (key) {
  5688. return function computedGetter () {
  5689. var watcher = this._computedWatchers && this._computedWatchers[key];
  5690. if (watcher) {
  5691. if (watcher.dirty) {
  5692. watcher.evaluate();
  5693. }
  5694. if (Dep.SharedObject.target) {// fixed by xxxxxx
  5695. watcher.depend();
  5696. }
  5697. return watcher.value
  5698. }
  5699. }
  5700. }
  5701. function createGetterInvoker(fn) {
  5702. return function computedGetter () {
  5703. return fn.call(this, this)
  5704. }
  5705. }
  5706. function initMethods (vm, methods) {
  5707. var props = vm.$options.props;
  5708. for (var key in methods) {
  5709. if (true) {
  5710. if (typeof methods[key] !== 'function') {
  5711. warn(
  5712. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  5713. "Did you reference the function correctly?",
  5714. vm
  5715. );
  5716. }
  5717. if (props && hasOwn(props, key)) {
  5718. warn(
  5719. ("Method \"" + key + "\" has already been defined as a prop."),
  5720. vm
  5721. );
  5722. }
  5723. if ((key in vm) && isReserved(key)) {
  5724. warn(
  5725. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  5726. "Avoid defining component methods that start with _ or $."
  5727. );
  5728. }
  5729. }
  5730. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  5731. }
  5732. }
  5733. function initWatch (vm, watch) {
  5734. for (var key in watch) {
  5735. var handler = watch[key];
  5736. if (Array.isArray(handler)) {
  5737. for (var i = 0; i < handler.length; i++) {
  5738. createWatcher(vm, key, handler[i]);
  5739. }
  5740. } else {
  5741. createWatcher(vm, key, handler);
  5742. }
  5743. }
  5744. }
  5745. function createWatcher (
  5746. vm,
  5747. expOrFn,
  5748. handler,
  5749. options
  5750. ) {
  5751. if (isPlainObject(handler)) {
  5752. options = handler;
  5753. handler = handler.handler;
  5754. }
  5755. if (typeof handler === 'string') {
  5756. handler = vm[handler];
  5757. }
  5758. return vm.$watch(expOrFn, handler, options)
  5759. }
  5760. function stateMixin (Vue) {
  5761. // flow somehow has problems with directly declared definition object
  5762. // when using Object.defineProperty, so we have to procedurally build up
  5763. // the object here.
  5764. var dataDef = {};
  5765. dataDef.get = function () { return this._data };
  5766. var propsDef = {};
  5767. propsDef.get = function () { return this._props };
  5768. if (true) {
  5769. dataDef.set = function () {
  5770. warn(
  5771. 'Avoid replacing instance root $data. ' +
  5772. 'Use nested data properties instead.',
  5773. this
  5774. );
  5775. };
  5776. propsDef.set = function () {
  5777. warn("$props is readonly.", this);
  5778. };
  5779. }
  5780. Object.defineProperty(Vue.prototype, '$data', dataDef);
  5781. Object.defineProperty(Vue.prototype, '$props', propsDef);
  5782. Vue.prototype.$set = set;
  5783. Vue.prototype.$delete = del;
  5784. Vue.prototype.$watch = function (
  5785. expOrFn,
  5786. cb,
  5787. options
  5788. ) {
  5789. var vm = this;
  5790. if (isPlainObject(cb)) {
  5791. return createWatcher(vm, expOrFn, cb, options)
  5792. }
  5793. options = options || {};
  5794. options.user = true;
  5795. var watcher = new Watcher(vm, expOrFn, cb, options);
  5796. if (options.immediate) {
  5797. try {
  5798. cb.call(vm, watcher.value);
  5799. } catch (error) {
  5800. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  5801. }
  5802. }
  5803. return function unwatchFn () {
  5804. watcher.teardown();
  5805. }
  5806. };
  5807. }
  5808. /* */
  5809. var uid$3 = 0;
  5810. function initMixin (Vue) {
  5811. Vue.prototype._init = function (options) {
  5812. var vm = this;
  5813. // a uid
  5814. vm._uid = uid$3++;
  5815. var startTag, endTag;
  5816. /* istanbul ignore if */
  5817. if ( true && config.performance && mark) {
  5818. startTag = "vue-perf-start:" + (vm._uid);
  5819. endTag = "vue-perf-end:" + (vm._uid);
  5820. mark(startTag);
  5821. }
  5822. // a flag to avoid this being observed
  5823. vm._isVue = true;
  5824. // merge options
  5825. if (options && options._isComponent) {
  5826. // optimize internal component instantiation
  5827. // since dynamic options merging is pretty slow, and none of the
  5828. // internal component options needs special treatment.
  5829. initInternalComponent(vm, options);
  5830. } else {
  5831. vm.$options = mergeOptions(
  5832. resolveConstructorOptions(vm.constructor),
  5833. options || {},
  5834. vm
  5835. );
  5836. }
  5837. /* istanbul ignore else */
  5838. if (true) {
  5839. initProxy(vm);
  5840. } else {}
  5841. // expose real self
  5842. vm._self = vm;
  5843. initLifecycle(vm);
  5844. initEvents(vm);
  5845. initRender(vm);
  5846. callHook(vm, 'beforeCreate');
  5847. !vm._$fallback && initInjections(vm); // resolve injections before data/props
  5848. initState(vm);
  5849. !vm._$fallback && initProvide(vm); // resolve provide after data/props
  5850. !vm._$fallback && callHook(vm, 'created');
  5851. /* istanbul ignore if */
  5852. if ( true && config.performance && mark) {
  5853. vm._name = formatComponentName(vm, false);
  5854. mark(endTag);
  5855. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  5856. }
  5857. if (vm.$options.el) {
  5858. vm.$mount(vm.$options.el);
  5859. }
  5860. };
  5861. }
  5862. function initInternalComponent (vm, options) {
  5863. var opts = vm.$options = Object.create(vm.constructor.options);
  5864. // doing this because it's faster than dynamic enumeration.
  5865. var parentVnode = options._parentVnode;
  5866. opts.parent = options.parent;
  5867. opts._parentVnode = parentVnode;
  5868. var vnodeComponentOptions = parentVnode.componentOptions;
  5869. opts.propsData = vnodeComponentOptions.propsData;
  5870. opts._parentListeners = vnodeComponentOptions.listeners;
  5871. opts._renderChildren = vnodeComponentOptions.children;
  5872. opts._componentTag = vnodeComponentOptions.tag;
  5873. if (options.render) {
  5874. opts.render = options.render;
  5875. opts.staticRenderFns = options.staticRenderFns;
  5876. }
  5877. }
  5878. function resolveConstructorOptions (Ctor) {
  5879. var options = Ctor.options;
  5880. if (Ctor.super) {
  5881. var superOptions = resolveConstructorOptions(Ctor.super);
  5882. var cachedSuperOptions = Ctor.superOptions;
  5883. if (superOptions !== cachedSuperOptions) {
  5884. // super option changed,
  5885. // need to resolve new options.
  5886. Ctor.superOptions = superOptions;
  5887. // check if there are any late-modified/attached options (#4976)
  5888. var modifiedOptions = resolveModifiedOptions(Ctor);
  5889. // update base extend options
  5890. if (modifiedOptions) {
  5891. extend(Ctor.extendOptions, modifiedOptions);
  5892. }
  5893. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  5894. if (options.name) {
  5895. options.components[options.name] = Ctor;
  5896. }
  5897. }
  5898. }
  5899. return options
  5900. }
  5901. function resolveModifiedOptions (Ctor) {
  5902. var modified;
  5903. var latest = Ctor.options;
  5904. var sealed = Ctor.sealedOptions;
  5905. for (var key in latest) {
  5906. if (latest[key] !== sealed[key]) {
  5907. if (!modified) { modified = {}; }
  5908. modified[key] = latest[key];
  5909. }
  5910. }
  5911. return modified
  5912. }
  5913. function Vue (options) {
  5914. if ( true &&
  5915. !(this instanceof Vue)
  5916. ) {
  5917. warn('Vue is a constructor and should be called with the `new` keyword');
  5918. }
  5919. this._init(options);
  5920. }
  5921. initMixin(Vue);
  5922. stateMixin(Vue);
  5923. eventsMixin(Vue);
  5924. lifecycleMixin(Vue);
  5925. renderMixin(Vue);
  5926. /* */
  5927. function initUse (Vue) {
  5928. Vue.use = function (plugin) {
  5929. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  5930. if (installedPlugins.indexOf(plugin) > -1) {
  5931. return this
  5932. }
  5933. // additional parameters
  5934. var args = toArray(arguments, 1);
  5935. args.unshift(this);
  5936. if (typeof plugin.install === 'function') {
  5937. plugin.install.apply(plugin, args);
  5938. } else if (typeof plugin === 'function') {
  5939. plugin.apply(null, args);
  5940. }
  5941. installedPlugins.push(plugin);
  5942. return this
  5943. };
  5944. }
  5945. /* */
  5946. function initMixin$1 (Vue) {
  5947. Vue.mixin = function (mixin) {
  5948. this.options = mergeOptions(this.options, mixin);
  5949. return this
  5950. };
  5951. }
  5952. /* */
  5953. function initExtend (Vue) {
  5954. /**
  5955. * Each instance constructor, including Vue, has a unique
  5956. * cid. This enables us to create wrapped "child
  5957. * constructors" for prototypal inheritance and cache them.
  5958. */
  5959. Vue.cid = 0;
  5960. var cid = 1;
  5961. /**
  5962. * Class inheritance
  5963. */
  5964. Vue.extend = function (extendOptions) {
  5965. extendOptions = extendOptions || {};
  5966. var Super = this;
  5967. var SuperId = Super.cid;
  5968. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  5969. if (cachedCtors[SuperId]) {
  5970. return cachedCtors[SuperId]
  5971. }
  5972. var name = extendOptions.name || Super.options.name;
  5973. if ( true && name) {
  5974. validateComponentName(name);
  5975. }
  5976. var Sub = function VueComponent (options) {
  5977. this._init(options);
  5978. };
  5979. Sub.prototype = Object.create(Super.prototype);
  5980. Sub.prototype.constructor = Sub;
  5981. Sub.cid = cid++;
  5982. Sub.options = mergeOptions(
  5983. Super.options,
  5984. extendOptions
  5985. );
  5986. Sub['super'] = Super;
  5987. // For props and computed properties, we define the proxy getters on
  5988. // the Vue instances at extension time, on the extended prototype. This
  5989. // avoids Object.defineProperty calls for each instance created.
  5990. if (Sub.options.props) {
  5991. initProps$1(Sub);
  5992. }
  5993. if (Sub.options.computed) {
  5994. initComputed$1(Sub);
  5995. }
  5996. // allow further extension/mixin/plugin usage
  5997. Sub.extend = Super.extend;
  5998. Sub.mixin = Super.mixin;
  5999. Sub.use = Super.use;
  6000. // create asset registers, so extended classes
  6001. // can have their private assets too.
  6002. ASSET_TYPES.forEach(function (type) {
  6003. Sub[type] = Super[type];
  6004. });
  6005. // enable recursive self-lookup
  6006. if (name) {
  6007. Sub.options.components[name] = Sub;
  6008. }
  6009. // keep a reference to the super options at extension time.
  6010. // later at instantiation we can check if Super's options have
  6011. // been updated.
  6012. Sub.superOptions = Super.options;
  6013. Sub.extendOptions = extendOptions;
  6014. Sub.sealedOptions = extend({}, Sub.options);
  6015. // cache constructor
  6016. cachedCtors[SuperId] = Sub;
  6017. return Sub
  6018. };
  6019. }
  6020. function initProps$1 (Comp) {
  6021. var props = Comp.options.props;
  6022. for (var key in props) {
  6023. proxy(Comp.prototype, "_props", key);
  6024. }
  6025. }
  6026. function initComputed$1 (Comp) {
  6027. var computed = Comp.options.computed;
  6028. for (var key in computed) {
  6029. defineComputed(Comp.prototype, key, computed[key]);
  6030. }
  6031. }
  6032. /* */
  6033. function initAssetRegisters (Vue) {
  6034. /**
  6035. * Create asset registration methods.
  6036. */
  6037. ASSET_TYPES.forEach(function (type) {
  6038. Vue[type] = function (
  6039. id,
  6040. definition
  6041. ) {
  6042. if (!definition) {
  6043. return this.options[type + 's'][id]
  6044. } else {
  6045. /* istanbul ignore if */
  6046. if ( true && type === 'component') {
  6047. validateComponentName(id);
  6048. }
  6049. if (type === 'component' && isPlainObject(definition)) {
  6050. definition.name = definition.name || id;
  6051. definition = this.options._base.extend(definition);
  6052. }
  6053. if (type === 'directive' && typeof definition === 'function') {
  6054. definition = { bind: definition, update: definition };
  6055. }
  6056. this.options[type + 's'][id] = definition;
  6057. return definition
  6058. }
  6059. };
  6060. });
  6061. }
  6062. /* */
  6063. function getComponentName (opts) {
  6064. return opts && (opts.Ctor.options.name || opts.tag)
  6065. }
  6066. function matches (pattern, name) {
  6067. if (Array.isArray(pattern)) {
  6068. return pattern.indexOf(name) > -1
  6069. } else if (typeof pattern === 'string') {
  6070. return pattern.split(',').indexOf(name) > -1
  6071. } else if (isRegExp(pattern)) {
  6072. return pattern.test(name)
  6073. }
  6074. /* istanbul ignore next */
  6075. return false
  6076. }
  6077. function pruneCache (keepAliveInstance, filter) {
  6078. var cache = keepAliveInstance.cache;
  6079. var keys = keepAliveInstance.keys;
  6080. var _vnode = keepAliveInstance._vnode;
  6081. for (var key in cache) {
  6082. var cachedNode = cache[key];
  6083. if (cachedNode) {
  6084. var name = getComponentName(cachedNode.componentOptions);
  6085. if (name && !filter(name)) {
  6086. pruneCacheEntry(cache, key, keys, _vnode);
  6087. }
  6088. }
  6089. }
  6090. }
  6091. function pruneCacheEntry (
  6092. cache,
  6093. key,
  6094. keys,
  6095. current
  6096. ) {
  6097. var cached$$1 = cache[key];
  6098. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  6099. cached$$1.componentInstance.$destroy();
  6100. }
  6101. cache[key] = null;
  6102. remove(keys, key);
  6103. }
  6104. var patternTypes = [String, RegExp, Array];
  6105. var KeepAlive = {
  6106. name: 'keep-alive',
  6107. abstract: true,
  6108. props: {
  6109. include: patternTypes,
  6110. exclude: patternTypes,
  6111. max: [String, Number]
  6112. },
  6113. created: function created () {
  6114. this.cache = Object.create(null);
  6115. this.keys = [];
  6116. },
  6117. destroyed: function destroyed () {
  6118. for (var key in this.cache) {
  6119. pruneCacheEntry(this.cache, key, this.keys);
  6120. }
  6121. },
  6122. mounted: function mounted () {
  6123. var this$1 = this;
  6124. this.$watch('include', function (val) {
  6125. pruneCache(this$1, function (name) { return matches(val, name); });
  6126. });
  6127. this.$watch('exclude', function (val) {
  6128. pruneCache(this$1, function (name) { return !matches(val, name); });
  6129. });
  6130. },
  6131. render: function render () {
  6132. var slot = this.$slots.default;
  6133. var vnode = getFirstComponentChild(slot);
  6134. var componentOptions = vnode && vnode.componentOptions;
  6135. if (componentOptions) {
  6136. // check pattern
  6137. var name = getComponentName(componentOptions);
  6138. var ref = this;
  6139. var include = ref.include;
  6140. var exclude = ref.exclude;
  6141. if (
  6142. // not included
  6143. (include && (!name || !matches(include, name))) ||
  6144. // excluded
  6145. (exclude && name && matches(exclude, name))
  6146. ) {
  6147. return vnode
  6148. }
  6149. var ref$1 = this;
  6150. var cache = ref$1.cache;
  6151. var keys = ref$1.keys;
  6152. var key = vnode.key == null
  6153. // same constructor may get registered as different local components
  6154. // so cid alone is not enough (#3269)
  6155. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  6156. : vnode.key;
  6157. if (cache[key]) {
  6158. vnode.componentInstance = cache[key].componentInstance;
  6159. // make current key freshest
  6160. remove(keys, key);
  6161. keys.push(key);
  6162. } else {
  6163. cache[key] = vnode;
  6164. keys.push(key);
  6165. // prune oldest entry
  6166. if (this.max && keys.length > parseInt(this.max)) {
  6167. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  6168. }
  6169. }
  6170. vnode.data.keepAlive = true;
  6171. }
  6172. return vnode || (slot && slot[0])
  6173. }
  6174. };
  6175. var builtInComponents = {
  6176. KeepAlive: KeepAlive
  6177. };
  6178. /* */
  6179. function initGlobalAPI (Vue) {
  6180. // config
  6181. var configDef = {};
  6182. configDef.get = function () { return config; };
  6183. if (true) {
  6184. configDef.set = function () {
  6185. warn(
  6186. 'Do not replace the Vue.config object, set individual fields instead.'
  6187. );
  6188. };
  6189. }
  6190. Object.defineProperty(Vue, 'config', configDef);
  6191. // exposed util methods.
  6192. // NOTE: these are not considered part of the public API - avoid relying on
  6193. // them unless you are aware of the risk.
  6194. Vue.util = {
  6195. warn: warn,
  6196. extend: extend,
  6197. mergeOptions: mergeOptions,
  6198. defineReactive: defineReactive$$1
  6199. };
  6200. Vue.set = set;
  6201. Vue.delete = del;
  6202. Vue.nextTick = nextTick;
  6203. // 2.6 explicit observable API
  6204. Vue.observable = function (obj) {
  6205. observe(obj);
  6206. return obj
  6207. };
  6208. Vue.options = Object.create(null);
  6209. ASSET_TYPES.forEach(function (type) {
  6210. Vue.options[type + 's'] = Object.create(null);
  6211. });
  6212. // this is used to identify the "base" constructor to extend all plain-object
  6213. // components with in Weex's multi-instance scenarios.
  6214. Vue.options._base = Vue;
  6215. extend(Vue.options.components, builtInComponents);
  6216. initUse(Vue);
  6217. initMixin$1(Vue);
  6218. initExtend(Vue);
  6219. initAssetRegisters(Vue);
  6220. }
  6221. initGlobalAPI(Vue);
  6222. Object.defineProperty(Vue.prototype, '$isServer', {
  6223. get: isServerRendering
  6224. });
  6225. Object.defineProperty(Vue.prototype, '$ssrContext', {
  6226. get: function get () {
  6227. /* istanbul ignore next */
  6228. return this.$vnode && this.$vnode.ssrContext
  6229. }
  6230. });
  6231. // expose FunctionalRenderContext for ssr runtime helper installation
  6232. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  6233. value: FunctionalRenderContext
  6234. });
  6235. Vue.version = '2.6.11';
  6236. /**
  6237. * https://raw.githubusercontent.com/Tencent/westore/master/packages/westore/utils/diff.js
  6238. */
  6239. var ARRAYTYPE = '[object Array]';
  6240. var OBJECTTYPE = '[object Object]';
  6241. // const FUNCTIONTYPE = '[object Function]'
  6242. function diff(current, pre) {
  6243. var result = {};
  6244. syncKeys(current, pre);
  6245. _diff(current, pre, '', result);
  6246. return result
  6247. }
  6248. function syncKeys(current, pre) {
  6249. if (current === pre) { return }
  6250. var rootCurrentType = type(current);
  6251. var rootPreType = type(pre);
  6252. if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
  6253. if(Object.keys(current).length >= Object.keys(pre).length){
  6254. for (var key in pre) {
  6255. var currentValue = current[key];
  6256. if (currentValue === undefined) {
  6257. current[key] = null;
  6258. } else {
  6259. syncKeys(currentValue, pre[key]);
  6260. }
  6261. }
  6262. }
  6263. } else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
  6264. if (current.length >= pre.length) {
  6265. pre.forEach(function (item, index) {
  6266. syncKeys(current[index], item);
  6267. });
  6268. }
  6269. }
  6270. }
  6271. function _diff(current, pre, path, result) {
  6272. if (current === pre) { return }
  6273. var rootCurrentType = type(current);
  6274. var rootPreType = type(pre);
  6275. if (rootCurrentType == OBJECTTYPE) {
  6276. if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
  6277. setResult(result, path, current);
  6278. } else {
  6279. var loop = function ( key ) {
  6280. var currentValue = current[key];
  6281. var preValue = pre[key];
  6282. var currentType = type(currentValue);
  6283. var preType = type(preValue);
  6284. if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
  6285. if (currentValue != pre[key]) {
  6286. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  6287. }
  6288. } else if (currentType == ARRAYTYPE) {
  6289. if (preType != ARRAYTYPE) {
  6290. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  6291. } else {
  6292. if (currentValue.length < preValue.length) {
  6293. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  6294. } else {
  6295. currentValue.forEach(function (item, index) {
  6296. _diff(item, preValue[index], (path == '' ? '' : path + ".") + key + '[' + index + ']', result);
  6297. });
  6298. }
  6299. }
  6300. } else if (currentType == OBJECTTYPE) {
  6301. if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
  6302. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  6303. } else {
  6304. for (var subKey in currentValue) {
  6305. _diff(currentValue[subKey], preValue[subKey], (path == '' ? '' : path + ".") + key + '.' + subKey, result);
  6306. }
  6307. }
  6308. }
  6309. };
  6310. for (var key in current) loop( key );
  6311. }
  6312. } else if (rootCurrentType == ARRAYTYPE) {
  6313. if (rootPreType != ARRAYTYPE) {
  6314. setResult(result, path, current);
  6315. } else {
  6316. if (current.length < pre.length) {
  6317. setResult(result, path, current);
  6318. } else {
  6319. current.forEach(function (item, index) {
  6320. _diff(item, pre[index], path + '[' + index + ']', result);
  6321. });
  6322. }
  6323. }
  6324. } else {
  6325. setResult(result, path, current);
  6326. }
  6327. }
  6328. function setResult(result, k, v) {
  6329. // if (type(v) != FUNCTIONTYPE) {
  6330. result[k] = v;
  6331. // }
  6332. }
  6333. function type(obj) {
  6334. return Object.prototype.toString.call(obj)
  6335. }
  6336. /* */
  6337. function flushCallbacks$1(vm) {
  6338. if (vm.__next_tick_callbacks && vm.__next_tick_callbacks.length) {
  6339. if (Object({"NODE_ENV":"development","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG) {
  6340. var mpInstance = vm.$scope;
  6341. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  6342. ']:flushCallbacks[' + vm.__next_tick_callbacks.length + ']');
  6343. }
  6344. var copies = vm.__next_tick_callbacks.slice(0);
  6345. vm.__next_tick_callbacks.length = 0;
  6346. for (var i = 0; i < copies.length; i++) {
  6347. copies[i]();
  6348. }
  6349. }
  6350. }
  6351. function hasRenderWatcher(vm) {
  6352. return queue.find(function (watcher) { return vm._watcher === watcher; })
  6353. }
  6354. function nextTick$1(vm, cb) {
  6355. //1.nextTick 之前 已 setData 且 setData 还未回调完成
  6356. //2.nextTick 之前存在 render watcher
  6357. if (!vm.__next_tick_pending && !hasRenderWatcher(vm)) {
  6358. if(Object({"NODE_ENV":"development","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG){
  6359. var mpInstance = vm.$scope;
  6360. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  6361. ']:nextVueTick');
  6362. }
  6363. return nextTick(cb, vm)
  6364. }else{
  6365. if(Object({"NODE_ENV":"development","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG){
  6366. var mpInstance$1 = vm.$scope;
  6367. console.log('[' + (+new Date) + '][' + (mpInstance$1.is || mpInstance$1.route) + '][' + vm._uid +
  6368. ']:nextMPTick');
  6369. }
  6370. }
  6371. var _resolve;
  6372. if (!vm.__next_tick_callbacks) {
  6373. vm.__next_tick_callbacks = [];
  6374. }
  6375. vm.__next_tick_callbacks.push(function () {
  6376. if (cb) {
  6377. try {
  6378. cb.call(vm);
  6379. } catch (e) {
  6380. handleError(e, vm, 'nextTick');
  6381. }
  6382. } else if (_resolve) {
  6383. _resolve(vm);
  6384. }
  6385. });
  6386. // $flow-disable-line
  6387. if (!cb && typeof Promise !== 'undefined') {
  6388. return new Promise(function (resolve) {
  6389. _resolve = resolve;
  6390. })
  6391. }
  6392. }
  6393. /* */
  6394. function cloneWithData(vm) {
  6395. // 确保当前 vm 所有数据被同步
  6396. var ret = Object.create(null);
  6397. var dataKeys = [].concat(
  6398. Object.keys(vm._data || {}),
  6399. Object.keys(vm._computedWatchers || {}));
  6400. dataKeys.reduce(function(ret, key) {
  6401. ret[key] = vm[key];
  6402. return ret
  6403. }, ret);
  6404. // vue-composition-api
  6405. var rawBindings = vm.__secret_vfa_state__ && vm.__secret_vfa_state__.rawBindings;
  6406. if (rawBindings) {
  6407. Object.keys(rawBindings).forEach(function (key) {
  6408. ret[key] = vm[key];
  6409. });
  6410. }
  6411. //TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
  6412. Object.assign(ret, vm.$mp.data || {});
  6413. if (
  6414. Array.isArray(vm.$options.behaviors) &&
  6415. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  6416. ) { //form-field
  6417. ret['name'] = vm.name;
  6418. ret['value'] = vm.value;
  6419. }
  6420. return JSON.parse(JSON.stringify(ret))
  6421. }
  6422. var patch = function(oldVnode, vnode) {
  6423. var this$1 = this;
  6424. if (vnode === null) { //destroy
  6425. return
  6426. }
  6427. if (this.mpType === 'page' || this.mpType === 'component') {
  6428. var mpInstance = this.$scope;
  6429. var data = Object.create(null);
  6430. try {
  6431. data = cloneWithData(this);
  6432. } catch (err) {
  6433. console.error(err);
  6434. }
  6435. data.__webviewId__ = mpInstance.data.__webviewId__;
  6436. var mpData = Object.create(null);
  6437. Object.keys(data).forEach(function (key) { //仅同步 data 中有的数据
  6438. mpData[key] = mpInstance.data[key];
  6439. });
  6440. var diffData = this.$shouldDiffData === false ? data : diff(data, mpData);
  6441. if (Object.keys(diffData).length) {
  6442. if (Object({"NODE_ENV":"development","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG) {
  6443. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + this._uid +
  6444. ']差量更新',
  6445. JSON.stringify(diffData));
  6446. }
  6447. this.__next_tick_pending = true;
  6448. mpInstance.setData(diffData, function () {
  6449. this$1.__next_tick_pending = false;
  6450. flushCallbacks$1(this$1);
  6451. });
  6452. } else {
  6453. flushCallbacks$1(this);
  6454. }
  6455. }
  6456. };
  6457. /* */
  6458. function createEmptyRender() {
  6459. }
  6460. function mountComponent$1(
  6461. vm,
  6462. el,
  6463. hydrating
  6464. ) {
  6465. if (!vm.mpType) {//main.js 中的 new Vue
  6466. return vm
  6467. }
  6468. if (vm.mpType === 'app') {
  6469. vm.$options.render = createEmptyRender;
  6470. }
  6471. if (!vm.$options.render) {
  6472. vm.$options.render = createEmptyRender;
  6473. if (true) {
  6474. /* istanbul ignore if */
  6475. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  6476. vm.$options.el || el) {
  6477. warn(
  6478. 'You are using the runtime-only build of Vue where the template ' +
  6479. 'compiler is not available. Either pre-compile the templates into ' +
  6480. 'render functions, or use the compiler-included build.',
  6481. vm
  6482. );
  6483. } else {
  6484. warn(
  6485. 'Failed to mount component: template or render function not defined.',
  6486. vm
  6487. );
  6488. }
  6489. }
  6490. }
  6491. !vm._$fallback && callHook(vm, 'beforeMount');
  6492. var updateComponent = function () {
  6493. vm._update(vm._render(), hydrating);
  6494. };
  6495. // we set this to vm._watcher inside the watcher's constructor
  6496. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  6497. // component's mounted hook), which relies on vm._watcher being already defined
  6498. new Watcher(vm, updateComponent, noop, {
  6499. before: function before() {
  6500. if (vm._isMounted && !vm._isDestroyed) {
  6501. callHook(vm, 'beforeUpdate');
  6502. }
  6503. }
  6504. }, true /* isRenderWatcher */);
  6505. hydrating = false;
  6506. return vm
  6507. }
  6508. /* */
  6509. function renderClass (
  6510. staticClass,
  6511. dynamicClass
  6512. ) {
  6513. if (isDef(staticClass) || isDef(dynamicClass)) {
  6514. return concat(staticClass, stringifyClass(dynamicClass))
  6515. }
  6516. /* istanbul ignore next */
  6517. return ''
  6518. }
  6519. function concat (a, b) {
  6520. return a ? b ? (a + ' ' + b) : a : (b || '')
  6521. }
  6522. function stringifyClass (value) {
  6523. if (Array.isArray(value)) {
  6524. return stringifyArray(value)
  6525. }
  6526. if (isObject(value)) {
  6527. return stringifyObject(value)
  6528. }
  6529. if (typeof value === 'string') {
  6530. return value
  6531. }
  6532. /* istanbul ignore next */
  6533. return ''
  6534. }
  6535. function stringifyArray (value) {
  6536. var res = '';
  6537. var stringified;
  6538. for (var i = 0, l = value.length; i < l; i++) {
  6539. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  6540. if (res) { res += ' '; }
  6541. res += stringified;
  6542. }
  6543. }
  6544. return res
  6545. }
  6546. function stringifyObject (value) {
  6547. var res = '';
  6548. for (var key in value) {
  6549. if (value[key]) {
  6550. if (res) { res += ' '; }
  6551. res += key;
  6552. }
  6553. }
  6554. return res
  6555. }
  6556. /* */
  6557. var parseStyleText = cached(function (cssText) {
  6558. var res = {};
  6559. var listDelimiter = /;(?![^(]*\))/g;
  6560. var propertyDelimiter = /:(.+)/;
  6561. cssText.split(listDelimiter).forEach(function (item) {
  6562. if (item) {
  6563. var tmp = item.split(propertyDelimiter);
  6564. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  6565. }
  6566. });
  6567. return res
  6568. });
  6569. // normalize possible array / string values into Object
  6570. function normalizeStyleBinding (bindingStyle) {
  6571. if (Array.isArray(bindingStyle)) {
  6572. return toObject(bindingStyle)
  6573. }
  6574. if (typeof bindingStyle === 'string') {
  6575. return parseStyleText(bindingStyle)
  6576. }
  6577. return bindingStyle
  6578. }
  6579. /* */
  6580. var MP_METHODS = ['createSelectorQuery', 'createIntersectionObserver', 'selectAllComponents', 'selectComponent'];
  6581. function getTarget(obj, path) {
  6582. var parts = path.split('.');
  6583. var key = parts[0];
  6584. if (key.indexOf('__$n') === 0) { //number index
  6585. key = parseInt(key.replace('__$n', ''));
  6586. }
  6587. if (parts.length === 1) {
  6588. return obj[key]
  6589. }
  6590. return getTarget(obj[key], parts.slice(1).join('.'))
  6591. }
  6592. function internalMixin(Vue) {
  6593. Vue.config.errorHandler = function(err, vm, info) {
  6594. Vue.util.warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  6595. console.error(err);
  6596. /* eslint-disable no-undef */
  6597. var app = getApp();
  6598. if (app && app.onError) {
  6599. app.onError(err);
  6600. }
  6601. };
  6602. var oldEmit = Vue.prototype.$emit;
  6603. Vue.prototype.$emit = function(event) {
  6604. if (this.$scope && event) {
  6605. this.$scope['triggerEvent'](event, {
  6606. __args__: toArray(arguments, 1)
  6607. });
  6608. }
  6609. return oldEmit.apply(this, arguments)
  6610. };
  6611. Vue.prototype.$nextTick = function(fn) {
  6612. return nextTick$1(this, fn)
  6613. };
  6614. MP_METHODS.forEach(function (method) {
  6615. Vue.prototype[method] = function(args) {
  6616. if (this.$scope && this.$scope[method]) {
  6617. return this.$scope[method](args)
  6618. }
  6619. // mp-alipay
  6620. if (typeof my === 'undefined') {
  6621. return
  6622. }
  6623. if (method === 'createSelectorQuery') {
  6624. /* eslint-disable no-undef */
  6625. return my.createSelectorQuery(args)
  6626. } else if (method === 'createIntersectionObserver') {
  6627. /* eslint-disable no-undef */
  6628. return my.createIntersectionObserver(args)
  6629. }
  6630. // TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
  6631. };
  6632. });
  6633. Vue.prototype.__init_provide = initProvide;
  6634. Vue.prototype.__init_injections = initInjections;
  6635. Vue.prototype.__call_hook = function(hook, args) {
  6636. var vm = this;
  6637. // #7573 disable dep collection when invoking lifecycle hooks
  6638. pushTarget();
  6639. var handlers = vm.$options[hook];
  6640. var info = hook + " hook";
  6641. var ret;
  6642. if (handlers) {
  6643. for (var i = 0, j = handlers.length; i < j; i++) {
  6644. ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
  6645. }
  6646. }
  6647. if (vm._hasHookEvent) {
  6648. vm.$emit('hook:' + hook, args);
  6649. }
  6650. popTarget();
  6651. return ret
  6652. };
  6653. Vue.prototype.__set_model = function(target, key, value, modifiers) {
  6654. if (Array.isArray(modifiers)) {
  6655. if (modifiers.indexOf('trim') !== -1) {
  6656. value = value.trim();
  6657. }
  6658. if (modifiers.indexOf('number') !== -1) {
  6659. value = this._n(value);
  6660. }
  6661. }
  6662. if (!target) {
  6663. target = this;
  6664. }
  6665. target[key] = value;
  6666. };
  6667. Vue.prototype.__set_sync = function(target, key, value) {
  6668. if (!target) {
  6669. target = this;
  6670. }
  6671. target[key] = value;
  6672. };
  6673. Vue.prototype.__get_orig = function(item) {
  6674. if (isPlainObject(item)) {
  6675. return item['$orig'] || item
  6676. }
  6677. return item
  6678. };
  6679. Vue.prototype.__get_value = function(dataPath, target) {
  6680. return getTarget(target || this, dataPath)
  6681. };
  6682. Vue.prototype.__get_class = function(dynamicClass, staticClass) {
  6683. return renderClass(staticClass, dynamicClass)
  6684. };
  6685. Vue.prototype.__get_style = function(dynamicStyle, staticStyle) {
  6686. if (!dynamicStyle && !staticStyle) {
  6687. return ''
  6688. }
  6689. var dynamicStyleObj = normalizeStyleBinding(dynamicStyle);
  6690. var styleObj = staticStyle ? extend(staticStyle, dynamicStyleObj) : dynamicStyleObj;
  6691. return Object.keys(styleObj).map(function (name) { return ((hyphenate(name)) + ":" + (styleObj[name])); }).join(';')
  6692. };
  6693. Vue.prototype.__map = function(val, iteratee) {
  6694. //TODO 暂不考虑 string
  6695. var ret, i, l, keys, key;
  6696. if (Array.isArray(val)) {
  6697. ret = new Array(val.length);
  6698. for (i = 0, l = val.length; i < l; i++) {
  6699. ret[i] = iteratee(val[i], i);
  6700. }
  6701. return ret
  6702. } else if (isObject(val)) {
  6703. keys = Object.keys(val);
  6704. ret = Object.create(null);
  6705. for (i = 0, l = keys.length; i < l; i++) {
  6706. key = keys[i];
  6707. ret[key] = iteratee(val[key], key, i);
  6708. }
  6709. return ret
  6710. } else if (typeof val === 'number') {
  6711. ret = new Array(val);
  6712. for (i = 0, l = val; i < l; i++) {
  6713. // 第一个参数暂时仍和小程序一致
  6714. ret[i] = iteratee(i, i);
  6715. }
  6716. return ret
  6717. }
  6718. return []
  6719. };
  6720. }
  6721. /* */
  6722. var LIFECYCLE_HOOKS$1 = [
  6723. //App
  6724. 'onLaunch',
  6725. 'onShow',
  6726. 'onHide',
  6727. 'onUniNViewMessage',
  6728. 'onPageNotFound',
  6729. 'onThemeChange',
  6730. 'onError',
  6731. 'onUnhandledRejection',
  6732. //Page
  6733. 'onLoad',
  6734. // 'onShow',
  6735. 'onReady',
  6736. // 'onHide',
  6737. 'onUnload',
  6738. 'onPullDownRefresh',
  6739. 'onReachBottom',
  6740. 'onTabItemTap',
  6741. 'onAddToFavorites',
  6742. 'onShareTimeline',
  6743. 'onShareAppMessage',
  6744. 'onResize',
  6745. 'onPageScroll',
  6746. 'onNavigationBarButtonTap',
  6747. 'onBackPress',
  6748. 'onNavigationBarSearchInputChanged',
  6749. 'onNavigationBarSearchInputConfirmed',
  6750. 'onNavigationBarSearchInputClicked',
  6751. //Component
  6752. // 'onReady', // 兼容旧版本,应该移除该事件
  6753. 'onPageShow',
  6754. 'onPageHide',
  6755. 'onPageResize'
  6756. ];
  6757. function lifecycleMixin$1(Vue) {
  6758. //fixed vue-class-component
  6759. var oldExtend = Vue.extend;
  6760. Vue.extend = function(extendOptions) {
  6761. extendOptions = extendOptions || {};
  6762. var methods = extendOptions.methods;
  6763. if (methods) {
  6764. Object.keys(methods).forEach(function (methodName) {
  6765. if (LIFECYCLE_HOOKS$1.indexOf(methodName)!==-1) {
  6766. extendOptions[methodName] = methods[methodName];
  6767. delete methods[methodName];
  6768. }
  6769. });
  6770. }
  6771. return oldExtend.call(this, extendOptions)
  6772. };
  6773. var strategies = Vue.config.optionMergeStrategies;
  6774. var mergeHook = strategies.created;
  6775. LIFECYCLE_HOOKS$1.forEach(function (hook) {
  6776. strategies[hook] = mergeHook;
  6777. });
  6778. Vue.prototype.__lifecycle_hooks__ = LIFECYCLE_HOOKS$1;
  6779. }
  6780. /* */
  6781. // install platform patch function
  6782. Vue.prototype.__patch__ = patch;
  6783. // public mount method
  6784. Vue.prototype.$mount = function(
  6785. el ,
  6786. hydrating
  6787. ) {
  6788. return mountComponent$1(this, el, hydrating)
  6789. };
  6790. lifecycleMixin$1(Vue);
  6791. internalMixin(Vue);
  6792. /* */
  6793. /* harmony default export */ __webpack_exports__["default"] = (Vue);
  6794. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ 3)))
  6795. /***/ }),
  6796. /* 3 */
  6797. /*!***********************************!*\
  6798. !*** (webpack)/buildin/global.js ***!
  6799. \***********************************/
  6800. /*! no static exports found */
  6801. /***/ (function(module, exports) {
  6802. var g;
  6803. // This works in non-strict mode
  6804. g = (function() {
  6805. return this;
  6806. })();
  6807. try {
  6808. // This works if eval is allowed (see CSP)
  6809. g = g || new Function("return this")();
  6810. } catch (e) {
  6811. // This works if the window reference is available
  6812. if (typeof window === "object") g = window;
  6813. }
  6814. // g can still be undefined, but nothing to do about it...
  6815. // We return undefined, instead of nothing here, so it's
  6816. // easier to handle this case. if(!global) { ...}
  6817. module.exports = g;
  6818. /***/ }),
  6819. /* 4 */
  6820. /*!*************************************!*\
  6821. !*** D:/wwwroot/HDhotel/pages.json ***!
  6822. \*************************************/
  6823. /*! no static exports found */
  6824. /***/ (function(module, exports) {
  6825. /***/ }),
  6826. /* 5 */,
  6827. /* 6 */,
  6828. /* 7 */,
  6829. /* 8 */,
  6830. /* 9 */,
  6831. /* 10 */
  6832. /*!**********************************************************************************************************!*\
  6833. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js ***!
  6834. \**********************************************************************************************************/
  6835. /*! exports provided: default */
  6836. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6837. "use strict";
  6838. __webpack_require__.r(__webpack_exports__);
  6839. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  6840. /* globals __VUE_SSR_CONTEXT__ */
  6841. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  6842. // This module is a runtime utility for cleaner component module output and will
  6843. // be included in the final webpack user bundle.
  6844. function normalizeComponent (
  6845. scriptExports,
  6846. render,
  6847. staticRenderFns,
  6848. functionalTemplate,
  6849. injectStyles,
  6850. scopeId,
  6851. moduleIdentifier, /* server only */
  6852. shadowMode, /* vue-cli only */
  6853. components, // fixed by xxxxxx auto components
  6854. renderjs // fixed by xxxxxx renderjs
  6855. ) {
  6856. // Vue.extend constructor export interop
  6857. var options = typeof scriptExports === 'function'
  6858. ? scriptExports.options
  6859. : scriptExports
  6860. // fixed by xxxxxx auto components
  6861. if (components) {
  6862. if (!options.components) {
  6863. options.components = {}
  6864. }
  6865. var hasOwn = Object.prototype.hasOwnProperty
  6866. for (var name in components) {
  6867. if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {
  6868. options.components[name] = components[name]
  6869. }
  6870. }
  6871. }
  6872. // fixed by xxxxxx renderjs
  6873. if (renderjs) {
  6874. (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {
  6875. this[renderjs.__module] = this
  6876. });
  6877. (options.mixins || (options.mixins = [])).push(renderjs)
  6878. }
  6879. // render functions
  6880. if (render) {
  6881. options.render = render
  6882. options.staticRenderFns = staticRenderFns
  6883. options._compiled = true
  6884. }
  6885. // functional template
  6886. if (functionalTemplate) {
  6887. options.functional = true
  6888. }
  6889. // scopedId
  6890. if (scopeId) {
  6891. options._scopeId = 'data-v-' + scopeId
  6892. }
  6893. var hook
  6894. if (moduleIdentifier) { // server build
  6895. hook = function (context) {
  6896. // 2.3 injection
  6897. context =
  6898. context || // cached call
  6899. (this.$vnode && this.$vnode.ssrContext) || // stateful
  6900. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  6901. // 2.2 with runInNewContext: true
  6902. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  6903. context = __VUE_SSR_CONTEXT__
  6904. }
  6905. // inject component styles
  6906. if (injectStyles) {
  6907. injectStyles.call(this, context)
  6908. }
  6909. // register component module identifier for async chunk inferrence
  6910. if (context && context._registeredComponents) {
  6911. context._registeredComponents.add(moduleIdentifier)
  6912. }
  6913. }
  6914. // used by ssr in case component is cached and beforeCreate
  6915. // never gets called
  6916. options._ssrRegister = hook
  6917. } else if (injectStyles) {
  6918. hook = shadowMode
  6919. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  6920. : injectStyles
  6921. }
  6922. if (hook) {
  6923. if (options.functional) {
  6924. // for template-only hot-reload because in that case the render fn doesn't
  6925. // go through the normalizer
  6926. options._injectStyles = hook
  6927. // register for functioal component in vue file
  6928. var originalRender = options.render
  6929. options.render = function renderWithStyleInjection (h, context) {
  6930. hook.call(context)
  6931. return originalRender(h, context)
  6932. }
  6933. } else {
  6934. // inject component registration as beforeCreate hook
  6935. var existing = options.beforeCreate
  6936. options.beforeCreate = existing
  6937. ? [].concat(existing, hook)
  6938. : [hook]
  6939. }
  6940. }
  6941. return {
  6942. exports: scriptExports,
  6943. options: options
  6944. }
  6945. }
  6946. /***/ }),
  6947. /* 11 */
  6948. /*!*******************************************!*\
  6949. !*** D:/wwwroot/HDhotel/config/config.js ***!
  6950. \*******************************************/
  6951. /*! no static exports found */
  6952. /***/ (function(module, exports, __webpack_require__) {
  6953. "use strict";
  6954. Object.defineProperty(exports, "__esModule", { value: true });exports.config = void 0;var config = {
  6955. //dev
  6956. apiBaseurl: 'http://im.t.phpim.cn/', //测试
  6957. loginUrl: 'http://ht.t.phpim.cn?backpage=http://tanhuiapp.hongweisoft.com/#/pages/index/index', //登录后跳转到测试链接
  6958. // 密码授权令牌
  6959. client_id: 4,
  6960. client_secret: 'jO1XHQu0GytEdxJzNRFwcIeWmS57yCMBuA5P9yDo'
  6961. //online 线上地址
  6962. // apiBaseurl:'http://hd.phpim.cn/',//线上
  6963. //gloab 全局
  6964. // imgUrl:"http://qny.gzsdtfp.com/",
  6965. };exports.config = config;
  6966. /***/ }),
  6967. /* 12 */
  6968. /*!*****************************************!*\
  6969. !*** D:/wwwroot/HDhotel/store/index.js ***!
  6970. \*****************************************/
  6971. /*! no static exports found */
  6972. /***/ (function(module, exports, __webpack_require__) {
  6973. "use strict";
  6974. /* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 2));
  6975. var _vuex = _interopRequireDefault(__webpack_require__(/*! vuex */ 13));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
  6976. _vue.default.use(_vuex.default);
  6977. var store = new _vuex.default.Store({
  6978. state: {
  6979. hasLogin: false,
  6980. token: '',
  6981. userInfo: {} },
  6982. mutations: {
  6983. setLogin: function setLogin(state, userInfo) {
  6984. // console.log('userInfo',userInfo);
  6985. // state.userInfo = userInfo.wechatUserInfo || {}
  6986. state.token = userInfo.access_token;
  6987. state.hasLogin = Boolean(state.token);
  6988. console.log(state);
  6989. // uni.setStorage({
  6990. // key: "userInfo",
  6991. // data: userInfo.wechatUserInfo
  6992. // })
  6993. uni.setStorage({
  6994. key: "hasLogin",
  6995. data: true });
  6996. uni.setStorage({
  6997. key: "token",
  6998. data: userInfo.access_token });
  6999. },
  7000. logout: function logout(state) {
  7001. userInfo = {};
  7002. hasLogin: false,
  7003. uni.removeStorage({
  7004. key: "userInfo" });
  7005. uni.removeStorage({
  7006. key: "token" });
  7007. } },
  7008. actions: {} });var _default =
  7009. store;exports.default = _default;
  7010. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  7011. /***/ }),
  7012. /* 13 */
  7013. /*!********************************************!*\
  7014. !*** ./node_modules/vuex/dist/vuex.esm.js ***!
  7015. \********************************************/
  7016. /*! exports provided: Store, install, mapState, mapMutations, mapGetters, mapActions, createNamespacedHelpers, default */
  7017. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  7018. "use strict";
  7019. __webpack_require__.r(__webpack_exports__);
  7020. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Store", function() { return Store; });
  7021. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "install", function() { return install; });
  7022. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mapState", function() { return mapState; });
  7023. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mapMutations", function() { return mapMutations; });
  7024. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mapGetters", function() { return mapGetters; });
  7025. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mapActions", function() { return mapActions; });
  7026. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createNamespacedHelpers", function() { return createNamespacedHelpers; });
  7027. /**
  7028. * vuex v3.0.1
  7029. * (c) 2017 Evan You
  7030. * @license MIT
  7031. */
  7032. var applyMixin = function (Vue) {
  7033. var version = Number(Vue.version.split('.')[0]);
  7034. if (version >= 2) {
  7035. Vue.mixin({ beforeCreate: vuexInit });
  7036. } else {
  7037. // override init and inject vuex init procedure
  7038. // for 1.x backwards compatibility.
  7039. var _init = Vue.prototype._init;
  7040. Vue.prototype._init = function (options) {
  7041. if ( options === void 0 ) options = {};
  7042. options.init = options.init
  7043. ? [vuexInit].concat(options.init)
  7044. : vuexInit;
  7045. _init.call(this, options);
  7046. };
  7047. }
  7048. /**
  7049. * Vuex init hook, injected into each instances init hooks list.
  7050. */
  7051. function vuexInit () {
  7052. var options = this.$options;
  7053. // store injection
  7054. if (options.store) {
  7055. this.$store = typeof options.store === 'function'
  7056. ? options.store()
  7057. : options.store;
  7058. } else if (options.parent && options.parent.$store) {
  7059. this.$store = options.parent.$store;
  7060. }
  7061. }
  7062. };
  7063. var devtoolHook =
  7064. typeof window !== 'undefined' &&
  7065. window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  7066. function devtoolPlugin (store) {
  7067. if (!devtoolHook) { return }
  7068. store._devtoolHook = devtoolHook;
  7069. devtoolHook.emit('vuex:init', store);
  7070. devtoolHook.on('vuex:travel-to-state', function (targetState) {
  7071. store.replaceState(targetState);
  7072. });
  7073. store.subscribe(function (mutation, state) {
  7074. devtoolHook.emit('vuex:mutation', mutation, state);
  7075. });
  7076. }
  7077. /**
  7078. * Get the first item that pass the test
  7079. * by second argument function
  7080. *
  7081. * @param {Array} list
  7082. * @param {Function} f
  7083. * @return {*}
  7084. */
  7085. /**
  7086. * Deep copy the given object considering circular structure.
  7087. * This function caches all nested objects and its copies.
  7088. * If it detects circular structure, use cached copy to avoid infinite loop.
  7089. *
  7090. * @param {*} obj
  7091. * @param {Array<Object>} cache
  7092. * @return {*}
  7093. */
  7094. /**
  7095. * forEach for object
  7096. */
  7097. function forEachValue (obj, fn) {
  7098. Object.keys(obj).forEach(function (key) { return fn(obj[key], key); });
  7099. }
  7100. function isObject (obj) {
  7101. return obj !== null && typeof obj === 'object'
  7102. }
  7103. function isPromise (val) {
  7104. return val && typeof val.then === 'function'
  7105. }
  7106. function assert (condition, msg) {
  7107. if (!condition) { throw new Error(("[vuex] " + msg)) }
  7108. }
  7109. var Module = function Module (rawModule, runtime) {
  7110. this.runtime = runtime;
  7111. this._children = Object.create(null);
  7112. this._rawModule = rawModule;
  7113. var rawState = rawModule.state;
  7114. this.state = (typeof rawState === 'function' ? rawState() : rawState) || {};
  7115. };
  7116. var prototypeAccessors$1 = { namespaced: { configurable: true } };
  7117. prototypeAccessors$1.namespaced.get = function () {
  7118. return !!this._rawModule.namespaced
  7119. };
  7120. Module.prototype.addChild = function addChild (key, module) {
  7121. this._children[key] = module;
  7122. };
  7123. Module.prototype.removeChild = function removeChild (key) {
  7124. delete this._children[key];
  7125. };
  7126. Module.prototype.getChild = function getChild (key) {
  7127. return this._children[key]
  7128. };
  7129. Module.prototype.update = function update (rawModule) {
  7130. this._rawModule.namespaced = rawModule.namespaced;
  7131. if (rawModule.actions) {
  7132. this._rawModule.actions = rawModule.actions;
  7133. }
  7134. if (rawModule.mutations) {
  7135. this._rawModule.mutations = rawModule.mutations;
  7136. }
  7137. if (rawModule.getters) {
  7138. this._rawModule.getters = rawModule.getters;
  7139. }
  7140. };
  7141. Module.prototype.forEachChild = function forEachChild (fn) {
  7142. forEachValue(this._children, fn);
  7143. };
  7144. Module.prototype.forEachGetter = function forEachGetter (fn) {
  7145. if (this._rawModule.getters) {
  7146. forEachValue(this._rawModule.getters, fn);
  7147. }
  7148. };
  7149. Module.prototype.forEachAction = function forEachAction (fn) {
  7150. if (this._rawModule.actions) {
  7151. forEachValue(this._rawModule.actions, fn);
  7152. }
  7153. };
  7154. Module.prototype.forEachMutation = function forEachMutation (fn) {
  7155. if (this._rawModule.mutations) {
  7156. forEachValue(this._rawModule.mutations, fn);
  7157. }
  7158. };
  7159. Object.defineProperties( Module.prototype, prototypeAccessors$1 );
  7160. var ModuleCollection = function ModuleCollection (rawRootModule) {
  7161. // register root module (Vuex.Store options)
  7162. this.register([], rawRootModule, false);
  7163. };
  7164. ModuleCollection.prototype.get = function get (path) {
  7165. return path.reduce(function (module, key) {
  7166. return module.getChild(key)
  7167. }, this.root)
  7168. };
  7169. ModuleCollection.prototype.getNamespace = function getNamespace (path) {
  7170. var module = this.root;
  7171. return path.reduce(function (namespace, key) {
  7172. module = module.getChild(key);
  7173. return namespace + (module.namespaced ? key + '/' : '')
  7174. }, '')
  7175. };
  7176. ModuleCollection.prototype.update = function update$1 (rawRootModule) {
  7177. update([], this.root, rawRootModule);
  7178. };
  7179. ModuleCollection.prototype.register = function register (path, rawModule, runtime) {
  7180. var this$1 = this;
  7181. if ( runtime === void 0 ) runtime = true;
  7182. if (true) {
  7183. assertRawModule(path, rawModule);
  7184. }
  7185. var newModule = new Module(rawModule, runtime);
  7186. if (path.length === 0) {
  7187. this.root = newModule;
  7188. } else {
  7189. var parent = this.get(path.slice(0, -1));
  7190. parent.addChild(path[path.length - 1], newModule);
  7191. }
  7192. // register nested modules
  7193. if (rawModule.modules) {
  7194. forEachValue(rawModule.modules, function (rawChildModule, key) {
  7195. this$1.register(path.concat(key), rawChildModule, runtime);
  7196. });
  7197. }
  7198. };
  7199. ModuleCollection.prototype.unregister = function unregister (path) {
  7200. var parent = this.get(path.slice(0, -1));
  7201. var key = path[path.length - 1];
  7202. if (!parent.getChild(key).runtime) { return }
  7203. parent.removeChild(key);
  7204. };
  7205. function update (path, targetModule, newModule) {
  7206. if (true) {
  7207. assertRawModule(path, newModule);
  7208. }
  7209. // update target module
  7210. targetModule.update(newModule);
  7211. // update nested modules
  7212. if (newModule.modules) {
  7213. for (var key in newModule.modules) {
  7214. if (!targetModule.getChild(key)) {
  7215. if (true) {
  7216. console.warn(
  7217. "[vuex] trying to add a new module '" + key + "' on hot reloading, " +
  7218. 'manual reload is needed'
  7219. );
  7220. }
  7221. return
  7222. }
  7223. update(
  7224. path.concat(key),
  7225. targetModule.getChild(key),
  7226. newModule.modules[key]
  7227. );
  7228. }
  7229. }
  7230. }
  7231. var functionAssert = {
  7232. assert: function (value) { return typeof value === 'function'; },
  7233. expected: 'function'
  7234. };
  7235. var objectAssert = {
  7236. assert: function (value) { return typeof value === 'function' ||
  7237. (typeof value === 'object' && typeof value.handler === 'function'); },
  7238. expected: 'function or object with "handler" function'
  7239. };
  7240. var assertTypes = {
  7241. getters: functionAssert,
  7242. mutations: functionAssert,
  7243. actions: objectAssert
  7244. };
  7245. function assertRawModule (path, rawModule) {
  7246. Object.keys(assertTypes).forEach(function (key) {
  7247. if (!rawModule[key]) { return }
  7248. var assertOptions = assertTypes[key];
  7249. forEachValue(rawModule[key], function (value, type) {
  7250. assert(
  7251. assertOptions.assert(value),
  7252. makeAssertionMessage(path, key, type, value, assertOptions.expected)
  7253. );
  7254. });
  7255. });
  7256. }
  7257. function makeAssertionMessage (path, key, type, value, expected) {
  7258. var buf = key + " should be " + expected + " but \"" + key + "." + type + "\"";
  7259. if (path.length > 0) {
  7260. buf += " in module \"" + (path.join('.')) + "\"";
  7261. }
  7262. buf += " is " + (JSON.stringify(value)) + ".";
  7263. return buf
  7264. }
  7265. var Vue; // bind on install
  7266. var Store = function Store (options) {
  7267. var this$1 = this;
  7268. if ( options === void 0 ) options = {};
  7269. // Auto install if it is not done yet and `window` has `Vue`.
  7270. // To allow users to avoid auto-installation in some cases,
  7271. // this code should be placed here. See #731
  7272. if (!Vue && typeof window !== 'undefined' && window.Vue) {
  7273. install(window.Vue);
  7274. }
  7275. if (true) {
  7276. assert(Vue, "must call Vue.use(Vuex) before creating a store instance.");
  7277. assert(typeof Promise !== 'undefined', "vuex requires a Promise polyfill in this browser.");
  7278. assert(this instanceof Store, "Store must be called with the new operator.");
  7279. }
  7280. var plugins = options.plugins; if ( plugins === void 0 ) plugins = [];
  7281. var strict = options.strict; if ( strict === void 0 ) strict = false;
  7282. var state = options.state; if ( state === void 0 ) state = {};
  7283. if (typeof state === 'function') {
  7284. state = state() || {};
  7285. }
  7286. // store internal state
  7287. this._committing = false;
  7288. this._actions = Object.create(null);
  7289. this._actionSubscribers = [];
  7290. this._mutations = Object.create(null);
  7291. this._wrappedGetters = Object.create(null);
  7292. this._modules = new ModuleCollection(options);
  7293. this._modulesNamespaceMap = Object.create(null);
  7294. this._subscribers = [];
  7295. this._watcherVM = new Vue();
  7296. // bind commit and dispatch to self
  7297. var store = this;
  7298. var ref = this;
  7299. var dispatch = ref.dispatch;
  7300. var commit = ref.commit;
  7301. this.dispatch = function boundDispatch (type, payload) {
  7302. return dispatch.call(store, type, payload)
  7303. };
  7304. this.commit = function boundCommit (type, payload, options) {
  7305. return commit.call(store, type, payload, options)
  7306. };
  7307. // strict mode
  7308. this.strict = strict;
  7309. // init root module.
  7310. // this also recursively registers all sub-modules
  7311. // and collects all module getters inside this._wrappedGetters
  7312. installModule(this, state, [], this._modules.root);
  7313. // initialize the store vm, which is responsible for the reactivity
  7314. // (also registers _wrappedGetters as computed properties)
  7315. resetStoreVM(this, state);
  7316. // apply plugins
  7317. plugins.forEach(function (plugin) { return plugin(this$1); });
  7318. if (Vue.config.devtools) {
  7319. devtoolPlugin(this);
  7320. }
  7321. };
  7322. var prototypeAccessors = { state: { configurable: true } };
  7323. prototypeAccessors.state.get = function () {
  7324. return this._vm._data.$$state
  7325. };
  7326. prototypeAccessors.state.set = function (v) {
  7327. if (true) {
  7328. assert(false, "Use store.replaceState() to explicit replace store state.");
  7329. }
  7330. };
  7331. Store.prototype.commit = function commit (_type, _payload, _options) {
  7332. var this$1 = this;
  7333. // check object-style commit
  7334. var ref = unifyObjectStyle(_type, _payload, _options);
  7335. var type = ref.type;
  7336. var payload = ref.payload;
  7337. var options = ref.options;
  7338. var mutation = { type: type, payload: payload };
  7339. var entry = this._mutations[type];
  7340. if (!entry) {
  7341. if (true) {
  7342. console.error(("[vuex] unknown mutation type: " + type));
  7343. }
  7344. return
  7345. }
  7346. this._withCommit(function () {
  7347. entry.forEach(function commitIterator (handler) {
  7348. handler(payload);
  7349. });
  7350. });
  7351. this._subscribers.forEach(function (sub) { return sub(mutation, this$1.state); });
  7352. if (
  7353. true &&
  7354. options && options.silent
  7355. ) {
  7356. console.warn(
  7357. "[vuex] mutation type: " + type + ". Silent option has been removed. " +
  7358. 'Use the filter functionality in the vue-devtools'
  7359. );
  7360. }
  7361. };
  7362. Store.prototype.dispatch = function dispatch (_type, _payload) {
  7363. var this$1 = this;
  7364. // check object-style dispatch
  7365. var ref = unifyObjectStyle(_type, _payload);
  7366. var type = ref.type;
  7367. var payload = ref.payload;
  7368. var action = { type: type, payload: payload };
  7369. var entry = this._actions[type];
  7370. if (!entry) {
  7371. if (true) {
  7372. console.error(("[vuex] unknown action type: " + type));
  7373. }
  7374. return
  7375. }
  7376. this._actionSubscribers.forEach(function (sub) { return sub(action, this$1.state); });
  7377. return entry.length > 1
  7378. ? Promise.all(entry.map(function (handler) { return handler(payload); }))
  7379. : entry[0](payload)
  7380. };
  7381. Store.prototype.subscribe = function subscribe (fn) {
  7382. return genericSubscribe(fn, this._subscribers)
  7383. };
  7384. Store.prototype.subscribeAction = function subscribeAction (fn) {
  7385. return genericSubscribe(fn, this._actionSubscribers)
  7386. };
  7387. Store.prototype.watch = function watch (getter, cb, options) {
  7388. var this$1 = this;
  7389. if (true) {
  7390. assert(typeof getter === 'function', "store.watch only accepts a function.");
  7391. }
  7392. return this._watcherVM.$watch(function () { return getter(this$1.state, this$1.getters); }, cb, options)
  7393. };
  7394. Store.prototype.replaceState = function replaceState (state) {
  7395. var this$1 = this;
  7396. this._withCommit(function () {
  7397. this$1._vm._data.$$state = state;
  7398. });
  7399. };
  7400. Store.prototype.registerModule = function registerModule (path, rawModule, options) {
  7401. if ( options === void 0 ) options = {};
  7402. if (typeof path === 'string') { path = [path]; }
  7403. if (true) {
  7404. assert(Array.isArray(path), "module path must be a string or an Array.");
  7405. assert(path.length > 0, 'cannot register the root module by using registerModule.');
  7406. }
  7407. this._modules.register(path, rawModule);
  7408. installModule(this, this.state, path, this._modules.get(path), options.preserveState);
  7409. // reset store to update getters...
  7410. resetStoreVM(this, this.state);
  7411. };
  7412. Store.prototype.unregisterModule = function unregisterModule (path) {
  7413. var this$1 = this;
  7414. if (typeof path === 'string') { path = [path]; }
  7415. if (true) {
  7416. assert(Array.isArray(path), "module path must be a string or an Array.");
  7417. }
  7418. this._modules.unregister(path);
  7419. this._withCommit(function () {
  7420. var parentState = getNestedState(this$1.state, path.slice(0, -1));
  7421. Vue.delete(parentState, path[path.length - 1]);
  7422. });
  7423. resetStore(this);
  7424. };
  7425. Store.prototype.hotUpdate = function hotUpdate (newOptions) {
  7426. this._modules.update(newOptions);
  7427. resetStore(this, true);
  7428. };
  7429. Store.prototype._withCommit = function _withCommit (fn) {
  7430. var committing = this._committing;
  7431. this._committing = true;
  7432. fn();
  7433. this._committing = committing;
  7434. };
  7435. Object.defineProperties( Store.prototype, prototypeAccessors );
  7436. function genericSubscribe (fn, subs) {
  7437. if (subs.indexOf(fn) < 0) {
  7438. subs.push(fn);
  7439. }
  7440. return function () {
  7441. var i = subs.indexOf(fn);
  7442. if (i > -1) {
  7443. subs.splice(i, 1);
  7444. }
  7445. }
  7446. }
  7447. function resetStore (store, hot) {
  7448. store._actions = Object.create(null);
  7449. store._mutations = Object.create(null);
  7450. store._wrappedGetters = Object.create(null);
  7451. store._modulesNamespaceMap = Object.create(null);
  7452. var state = store.state;
  7453. // init all modules
  7454. installModule(store, state, [], store._modules.root, true);
  7455. // reset vm
  7456. resetStoreVM(store, state, hot);
  7457. }
  7458. function resetStoreVM (store, state, hot) {
  7459. var oldVm = store._vm;
  7460. // bind store public getters
  7461. store.getters = {};
  7462. var wrappedGetters = store._wrappedGetters;
  7463. var computed = {};
  7464. forEachValue(wrappedGetters, function (fn, key) {
  7465. // use computed to leverage its lazy-caching mechanism
  7466. computed[key] = function () { return fn(store); };
  7467. Object.defineProperty(store.getters, key, {
  7468. get: function () { return store._vm[key]; },
  7469. enumerable: true // for local getters
  7470. });
  7471. });
  7472. // use a Vue instance to store the state tree
  7473. // suppress warnings just in case the user has added
  7474. // some funky global mixins
  7475. var silent = Vue.config.silent;
  7476. Vue.config.silent = true;
  7477. store._vm = new Vue({
  7478. data: {
  7479. $$state: state
  7480. },
  7481. computed: computed
  7482. });
  7483. Vue.config.silent = silent;
  7484. // enable strict mode for new vm
  7485. if (store.strict) {
  7486. enableStrictMode(store);
  7487. }
  7488. if (oldVm) {
  7489. if (hot) {
  7490. // dispatch changes in all subscribed watchers
  7491. // to force getter re-evaluation for hot reloading.
  7492. store._withCommit(function () {
  7493. oldVm._data.$$state = null;
  7494. });
  7495. }
  7496. Vue.nextTick(function () { return oldVm.$destroy(); });
  7497. }
  7498. }
  7499. function installModule (store, rootState, path, module, hot) {
  7500. var isRoot = !path.length;
  7501. var namespace = store._modules.getNamespace(path);
  7502. // register in namespace map
  7503. if (module.namespaced) {
  7504. store._modulesNamespaceMap[namespace] = module;
  7505. }
  7506. // set state
  7507. if (!isRoot && !hot) {
  7508. var parentState = getNestedState(rootState, path.slice(0, -1));
  7509. var moduleName = path[path.length - 1];
  7510. store._withCommit(function () {
  7511. Vue.set(parentState, moduleName, module.state);
  7512. });
  7513. }
  7514. var local = module.context = makeLocalContext(store, namespace, path);
  7515. module.forEachMutation(function (mutation, key) {
  7516. var namespacedType = namespace + key;
  7517. registerMutation(store, namespacedType, mutation, local);
  7518. });
  7519. module.forEachAction(function (action, key) {
  7520. var type = action.root ? key : namespace + key;
  7521. var handler = action.handler || action;
  7522. registerAction(store, type, handler, local);
  7523. });
  7524. module.forEachGetter(function (getter, key) {
  7525. var namespacedType = namespace + key;
  7526. registerGetter(store, namespacedType, getter, local);
  7527. });
  7528. module.forEachChild(function (child, key) {
  7529. installModule(store, rootState, path.concat(key), child, hot);
  7530. });
  7531. }
  7532. /**
  7533. * make localized dispatch, commit, getters and state
  7534. * if there is no namespace, just use root ones
  7535. */
  7536. function makeLocalContext (store, namespace, path) {
  7537. var noNamespace = namespace === '';
  7538. var local = {
  7539. dispatch: noNamespace ? store.dispatch : function (_type, _payload, _options) {
  7540. var args = unifyObjectStyle(_type, _payload, _options);
  7541. var payload = args.payload;
  7542. var options = args.options;
  7543. var type = args.type;
  7544. if (!options || !options.root) {
  7545. type = namespace + type;
  7546. if ( true && !store._actions[type]) {
  7547. console.error(("[vuex] unknown local action type: " + (args.type) + ", global type: " + type));
  7548. return
  7549. }
  7550. }
  7551. return store.dispatch(type, payload)
  7552. },
  7553. commit: noNamespace ? store.commit : function (_type, _payload, _options) {
  7554. var args = unifyObjectStyle(_type, _payload, _options);
  7555. var payload = args.payload;
  7556. var options = args.options;
  7557. var type = args.type;
  7558. if (!options || !options.root) {
  7559. type = namespace + type;
  7560. if ( true && !store._mutations[type]) {
  7561. console.error(("[vuex] unknown local mutation type: " + (args.type) + ", global type: " + type));
  7562. return
  7563. }
  7564. }
  7565. store.commit(type, payload, options);
  7566. }
  7567. };
  7568. // getters and state object must be gotten lazily
  7569. // because they will be changed by vm update
  7570. Object.defineProperties(local, {
  7571. getters: {
  7572. get: noNamespace
  7573. ? function () { return store.getters; }
  7574. : function () { return makeLocalGetters(store, namespace); }
  7575. },
  7576. state: {
  7577. get: function () { return getNestedState(store.state, path); }
  7578. }
  7579. });
  7580. return local
  7581. }
  7582. function makeLocalGetters (store, namespace) {
  7583. var gettersProxy = {};
  7584. var splitPos = namespace.length;
  7585. Object.keys(store.getters).forEach(function (type) {
  7586. // skip if the target getter is not match this namespace
  7587. if (type.slice(0, splitPos) !== namespace) { return }
  7588. // extract local getter type
  7589. var localType = type.slice(splitPos);
  7590. // Add a port to the getters proxy.
  7591. // Define as getter property because
  7592. // we do not want to evaluate the getters in this time.
  7593. Object.defineProperty(gettersProxy, localType, {
  7594. get: function () { return store.getters[type]; },
  7595. enumerable: true
  7596. });
  7597. });
  7598. return gettersProxy
  7599. }
  7600. function registerMutation (store, type, handler, local) {
  7601. var entry = store._mutations[type] || (store._mutations[type] = []);
  7602. entry.push(function wrappedMutationHandler (payload) {
  7603. handler.call(store, local.state, payload);
  7604. });
  7605. }
  7606. function registerAction (store, type, handler, local) {
  7607. var entry = store._actions[type] || (store._actions[type] = []);
  7608. entry.push(function wrappedActionHandler (payload, cb) {
  7609. var res = handler.call(store, {
  7610. dispatch: local.dispatch,
  7611. commit: local.commit,
  7612. getters: local.getters,
  7613. state: local.state,
  7614. rootGetters: store.getters,
  7615. rootState: store.state
  7616. }, payload, cb);
  7617. if (!isPromise(res)) {
  7618. res = Promise.resolve(res);
  7619. }
  7620. if (store._devtoolHook) {
  7621. return res.catch(function (err) {
  7622. store._devtoolHook.emit('vuex:error', err);
  7623. throw err
  7624. })
  7625. } else {
  7626. return res
  7627. }
  7628. });
  7629. }
  7630. function registerGetter (store, type, rawGetter, local) {
  7631. if (store._wrappedGetters[type]) {
  7632. if (true) {
  7633. console.error(("[vuex] duplicate getter key: " + type));
  7634. }
  7635. return
  7636. }
  7637. store._wrappedGetters[type] = function wrappedGetter (store) {
  7638. return rawGetter(
  7639. local.state, // local state
  7640. local.getters, // local getters
  7641. store.state, // root state
  7642. store.getters // root getters
  7643. )
  7644. };
  7645. }
  7646. function enableStrictMode (store) {
  7647. store._vm.$watch(function () { return this._data.$$state }, function () {
  7648. if (true) {
  7649. assert(store._committing, "Do not mutate vuex store state outside mutation handlers.");
  7650. }
  7651. }, { deep: true, sync: true });
  7652. }
  7653. function getNestedState (state, path) {
  7654. return path.length
  7655. ? path.reduce(function (state, key) { return state[key]; }, state)
  7656. : state
  7657. }
  7658. function unifyObjectStyle (type, payload, options) {
  7659. if (isObject(type) && type.type) {
  7660. options = payload;
  7661. payload = type;
  7662. type = type.type;
  7663. }
  7664. if (true) {
  7665. assert(typeof type === 'string', ("Expects string as the type, but found " + (typeof type) + "."));
  7666. }
  7667. return { type: type, payload: payload, options: options }
  7668. }
  7669. function install (_Vue) {
  7670. if (Vue && _Vue === Vue) {
  7671. if (true) {
  7672. console.error(
  7673. '[vuex] already installed. Vue.use(Vuex) should be called only once.'
  7674. );
  7675. }
  7676. return
  7677. }
  7678. Vue = _Vue;
  7679. applyMixin(Vue);
  7680. }
  7681. var mapState = normalizeNamespace(function (namespace, states) {
  7682. var res = {};
  7683. normalizeMap(states).forEach(function (ref) {
  7684. var key = ref.key;
  7685. var val = ref.val;
  7686. res[key] = function mappedState () {
  7687. var state = this.$store.state;
  7688. var getters = this.$store.getters;
  7689. if (namespace) {
  7690. var module = getModuleByNamespace(this.$store, 'mapState', namespace);
  7691. if (!module) {
  7692. return
  7693. }
  7694. state = module.context.state;
  7695. getters = module.context.getters;
  7696. }
  7697. return typeof val === 'function'
  7698. ? val.call(this, state, getters)
  7699. : state[val]
  7700. };
  7701. // mark vuex getter for devtools
  7702. res[key].vuex = true;
  7703. });
  7704. return res
  7705. });
  7706. var mapMutations = normalizeNamespace(function (namespace, mutations) {
  7707. var res = {};
  7708. normalizeMap(mutations).forEach(function (ref) {
  7709. var key = ref.key;
  7710. var val = ref.val;
  7711. res[key] = function mappedMutation () {
  7712. var args = [], len = arguments.length;
  7713. while ( len-- ) args[ len ] = arguments[ len ];
  7714. var commit = this.$store.commit;
  7715. if (namespace) {
  7716. var module = getModuleByNamespace(this.$store, 'mapMutations', namespace);
  7717. if (!module) {
  7718. return
  7719. }
  7720. commit = module.context.commit;
  7721. }
  7722. return typeof val === 'function'
  7723. ? val.apply(this, [commit].concat(args))
  7724. : commit.apply(this.$store, [val].concat(args))
  7725. };
  7726. });
  7727. return res
  7728. });
  7729. var mapGetters = normalizeNamespace(function (namespace, getters) {
  7730. var res = {};
  7731. normalizeMap(getters).forEach(function (ref) {
  7732. var key = ref.key;
  7733. var val = ref.val;
  7734. val = namespace + val;
  7735. res[key] = function mappedGetter () {
  7736. if (namespace && !getModuleByNamespace(this.$store, 'mapGetters', namespace)) {
  7737. return
  7738. }
  7739. if ( true && !(val in this.$store.getters)) {
  7740. console.error(("[vuex] unknown getter: " + val));
  7741. return
  7742. }
  7743. return this.$store.getters[val]
  7744. };
  7745. // mark vuex getter for devtools
  7746. res[key].vuex = true;
  7747. });
  7748. return res
  7749. });
  7750. var mapActions = normalizeNamespace(function (namespace, actions) {
  7751. var res = {};
  7752. normalizeMap(actions).forEach(function (ref) {
  7753. var key = ref.key;
  7754. var val = ref.val;
  7755. res[key] = function mappedAction () {
  7756. var args = [], len = arguments.length;
  7757. while ( len-- ) args[ len ] = arguments[ len ];
  7758. var dispatch = this.$store.dispatch;
  7759. if (namespace) {
  7760. var module = getModuleByNamespace(this.$store, 'mapActions', namespace);
  7761. if (!module) {
  7762. return
  7763. }
  7764. dispatch = module.context.dispatch;
  7765. }
  7766. return typeof val === 'function'
  7767. ? val.apply(this, [dispatch].concat(args))
  7768. : dispatch.apply(this.$store, [val].concat(args))
  7769. };
  7770. });
  7771. return res
  7772. });
  7773. var createNamespacedHelpers = function (namespace) { return ({
  7774. mapState: mapState.bind(null, namespace),
  7775. mapGetters: mapGetters.bind(null, namespace),
  7776. mapMutations: mapMutations.bind(null, namespace),
  7777. mapActions: mapActions.bind(null, namespace)
  7778. }); };
  7779. function normalizeMap (map) {
  7780. return Array.isArray(map)
  7781. ? map.map(function (key) { return ({ key: key, val: key }); })
  7782. : Object.keys(map).map(function (key) { return ({ key: key, val: map[key] }); })
  7783. }
  7784. function normalizeNamespace (fn) {
  7785. return function (namespace, map) {
  7786. if (typeof namespace !== 'string') {
  7787. map = namespace;
  7788. namespace = '';
  7789. } else if (namespace.charAt(namespace.length - 1) !== '/') {
  7790. namespace += '/';
  7791. }
  7792. return fn(namespace, map)
  7793. }
  7794. }
  7795. function getModuleByNamespace (store, helper, namespace) {
  7796. var module = store._modulesNamespaceMap[namespace];
  7797. if ( true && !module) {
  7798. console.error(("[vuex] module namespace not found in " + helper + "(): " + namespace));
  7799. }
  7800. return module
  7801. }
  7802. var index_esm = {
  7803. Store: Store,
  7804. install: install,
  7805. version: '3.0.1',
  7806. mapState: mapState,
  7807. mapMutations: mapMutations,
  7808. mapGetters: mapGetters,
  7809. mapActions: mapActions,
  7810. createNamespacedHelpers: createNamespacedHelpers
  7811. };
  7812. /* harmony default export */ __webpack_exports__["default"] = (index_esm);
  7813. /***/ }),
  7814. /* 14 */
  7815. /*!********************************************************************!*\
  7816. !*** D:/wwwroot/HDhotel/js_sdk/luch-request/luch-request/index.js ***!
  7817. \********************************************************************/
  7818. /*! no static exports found */
  7819. /***/ (function(module, exports, __webpack_require__) {
  7820. "use strict";
  7821. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _Request = _interopRequireDefault(__webpack_require__(/*! ./core/Request */ 15));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}var _default =
  7822. _Request.default;exports.default = _default;
  7823. /***/ }),
  7824. /* 15 */
  7825. /*!***************************************************************************!*\
  7826. !*** D:/wwwroot/HDhotel/js_sdk/luch-request/luch-request/core/Request.js ***!
  7827. \***************************************************************************/
  7828. /*! no static exports found */
  7829. /***/ (function(module, exports, __webpack_require__) {
  7830. "use strict";
  7831. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;
  7832. var _dispatchRequest = _interopRequireDefault(__webpack_require__(/*! ./dispatchRequest */ 16));
  7833. var _InterceptorManager = _interopRequireDefault(__webpack_require__(/*! ./InterceptorManager */ 24));
  7834. var _mergeConfig = _interopRequireDefault(__webpack_require__(/*! ./mergeConfig */ 25));
  7835. var _defaults = _interopRequireDefault(__webpack_require__(/*! ./defaults */ 26));
  7836. var _utils = __webpack_require__(/*! ../utils */ 19);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;});keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {ownKeys(Object(source), true).forEach(function (key) {_defineProperty(target, key, source[key]);});} else if (Object.getOwnPropertyDescriptors) {Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));} else {ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}}return target;}function _defineProperty(obj, key, value) {if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;}var
  7837. Request = /*#__PURE__*/function () {
  7838. /**
  7839. * @param {Object} arg - 全局配置
  7840. * @param {String} arg.baseURL - 全局根路径
  7841. * @param {Object} arg.header - 全局header
  7842. * @param {String} arg.method = [GET|POST|PUT|DELETE|CONNECT|HEAD|OPTIONS|TRACE] - 全局默认请求方式
  7843. * @param {String} arg.dataType = [json] - 全局默认的dataType
  7844. * @param {String} arg.responseType = [text|arraybuffer] - 全局默认的responseType。App和支付宝小程序不支持
  7845. * @param {Object} arg.custom - 全局默认的自定义参数
  7846. * @param {Number} arg.timeout - 全局默认的超时时间,单位 ms。默认30000。仅微信小程序(2.10.0)、支付宝小程序支持
  7847. * @param {Boolean} arg.sslVerify - 全局默认的是否验证 ssl 证书。默认true.仅App安卓端支持(HBuilderX 2.3.3+)
  7848. * @param {Boolean} arg.withCredentials - 全局默认的跨域请求时是否携带凭证(cookies)。默认false。仅H5支持(HBuilderX 2.6.15+)
  7849. * @param {Boolean} arg.firstIpv4 - 全DNS解析时优先使用ipv4。默认false。仅 App-Android 支持 (HBuilderX 2.8.0+)
  7850. * @param {Function(statusCode):Boolean} arg.validateStatus - 全局默认的自定义验证器。默认statusCode >= 200 && statusCode < 300
  7851. */
  7852. function Request() {var arg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};_classCallCheck(this, Request);
  7853. if (!(0, _utils.isPlainObject)(arg)) {
  7854. arg = {};
  7855. console.warn('设置全局参数必须接收一个Object');
  7856. }
  7857. this.config = _objectSpread({}, _defaults.default, {}, arg);
  7858. this.interceptors = {
  7859. request: new _InterceptorManager.default(),
  7860. response: new _InterceptorManager.default() };
  7861. }
  7862. /**
  7863. * @Function
  7864. * @param {Request~setConfigCallback} f - 设置全局默认配置
  7865. */_createClass(Request, [{ key: "setConfig", value: function setConfig(
  7866. f) {
  7867. this.config = f(this.config);
  7868. } }, { key: "middleware", value: function middleware(
  7869. config) {
  7870. config = (0, _mergeConfig.default)(this.config, config);
  7871. var chain = [_dispatchRequest.default, undefined];
  7872. var promise = Promise.resolve(config);
  7873. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  7874. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  7875. });
  7876. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  7877. chain.push(interceptor.fulfilled, interceptor.rejected);
  7878. });
  7879. while (chain.length) {
  7880. promise = promise.then(chain.shift(), chain.shift());
  7881. }
  7882. return promise;
  7883. }
  7884. /**
  7885. * @Function
  7886. * @param {Object} config - 请求配置项
  7887. * @prop {String} options.url - 请求路径
  7888. * @prop {Object} options.data - 请求参数
  7889. * @prop {Object} [options.responseType = config.responseType] [text|arraybuffer] - 响应的数据类型
  7890. * @prop {Object} [options.dataType = config.dataType] - 如果设为 json,会尝试对返回的数据做一次 JSON.parse
  7891. * @prop {Object} [options.header = config.header] - 请求header
  7892. * @prop {Object} [options.method = config.method] - 请求方法
  7893. * @returns {Promise<unknown>}
  7894. */ }, { key: "request", value: function request()
  7895. {var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7896. return this.middleware(config);
  7897. } }, { key: "get", value: function get(
  7898. url) {var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  7899. return this.middleware(_objectSpread({
  7900. url: url,
  7901. method: 'GET' },
  7902. options));
  7903. } }, { key: "post", value: function post(
  7904. url, data) {var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  7905. return this.middleware(_objectSpread({
  7906. url: url,
  7907. data: data,
  7908. method: 'POST' },
  7909. options));
  7910. } }, { key: "put", value: function put(
  7911. url, data) {var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  7912. return this.middleware(_objectSpread({
  7913. url: url,
  7914. data: data,
  7915. method: 'PUT' },
  7916. options));
  7917. } }, { key: "delete", value: function _delete(
  7918. url, data) {var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  7919. return this.middleware(_objectSpread({
  7920. url: url,
  7921. data: data,
  7922. method: 'DELETE' },
  7923. options));
  7924. } }, { key: "connect", value: function connect(
  7925. url, data) {var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  7926. return this.middleware(_objectSpread({
  7927. url: url,
  7928. data: data,
  7929. method: 'CONNECT' },
  7930. options));
  7931. } }, { key: "head", value: function head(
  7932. url, data) {var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  7933. return this.middleware(_objectSpread({
  7934. url: url,
  7935. data: data,
  7936. method: 'HEAD' },
  7937. options));
  7938. } }, { key: "options", value: function options(
  7939. url, data) {var _options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  7940. return this.middleware(_objectSpread({
  7941. url: url,
  7942. data: data,
  7943. method: 'OPTIONS' },
  7944. _options));
  7945. } }, { key: "trace", value: function trace(
  7946. url, data) {var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  7947. return this.middleware(_objectSpread({
  7948. url: url,
  7949. data: data,
  7950. method: 'TRACE' },
  7951. options));
  7952. } }, { key: "upload", value: function upload(
  7953. url) {var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  7954. config.url = url;
  7955. config.method = 'UPLOAD';
  7956. return this.middleware(config);
  7957. } }, { key: "download", value: function download(
  7958. url) {var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  7959. config.url = url;
  7960. config.method = 'DOWNLOAD';
  7961. return this.middleware(config);
  7962. } }]);return Request;}();
  7963. /**
  7964. * setConfig回调
  7965. * @return {Object} - 返回操作后的config
  7966. * @callback Request~setConfigCallback
  7967. * @param {Object} config - 全局默认config
  7968. */exports.default = Request;
  7969. /***/ }),
  7970. /* 16 */
  7971. /*!***********************************************************************************!*\
  7972. !*** D:/wwwroot/HDhotel/js_sdk/luch-request/luch-request/core/dispatchRequest.js ***!
  7973. \***********************************************************************************/
  7974. /*! no static exports found */
  7975. /***/ (function(module, exports, __webpack_require__) {
  7976. "use strict";
  7977. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _index = _interopRequireDefault(__webpack_require__(/*! ../adapters/index */ 17));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}var _default =
  7978. function _default(config) {
  7979. return (0, _index.default)(config);
  7980. };exports.default = _default;
  7981. /***/ }),
  7982. /* 17 */
  7983. /*!*****************************************************************************!*\
  7984. !*** D:/wwwroot/HDhotel/js_sdk/luch-request/luch-request/adapters/index.js ***!
  7985. \*****************************************************************************/
  7986. /*! no static exports found */
  7987. /***/ (function(module, exports, __webpack_require__) {
  7988. "use strict";
  7989. /* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _buildURL = _interopRequireDefault(__webpack_require__(/*! ../helpers/buildURL */ 18));
  7990. var _buildFullPath = _interopRequireDefault(__webpack_require__(/*! ../core/buildFullPath */ 20));
  7991. var _settle = _interopRequireDefault(__webpack_require__(/*! ../core/settle */ 23));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;});keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {ownKeys(Object(source), true).forEach(function (key) {_defineProperty(target, key, source[key]);});} else if (Object.getOwnPropertyDescriptors) {Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));} else {ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}}return target;}function _defineProperty(obj, key, value) {if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}
  7992. /**
  7993. * 返回可选值存在的配置
  7994. * @param {Array} keys - 可选值数组
  7995. * @param {Object} config2 - 配置
  7996. * @return {{}} - 存在的配置项
  7997. */
  7998. var mergeKeys = function mergeKeys(keys, config2) {
  7999. var config = {};
  8000. keys.forEach(function (prop) {
  8001. if (typeof config2[prop] !== 'undefined') {
  8002. config[prop] = config2[prop];
  8003. }
  8004. });
  8005. return config;
  8006. };var _default =
  8007. function _default(config) {
  8008. return new Promise(function (resolve, reject) {
  8009. var _config = {
  8010. url: (0, _buildURL.default)((0, _buildFullPath.default)(config.baseURL, config.url), config.params),
  8011. header: config.header,
  8012. complete: function complete(response) {
  8013. response.config = config;
  8014. try {
  8015. // 对可能字符串不是json 的情况容错
  8016. if (typeof response.data === 'string') {
  8017. response.data = JSON.parse(response.data);
  8018. }
  8019. // eslint-disable-next-line no-empty
  8020. } catch (e) {
  8021. }
  8022. (0, _settle.default)(resolve, reject, response);
  8023. } };
  8024. var requestTask;
  8025. if (config.method === 'UPLOAD') {
  8026. delete _config.header['content-type'];
  8027. delete _config.header['Content-Type'];
  8028. var otherConfig = {
  8029. filePath: config.filePath,
  8030. name: config.name };
  8031. var optionalKeys = [
  8032. 'formData'];
  8033. requestTask = uni.uploadFile(_objectSpread({}, _config, {}, otherConfig, {}, mergeKeys(optionalKeys, config)));
  8034. } else if (config.method === 'DOWNLOAD') {
  8035. requestTask = uni.downloadFile(_config);
  8036. } else {
  8037. var _optionalKeys = [
  8038. 'data',
  8039. 'method',
  8040. 'timeout',
  8041. 'dataType',
  8042. 'responseType'];
  8043. requestTask = uni.request(_objectSpread({}, _config, {}, mergeKeys(_optionalKeys, config)));
  8044. }
  8045. if (config.getTask) {
  8046. config.getTask(requestTask, config);
  8047. }
  8048. });
  8049. };exports.default = _default;
  8050. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  8051. /***/ }),
  8052. /* 18 */
  8053. /*!*******************************************************************************!*\
  8054. !*** D:/wwwroot/HDhotel/js_sdk/luch-request/luch-request/helpers/buildURL.js ***!
  8055. \*******************************************************************************/
  8056. /*! no static exports found */
  8057. /***/ (function(module, exports, __webpack_require__) {
  8058. "use strict";
  8059. Object.defineProperty(exports, "__esModule", { value: true });exports.default = buildURL;
  8060. var utils = _interopRequireWildcard(__webpack_require__(/*! ./../utils */ 19));function _getRequireWildcardCache() {if (typeof WeakMap !== "function") return null;var cache = new WeakMap();_getRequireWildcardCache = function _getRequireWildcardCache() {return cache;};return cache;}function _interopRequireWildcard(obj) {if (obj && obj.__esModule) {return obj;}if (obj === null || typeof obj !== "object" && typeof obj !== "function") {return { default: obj };}var cache = _getRequireWildcardCache();if (cache && cache.has(obj)) {return cache.get(obj);}var newObj = {};var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;for (var key in obj) {if (Object.prototype.hasOwnProperty.call(obj, key)) {var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;if (desc && (desc.get || desc.set)) {Object.defineProperty(newObj, key, desc);} else {newObj[key] = obj[key];}}}newObj.default = obj;if (cache) {cache.set(obj, newObj);}return newObj;}
  8061. function encode(val) {
  8062. return encodeURIComponent(val).
  8063. replace(/%40/gi, '@').
  8064. replace(/%3A/gi, ':').
  8065. replace(/%24/g, '$').
  8066. replace(/%2C/gi, ',').
  8067. replace(/%20/g, '+').
  8068. replace(/%5B/gi, '[').
  8069. replace(/%5D/gi, ']');
  8070. }
  8071. /**
  8072. * Build a URL by appending params to the end
  8073. *
  8074. * @param {string} url The base of the url (e.g., http://www.google.com)
  8075. * @param {object} [params] The params to be appended
  8076. * @returns {string} The formatted url
  8077. */
  8078. function buildURL(url, params) {
  8079. /*eslint no-param-reassign:0*/
  8080. if (!params) {
  8081. return url;
  8082. }
  8083. var serializedParams;
  8084. if (utils.isURLSearchParams(params)) {
  8085. serializedParams = params.toString();
  8086. } else {
  8087. var parts = [];
  8088. utils.forEach(params, function serialize(val, key) {
  8089. if (val === null || typeof val === 'undefined') {
  8090. return;
  8091. }
  8092. if (utils.isArray(val)) {
  8093. key = key + '[]';
  8094. } else {
  8095. val = [val];
  8096. }
  8097. utils.forEach(val, function parseValue(v) {
  8098. if (utils.isDate(v)) {
  8099. v = v.toISOString();
  8100. } else if (utils.isObject(v)) {
  8101. v = JSON.stringify(v);
  8102. }
  8103. parts.push(encode(key) + '=' + encode(v));
  8104. });
  8105. });
  8106. serializedParams = parts.join('&');
  8107. }
  8108. if (serializedParams) {
  8109. var hashmarkIndex = url.indexOf('#');
  8110. if (hashmarkIndex !== -1) {
  8111. url = url.slice(0, hashmarkIndex);
  8112. }
  8113. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  8114. }
  8115. return url;
  8116. }
  8117. /***/ }),
  8118. /* 19 */
  8119. /*!********************************************************************!*\
  8120. !*** D:/wwwroot/HDhotel/js_sdk/luch-request/luch-request/utils.js ***!
  8121. \********************************************************************/
  8122. /*! no static exports found */
  8123. /***/ (function(module, exports, __webpack_require__) {
  8124. "use strict";
  8125. // utils is a library of generic helper functions non-specific to axios
  8126. Object.defineProperty(exports, "__esModule", { value: true });exports.isArray = isArray;exports.isObject = isObject;exports.isDate = isDate;exports.isURLSearchParams = isURLSearchParams;exports.forEach = forEach;exports.isBoolean = isBoolean;exports.isPlainObject = isPlainObject;exports.deepMerge = deepMerge;
  8127. var toString = Object.prototype.toString;
  8128. /**
  8129. * Determine if a value is an Array
  8130. *
  8131. * @param {Object} val The value to test
  8132. * @returns {boolean} True if value is an Array, otherwise false
  8133. */
  8134. function isArray(val) {
  8135. return toString.call(val) === '[object Array]';
  8136. }
  8137. /**
  8138. * Determine if a value is an Object
  8139. *
  8140. * @param {Object} val The value to test
  8141. * @returns {boolean} True if value is an Object, otherwise false
  8142. */
  8143. function isObject(val) {
  8144. return val !== null && typeof val === 'object';
  8145. }
  8146. /**
  8147. * Determine if a value is a Date
  8148. *
  8149. * @param {Object} val The value to test
  8150. * @returns {boolean} True if value is a Date, otherwise false
  8151. */
  8152. function isDate(val) {
  8153. return toString.call(val) === '[object Date]';
  8154. }
  8155. /**
  8156. * Determine if a value is a URLSearchParams object
  8157. *
  8158. * @param {Object} val The value to test
  8159. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  8160. */
  8161. function isURLSearchParams(val) {
  8162. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  8163. }
  8164. /**
  8165. * Iterate over an Array or an Object invoking a function for each item.
  8166. *
  8167. * If `obj` is an Array callback will be called passing
  8168. * the value, index, and complete array for each item.
  8169. *
  8170. * If 'obj' is an Object callback will be called passing
  8171. * the value, key, and complete object for each property.
  8172. *
  8173. * @param {Object|Array} obj The object to iterate
  8174. * @param {Function} fn The callback to invoke for each item
  8175. */
  8176. function forEach(obj, fn) {
  8177. // Don't bother if no value provided
  8178. if (obj === null || typeof obj === 'undefined') {
  8179. return;
  8180. }
  8181. // Force an array if not already something iterable
  8182. if (typeof obj !== 'object') {
  8183. /*eslint no-param-reassign:0*/
  8184. obj = [obj];
  8185. }
  8186. if (isArray(obj)) {
  8187. // Iterate over array values
  8188. for (var i = 0, l = obj.length; i < l; i++) {
  8189. fn.call(null, obj[i], i, obj);
  8190. }
  8191. } else {
  8192. // Iterate over object keys
  8193. for (var key in obj) {
  8194. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  8195. fn.call(null, obj[key], key, obj);
  8196. }
  8197. }
  8198. }
  8199. }
  8200. /**
  8201. * 是否为boolean 值
  8202. * @param val
  8203. * @returns {boolean}
  8204. */
  8205. function isBoolean(val) {
  8206. return typeof val === 'boolean';
  8207. }
  8208. /**
  8209. * 是否为真正的对象{} new Object
  8210. * @param {any} obj - 检测的对象
  8211. * @returns {boolean}
  8212. */
  8213. function isPlainObject(obj) {
  8214. return Object.prototype.toString.call(obj) === '[object Object]';
  8215. }
  8216. /**
  8217. * Function equal to merge with the difference being that no reference
  8218. * to original objects is kept.
  8219. *
  8220. * @see merge
  8221. * @param {Object} obj1 Object to merge
  8222. * @returns {Object} Result of all merge properties
  8223. */
  8224. function deepMerge() /* obj1, obj2, obj3, ... */{
  8225. var result = {};
  8226. function assignValue(val, key) {
  8227. if (typeof result[key] === 'object' && typeof val === 'object') {
  8228. result[key] = deepMerge(result[key], val);
  8229. } else if (typeof val === 'object') {
  8230. result[key] = deepMerge({}, val);
  8231. } else {
  8232. result[key] = val;
  8233. }
  8234. }
  8235. for (var i = 0, l = arguments.length; i < l; i++) {
  8236. forEach(arguments[i], assignValue);
  8237. }
  8238. return result;
  8239. }
  8240. /***/ }),
  8241. /* 20 */
  8242. /*!*********************************************************************************!*\
  8243. !*** D:/wwwroot/HDhotel/js_sdk/luch-request/luch-request/core/buildFullPath.js ***!
  8244. \*********************************************************************************/
  8245. /*! no static exports found */
  8246. /***/ (function(module, exports, __webpack_require__) {
  8247. "use strict";
  8248. Object.defineProperty(exports, "__esModule", { value: true });exports.default = buildFullPath;
  8249. var _isAbsoluteURL = _interopRequireDefault(__webpack_require__(/*! ../helpers/isAbsoluteURL */ 21));
  8250. var _combineURLs = _interopRequireDefault(__webpack_require__(/*! ../helpers/combineURLs */ 22));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
  8251. /**
  8252. * Creates a new URL by combining the baseURL with the requestedURL,
  8253. * only when the requestedURL is not already an absolute URL.
  8254. * If the requestURL is absolute, this function returns the requestedURL untouched.
  8255. *
  8256. * @param {string} baseURL The base URL
  8257. * @param {string} requestedURL Absolute or relative URL to combine
  8258. * @returns {string} The combined full path
  8259. */
  8260. function buildFullPath(baseURL, requestedURL) {
  8261. if (baseURL && !(0, _isAbsoluteURL.default)(requestedURL)) {
  8262. return (0, _combineURLs.default)(baseURL, requestedURL);
  8263. }
  8264. return requestedURL;
  8265. }
  8266. /***/ }),
  8267. /* 21 */
  8268. /*!************************************************************************************!*\
  8269. !*** D:/wwwroot/HDhotel/js_sdk/luch-request/luch-request/helpers/isAbsoluteURL.js ***!
  8270. \************************************************************************************/
  8271. /*! no static exports found */
  8272. /***/ (function(module, exports, __webpack_require__) {
  8273. "use strict";
  8274. /**
  8275. * Determines whether the specified URL is absolute
  8276. *
  8277. * @param {string} url The URL to test
  8278. * @returns {boolean} True if the specified URL is absolute, otherwise false
  8279. */Object.defineProperty(exports, "__esModule", { value: true });exports.default = isAbsoluteURL;
  8280. function isAbsoluteURL(url) {
  8281. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  8282. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  8283. // by any combination of letters, digits, plus, period, or hyphen.
  8284. return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
  8285. }
  8286. /***/ }),
  8287. /* 22 */
  8288. /*!**********************************************************************************!*\
  8289. !*** D:/wwwroot/HDhotel/js_sdk/luch-request/luch-request/helpers/combineURLs.js ***!
  8290. \**********************************************************************************/
  8291. /*! no static exports found */
  8292. /***/ (function(module, exports, __webpack_require__) {
  8293. "use strict";
  8294. /**
  8295. * Creates a new URL by combining the specified URLs
  8296. *
  8297. * @param {string} baseURL The base URL
  8298. * @param {string} relativeURL The relative URL
  8299. * @returns {string} The combined URL
  8300. */Object.defineProperty(exports, "__esModule", { value: true });exports.default = combineURLs;
  8301. function combineURLs(baseURL, relativeURL) {
  8302. return relativeURL ?
  8303. baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') :
  8304. baseURL;
  8305. }
  8306. /***/ }),
  8307. /* 23 */
  8308. /*!**************************************************************************!*\
  8309. !*** D:/wwwroot/HDhotel/js_sdk/luch-request/luch-request/core/settle.js ***!
  8310. \**************************************************************************/
  8311. /*! no static exports found */
  8312. /***/ (function(module, exports, __webpack_require__) {
  8313. "use strict";
  8314. Object.defineProperty(exports, "__esModule", { value: true });exports.default = settle; /**
  8315. * Resolve or reject a Promise based on response status.
  8316. *
  8317. * @param {Function} resolve A function that resolves the promise.
  8318. * @param {Function} reject A function that rejects the promise.
  8319. * @param {object} response The response.
  8320. */
  8321. function settle(resolve, reject, response) {
  8322. var validateStatus = response.config.validateStatus;
  8323. var status = response.statusCode;
  8324. if (status && (!validateStatus || validateStatus(status))) {
  8325. resolve(response);
  8326. } else {
  8327. reject(response);
  8328. }
  8329. }
  8330. /***/ }),
  8331. /* 24 */
  8332. /*!**************************************************************************************!*\
  8333. !*** D:/wwwroot/HDhotel/js_sdk/luch-request/luch-request/core/InterceptorManager.js ***!
  8334. \**************************************************************************************/
  8335. /*! no static exports found */
  8336. /***/ (function(module, exports, __webpack_require__) {
  8337. "use strict";
  8338. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;
  8339. function InterceptorManager() {
  8340. this.handlers = [];
  8341. }
  8342. /**
  8343. * Add a new interceptor to the stack
  8344. *
  8345. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  8346. * @param {Function} rejected The function to handle `reject` for a `Promise`
  8347. *
  8348. * @return {Number} An ID used to remove interceptor later
  8349. */
  8350. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  8351. this.handlers.push({
  8352. fulfilled: fulfilled,
  8353. rejected: rejected });
  8354. return this.handlers.length - 1;
  8355. };
  8356. /**
  8357. * Remove an interceptor from the stack
  8358. *
  8359. * @param {Number} id The ID that was returned by `use`
  8360. */
  8361. InterceptorManager.prototype.eject = function eject(id) {
  8362. if (this.handlers[id]) {
  8363. this.handlers[id] = null;
  8364. }
  8365. };
  8366. /**
  8367. * Iterate over all the registered interceptors
  8368. *
  8369. * This method is particularly useful for skipping over any
  8370. * interceptors that may have become `null` calling `eject`.
  8371. *
  8372. * @param {Function} fn The function to call for each interceptor
  8373. */
  8374. InterceptorManager.prototype.forEach = function forEach(fn) {
  8375. this.handlers.forEach(function (h) {
  8376. if (h !== null) {
  8377. fn(h);
  8378. }
  8379. });
  8380. };var _default =
  8381. InterceptorManager;exports.default = _default;
  8382. /***/ }),
  8383. /* 25 */
  8384. /*!*******************************************************************************!*\
  8385. !*** D:/wwwroot/HDhotel/js_sdk/luch-request/luch-request/core/mergeConfig.js ***!
  8386. \*******************************************************************************/
  8387. /*! no static exports found */
  8388. /***/ (function(module, exports, __webpack_require__) {
  8389. "use strict";
  8390. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _utils = __webpack_require__(/*! ../utils */ 19);function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;});keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {ownKeys(Object(source), true).forEach(function (key) {_defineProperty(target, key, source[key]);});} else if (Object.getOwnPropertyDescriptors) {Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));} else {ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}}return target;}function _defineProperty(obj, key, value) {if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}
  8391. /**
  8392. * 合并局部配置优先的配置,如果局部有该配置项则用局部,如果全局有该配置项则用全局
  8393. * @param {Array} keys - 配置项
  8394. * @param {Object} globalsConfig - 当前的全局配置
  8395. * @param {Object} config2 - 局部配置
  8396. * @return {{}}
  8397. */
  8398. var mergeKeys = function mergeKeys(keys, globalsConfig, config2) {
  8399. var config = {};
  8400. keys.forEach(function (prop) {
  8401. if (typeof config2[prop] !== 'undefined') {
  8402. config[prop] = config2[prop];
  8403. } else if (typeof globalsConfig[prop] !== 'undefined') {
  8404. config[prop] = globalsConfig[prop];
  8405. }
  8406. });
  8407. return config;
  8408. };
  8409. /**
  8410. *
  8411. * @param globalsConfig - 当前实例的全局配置
  8412. * @param config2 - 当前的局部配置
  8413. * @return - 合并后的配置
  8414. */var _default =
  8415. function _default(globalsConfig) {var config2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  8416. var method = config2.method || globalsConfig.method || 'GET';
  8417. var config = {
  8418. baseURL: globalsConfig.baseURL || '',
  8419. method: method,
  8420. url: config2.url || '',
  8421. params: config2.params || {},
  8422. custom: _objectSpread({}, globalsConfig.custom || {}, {}, config2.custom || {}),
  8423. header: (0, _utils.deepMerge)(globalsConfig.header || {}, config2.header || {}) };
  8424. var defaultToConfig2Keys = ['getTask', 'validateStatus'];
  8425. config = _objectSpread({}, config, {}, mergeKeys(defaultToConfig2Keys, globalsConfig, config2));
  8426. // eslint-disable-next-line no-empty
  8427. if (method === 'DOWNLOAD') {
  8428. } else if (method === 'UPLOAD') {
  8429. delete config.header['content-type'];
  8430. delete config.header['Content-Type'];
  8431. var uploadKeys = [
  8432. 'filePath',
  8433. 'name',
  8434. 'formData'];
  8435. uploadKeys.forEach(function (prop) {
  8436. if (typeof config2[prop] !== 'undefined') {
  8437. config[prop] = config2[prop];
  8438. }
  8439. });
  8440. } else {
  8441. var defaultsKeys = [
  8442. 'data',
  8443. 'timeout',
  8444. 'dataType',
  8445. 'responseType'];
  8446. config = _objectSpread({}, config, {}, mergeKeys(defaultsKeys, globalsConfig, config2));
  8447. }
  8448. return config;
  8449. };exports.default = _default;
  8450. /***/ }),
  8451. /* 26 */
  8452. /*!****************************************************************************!*\
  8453. !*** D:/wwwroot/HDhotel/js_sdk/luch-request/luch-request/core/defaults.js ***!
  8454. \****************************************************************************/
  8455. /*! no static exports found */
  8456. /***/ (function(module, exports, __webpack_require__) {
  8457. "use strict";
  8458. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; /**
  8459. * 默认的全局配置
  8460. */var _default =
  8461. {
  8462. baseURL: '',
  8463. header: {},
  8464. method: 'GET',
  8465. dataType: 'json',
  8466. responseType: 'text',
  8467. custom: {},
  8468. timeout: 30000,
  8469. validateStatus: function validateStatus(status) {
  8470. return status >= 200 && status < 300;
  8471. } };exports.default = _default;
  8472. /***/ }),
  8473. /* 27 */
  8474. /*!******************************************!*\
  8475. !*** D:/wwwroot/HDhotel/utils/filter.js ***!
  8476. \******************************************/
  8477. /*! no static exports found */
  8478. /***/ (function(module, exports, __webpack_require__) {
  8479. "use strict";
  8480. var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 2));
  8481. var _config = __webpack_require__(/*! @/config/config */ 11);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
  8482. //保留两位小数
  8483. _vue.default.filter('keepTwoNum', function (val) {
  8484. var value = Number(val);
  8485. return value.toFixed(2);
  8486. });
  8487. //链接加时间戳
  8488. _vue.default.filter("timestamp", function (link) {
  8489. return link + '?t=' + new Date().getTime();
  8490. });
  8491. /***/ }),
  8492. /* 28 */,
  8493. /* 29 */,
  8494. /* 30 */,
  8495. /* 31 */,
  8496. /* 32 */,
  8497. /* 33 */,
  8498. /* 34 */,
  8499. /* 35 */,
  8500. /* 36 */,
  8501. /* 37 */,
  8502. /* 38 */,
  8503. /* 39 */,
  8504. /* 40 */,
  8505. /* 41 */,
  8506. /* 42 */,
  8507. /* 43 */,
  8508. /* 44 */,
  8509. /* 45 */,
  8510. /* 46 */,
  8511. /* 47 */,
  8512. /* 48 */,
  8513. /* 49 */,
  8514. /* 50 */
  8515. /*!*********************************************************************!*\
  8516. !*** D:/wwwroot/HDhotel/components/mescroll-uni/mescroll-mixins.js ***!
  8517. \*********************************************************************/
  8518. /*! no static exports found */
  8519. /***/ (function(module, exports, __webpack_require__) {
  8520. "use strict";
  8521. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; // mescroll-body 和 mescroll-uni 通用
  8522. // import MescrollUni from "./mescroll-uni.vue";
  8523. // import MescrollBody from "./mescroll-body.vue";
  8524. var MescrollMixin = {
  8525. // components: { // 非H5端无法通过mixin注册组件, 只能在main.js中注册全局组件或具体界面中注册
  8526. // MescrollUni,
  8527. // MescrollBody
  8528. // },
  8529. data: function data() {
  8530. return {
  8531. mescroll: null //mescroll实例对象
  8532. };
  8533. },
  8534. // 注册系统自带的下拉刷新 (配置down.native为true时生效, 还需在pages配置enablePullDownRefresh:true;详请参考mescroll-native的案例)
  8535. onPullDownRefresh: function onPullDownRefresh() {
  8536. this.mescroll && this.mescroll.onPullDownRefresh();
  8537. },
  8538. // 注册列表滚动事件,用于判定在顶部可下拉刷新,在指定位置可显示隐藏回到顶部按钮 (此方法为页面生命周期,无法在子组件中触发, 仅在mescroll-body生效)
  8539. onPageScroll: function onPageScroll(e) {
  8540. this.mescroll && this.mescroll.onPageScroll(e);
  8541. },
  8542. // 注册滚动到底部的事件,用于上拉加载 (此方法为页面生命周期,无法在子组件中触发, 仅在mescroll-body生效)
  8543. onReachBottom: function onReachBottom() {
  8544. this.mescroll && this.mescroll.onReachBottom();
  8545. },
  8546. methods: {
  8547. // mescroll组件初始化的回调,可获取到mescroll对象
  8548. mescrollInit: function mescrollInit(mescroll) {
  8549. this.mescroll = mescroll;
  8550. this.mescrollInitByRef(); // 兼容字节跳动小程序
  8551. },
  8552. // 以ref的方式初始化mescroll对象 (兼容字节跳动小程序: http://www.mescroll.com/qa.html?v=20200107#q26)
  8553. mescrollInitByRef: function mescrollInitByRef() {
  8554. if (!this.mescroll || !this.mescroll.resetUpScroll) {
  8555. var mescrollRef = this.$refs.mescrollRef;
  8556. if (mescrollRef) this.mescroll = mescrollRef.mescroll;
  8557. }
  8558. },
  8559. // 下拉刷新的回调 (mixin默认resetUpScroll)
  8560. downCallback: function downCallback() {var _this = this;
  8561. if (this.mescroll.optUp.use) {
  8562. this.mescroll.resetUpScroll();
  8563. } else {
  8564. setTimeout(function () {
  8565. _this.mescroll.endSuccess();
  8566. }, 500);
  8567. }
  8568. },
  8569. // 上拉加载的回调
  8570. upCallback: function upCallback() {var _this2 = this;
  8571. // mixin默认延时500自动结束加载
  8572. setTimeout(function () {
  8573. _this2.mescroll.endErr();
  8574. }, 500);
  8575. } },
  8576. mounted: function mounted() {
  8577. this.mescrollInitByRef(); // 兼容字节跳动小程序, 避免未设置@init或@init此时未能取到ref的情况
  8578. } };var _default =
  8579. MescrollMixin;exports.default = _default;
  8580. /***/ }),
  8581. /* 51 */,
  8582. /* 52 */,
  8583. /* 53 */,
  8584. /* 54 */,
  8585. /* 55 */,
  8586. /* 56 */,
  8587. /* 57 */,
  8588. /* 58 */,
  8589. /* 59 */,
  8590. /* 60 */,
  8591. /* 61 */,
  8592. /* 62 */,
  8593. /* 63 */,
  8594. /* 64 */,
  8595. /* 65 */,
  8596. /* 66 */,
  8597. /* 67 */,
  8598. /* 68 */,
  8599. /* 69 */,
  8600. /* 70 */,
  8601. /* 71 */,
  8602. /* 72 */,
  8603. /* 73 */,
  8604. /* 74 */,
  8605. /* 75 */,
  8606. /* 76 */,
  8607. /* 77 */,
  8608. /* 78 */,
  8609. /* 79 */,
  8610. /* 80 */,
  8611. /* 81 */,
  8612. /* 82 */,
  8613. /* 83 */,
  8614. /* 84 */,
  8615. /* 85 */,
  8616. /* 86 */,
  8617. /* 87 */
  8618. /*!******************************************************************!*\
  8619. !*** D:/wwwroot/HDhotel/components/mescroll-uni/mescroll-uni.js ***!
  8620. \******************************************************************/
  8621. /*! no static exports found */
  8622. /***/ (function(module, exports, __webpack_require__) {
  8623. "use strict";
  8624. /* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.default = MeScroll; /* mescroll
  8625. * version 1.3.2
  8626. * 2020-08-05 wenju
  8627. * http://www.mescroll.com
  8628. */
  8629. function MeScroll(options, isScrollBody) {
  8630. var me = this;
  8631. me.version = '1.3.2'; // mescroll版本号
  8632. me.options = options || {}; // 配置
  8633. me.isScrollBody = isScrollBody || false; // 滚动区域是否为原生页面滚动; 默认为scroll-view
  8634. me.isDownScrolling = false; // 是否在执行下拉刷新的回调
  8635. me.isUpScrolling = false; // 是否在执行上拉加载的回调
  8636. var hasDownCallback = me.options.down && me.options.down.callback; // 是否配置了down的callback
  8637. // 初始化下拉刷新
  8638. me.initDownScroll();
  8639. // 初始化上拉加载,则初始化
  8640. me.initUpScroll();
  8641. // 自动加载
  8642. setTimeout(function () {// 待主线程执行完毕再执行,避免new MeScroll未初始化,在回调获取不到mescroll的实例
  8643. // 自动触发下拉刷新 (只有配置了down的callback才自动触发下拉刷新)
  8644. if ((me.optDown.use || me.optDown.native) && me.optDown.auto && hasDownCallback) {
  8645. if (me.optDown.autoShowLoading) {
  8646. me.triggerDownScroll(); // 显示下拉进度,执行下拉回调
  8647. } else {
  8648. me.optDown.callback && me.optDown.callback(me); // 不显示下拉进度,直接执行下拉回调
  8649. }
  8650. }
  8651. // 自动触发上拉加载
  8652. if (!me.isUpAutoLoad) {// 部分小程序(头条小程序)emit是异步, 会导致isUpAutoLoad判断有误, 先延时确保先执行down的callback,再执行up的callback
  8653. setTimeout(function () {
  8654. me.optUp.use && me.optUp.auto && !me.isUpAutoLoad && me.triggerUpScroll();
  8655. }, 100);
  8656. }
  8657. }, 30); // 需让me.optDown.inited和me.optUp.inited先执行
  8658. }
  8659. /* 配置参数:下拉刷新 */
  8660. MeScroll.prototype.extendDownScroll = function (optDown) {
  8661. // 下拉刷新的配置
  8662. MeScroll.extend(optDown, {
  8663. use: true, // 是否启用下拉刷新; 默认true
  8664. auto: true, // 是否在初始化完毕之后自动执行下拉刷新的回调; 默认true
  8665. native: false, // 是否使用系统自带的下拉刷新; 默认false; 仅mescroll-body生效 (值为true时,还需在pages配置enablePullDownRefresh:true;详请参考mescroll-native的案例)
  8666. autoShowLoading: false, // 如果设置auto=true(在初始化完毕之后自动执行下拉刷新的回调),那么是否显示下拉刷新的进度; 默认false
  8667. isLock: false, // 是否锁定下拉刷新,默认false;
  8668. offset: 80, // 在列表顶部,下拉大于80px,松手即可触发下拉刷新的回调
  8669. startTop: 100, // scroll-view快速滚动到顶部时,此时的scroll-top可能大于0, 此值用于控制最大的误差
  8670. inOffsetRate: 1, // 在列表顶部,下拉的距离小于offset时,改变下拉区域高度比例;值小于1且越接近0,高度变化越小,表现为越往下越难拉
  8671. outOffsetRate: 0.2, // 在列表顶部,下拉的距离大于offset时,改变下拉区域高度比例;值小于1且越接近0,高度变化越小,表现为越往下越难拉
  8672. bottomOffset: 20, // 当手指touchmove位置在距离body底部20px范围内的时候结束上拉刷新,避免Webview嵌套导致touchend事件不执行
  8673. minAngle: 45, // 向下滑动最少偏移的角度,取值区间 [0,90];默认45度,即向下滑动的角度大于45度则触发下拉;而小于45度,将不触发下拉,避免与左右滑动的轮播等组件冲突;
  8674. textInOffset: '下拉刷新', // 下拉的距离在offset范围内的提示文本
  8675. textOutOffset: '释放更新', // 下拉的距离大于offset范围的提示文本
  8676. textLoading: '加载中 ...', // 加载中的提示文本
  8677. bgColor: "transparent", // 背景颜色 (建议在pages.json中再设置一下backgroundColorTop)
  8678. textColor: "gray", // 文本颜色 (当bgColor配置了颜色,而textColor未配置时,则textColor会默认为白色)
  8679. inited: null, // 下拉刷新初始化完毕的回调
  8680. inOffset: null, // 下拉的距离进入offset范围内那一刻的回调
  8681. outOffset: null, // 下拉的距离大于offset那一刻的回调
  8682. onMoving: null, // 下拉过程中的回调,滑动过程一直在执行; rate下拉区域当前高度与指定距离的比值(inOffset: rate<1; outOffset: rate>=1); downHight当前下拉区域的高度
  8683. beforeLoading: null, // 准备触发下拉刷新的回调: 如果return true,将不触发showLoading和callback回调; 常用来完全自定义下拉刷新, 参考案例【淘宝 v6.8.0】
  8684. showLoading: null, // 显示下拉刷新进度的回调
  8685. afterLoading: null, // 显示下拉刷新进度的回调之后,马上要执行的代码 (如: 在wxs中使用)
  8686. beforeEndDownScroll: null, // 准备结束下拉的回调. 返回结束下拉的延时执行时间,默认0ms; 常用于结束下拉之前再显示另外一小段动画,才去隐藏下拉刷新的场景, 参考案例【dotJump】
  8687. endDownScroll: null, // 结束下拉刷新的回调
  8688. afterEndDownScroll: null, // 结束下拉刷新的回调,马上要执行的代码 (如: 在wxs中使用)
  8689. callback: function callback(mescroll) {
  8690. // 下拉刷新的回调;默认重置上拉加载列表为第一页
  8691. mescroll.resetUpScroll();
  8692. } });
  8693. };
  8694. /* 配置参数:上拉加载 */
  8695. MeScroll.prototype.extendUpScroll = function (optUp) {
  8696. // 上拉加载的配置
  8697. MeScroll.extend(optUp, {
  8698. use: true, // 是否启用上拉加载; 默认true
  8699. auto: true, // 是否在初始化完毕之后自动执行上拉加载的回调; 默认true
  8700. isLock: false, // 是否锁定上拉加载,默认false;
  8701. isBoth: true, // 上拉加载时,如果滑动到列表顶部是否可以同时触发下拉刷新;默认true,两者可同时触发;
  8702. callback: null, // 上拉加载的回调;function(page,mescroll){ }
  8703. page: {
  8704. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  8705. size: 10, // 每页数据的数量
  8706. time: null // 加载第一页数据服务器返回的时间; 防止用户翻页时,后台新增了数据从而导致下一页数据重复;
  8707. },
  8708. noMoreSize: 5, // 如果列表已无数据,可设置列表的总数量要大于等于5条才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看
  8709. offset: 80, // 距底部多远时,触发upCallback
  8710. textLoading: '加载中 ...', // 加载中的提示文本
  8711. textNoMore: '-- END --', // 没有更多数据的提示文本
  8712. bgColor: "transparent", // 背景颜色 (建议在pages.json中再设置一下backgroundColorBottom)
  8713. textColor: "gray", // 文本颜色 (当bgColor配置了颜色,而textColor未配置时,则textColor会默认为白色)
  8714. inited: null, // 初始化完毕的回调
  8715. showLoading: null, // 显示加载中的回调
  8716. showNoMore: null, // 显示无更多数据的回调
  8717. hideUpScroll: null, // 隐藏上拉加载的回调
  8718. errDistance: 60, // endErr的时候需往上滑动一段距离,使其往下滑动时再次触发onReachBottom,仅mescroll-body生效
  8719. toTop: {
  8720. // 回到顶部按钮,需配置src才显示
  8721. src: null, // 图片路径,默认null (绝对路径或网络图)
  8722. offset: 1000, // 列表滚动多少距离才显示回到顶部按钮,默认1000
  8723. duration: 300, // 回到顶部的动画时长,默认300ms (当值为0或300则使用系统自带回到顶部,更流畅; 其他值则通过step模拟,部分机型可能不够流畅,所以非特殊情况不建议修改此项)
  8724. btnClick: null, // 点击按钮的回调
  8725. onShow: null, // 是否显示的回调
  8726. zIndex: 9990, // fixed定位z-index值
  8727. left: null, // 到左边的距离, 默认null. 此项有值时,right不生效. (支持20, "20rpx", "20px", "20%"格式的值, 其中纯数字则默认单位rpx)
  8728. right: 20, // 到右边的距离, 默认20 (支持20, "20rpx", "20px", "20%"格式的值, 其中纯数字则默认单位rpx)
  8729. bottom: 120, // 到底部的距离, 默认120 (支持20, "20rpx", "20px", "20%"格式的值, 其中纯数字则默认单位rpx)
  8730. safearea: false, // bottom的偏移量是否加上底部安全区的距离, 默认false, 需要适配iPhoneX时使用 (具体的界面如果不配置此项,则取本vue的safearea值)
  8731. width: 72, // 回到顶部图标的宽度, 默认72 (支持20, "20rpx", "20px", "20%"格式的值, 其中纯数字则默认单位rpx)
  8732. radius: "50%" // 圆角, 默认"50%" (支持20, "20rpx", "20px", "20%"格式的值, 其中纯数字则默认单位rpx)
  8733. },
  8734. empty: {
  8735. use: true, // 是否显示空布局
  8736. icon: null, // 图标路径
  8737. tip: '~ 暂无相关数据 ~', // 提示
  8738. btnText: '', // 按钮
  8739. btnClick: null, // 点击按钮的回调
  8740. onShow: null, // 是否显示的回调
  8741. fixed: false, // 是否使用fixed定位,默认false; 配置fixed为true,以下的top和zIndex才生效 (transform会使fixed失效,最终会降级为absolute)
  8742. top: "100rpx", // fixed定位的top值 (完整的单位值,如 "10%"; "100rpx")
  8743. zIndex: 99 // fixed定位z-index值
  8744. },
  8745. onScroll: false // 是否监听滚动事件
  8746. });
  8747. };
  8748. /* 配置参数 */
  8749. MeScroll.extend = function (userOption, defaultOption) {
  8750. if (!userOption) return defaultOption;
  8751. for (var key in defaultOption) {
  8752. if (userOption[key] == null) {
  8753. var def = defaultOption[key];
  8754. if (def != null && typeof def === 'object') {
  8755. userOption[key] = MeScroll.extend({}, def); // 深度匹配
  8756. } else {
  8757. userOption[key] = def;
  8758. }
  8759. } else if (typeof userOption[key] === 'object') {
  8760. MeScroll.extend(userOption[key], defaultOption[key]); // 深度匹配
  8761. }
  8762. }
  8763. return userOption;
  8764. };
  8765. /* 简单判断是否配置了颜色 (非透明,非白色) */
  8766. MeScroll.prototype.hasColor = function (color) {
  8767. if (!color) return false;
  8768. var c = color.toLowerCase();
  8769. return c != "#fff" && c != "#ffffff" && c != "transparent" && c != "white";
  8770. };
  8771. /* -------初始化下拉刷新------- */
  8772. MeScroll.prototype.initDownScroll = function () {
  8773. var me = this;
  8774. // 配置参数
  8775. me.optDown = me.options.down || {};
  8776. if (!me.optDown.textColor && me.hasColor(me.optDown.bgColor)) me.optDown.textColor = "#fff"; // 当bgColor有值且textColor未设置,则textColor默认白色
  8777. me.extendDownScroll(me.optDown);
  8778. // 如果是mescroll-body且配置了native,则禁止自定义的下拉刷新
  8779. if (me.isScrollBody && me.optDown.native) {
  8780. me.optDown.use = false;
  8781. } else {
  8782. me.optDown.native = false; // 仅mescroll-body支持,mescroll-uni不支持
  8783. }
  8784. me.downHight = 0; // 下拉区域的高度
  8785. // 在页面中加入下拉布局
  8786. if (me.optDown.use && me.optDown.inited) {
  8787. // 初始化完毕的回调
  8788. setTimeout(function () {// 待主线程执行完毕再执行,避免new MeScroll未初始化,在回调获取不到mescroll的实例
  8789. me.optDown.inited(me);
  8790. }, 0);
  8791. }
  8792. };
  8793. /* 列表touchstart事件 */
  8794. MeScroll.prototype.touchstartEvent = function (e) {
  8795. if (!this.optDown.use) return;
  8796. this.startPoint = this.getPoint(e); // 记录起点
  8797. this.startTop = this.getScrollTop(); // 记录此时的滚动条位置
  8798. this.startAngle = 0; // 初始角度
  8799. this.lastPoint = this.startPoint; // 重置上次move的点
  8800. this.maxTouchmoveY = this.getBodyHeight() - this.optDown.bottomOffset; // 手指触摸的最大范围(写在touchstart避免body获取高度为0的情况)
  8801. this.inTouchend = false; // 标记不是touchend
  8802. };
  8803. /* 列表touchmove事件 */
  8804. MeScroll.prototype.touchmoveEvent = function (e) {
  8805. if (!this.optDown.use) return;
  8806. var me = this;
  8807. var scrollTop = me.getScrollTop(); // 当前滚动条的距离
  8808. var curPoint = me.getPoint(e); // 当前点
  8809. var moveY = curPoint.y - me.startPoint.y; // 和起点比,移动的距离,大于0向下拉,小于0向上拉
  8810. // 向下拉 && 在顶部
  8811. // mescroll-body,直接判定在顶部即可
  8812. // scroll-view在滚动时不会触发touchmove,当触顶/底/左/右时,才会触发touchmove
  8813. // scroll-view滚动到顶部时,scrollTop不一定为0,也有可能大于0; 在iOS的APP中scrollTop可能为负数,不一定和startTop相等
  8814. if (moveY > 0 && (
  8815. me.isScrollBody && scrollTop <= 0 ||
  8816. !me.isScrollBody && (scrollTop <= 0 || scrollTop <= me.optDown.startTop && scrollTop === me.startTop)))
  8817. {
  8818. // 可下拉的条件
  8819. if (!me.inTouchend && !me.isDownScrolling && !me.optDown.isLock && (!me.isUpScrolling || me.isUpScrolling &&
  8820. me.optUp.isBoth)) {
  8821. // 下拉的初始角度是否在配置的范围内
  8822. if (!me.startAngle) me.startAngle = me.getAngle(me.lastPoint, curPoint); // 两点之间的角度,区间 [0,90]
  8823. if (me.startAngle < me.optDown.minAngle) return; // 如果小于配置的角度,则不往下执行下拉刷新
  8824. // 如果手指的位置超过配置的距离,则提前结束下拉,避免Webview嵌套导致touchend无法触发
  8825. if (me.maxTouchmoveY > 0 && curPoint.y >= me.maxTouchmoveY) {
  8826. me.inTouchend = true; // 标记执行touchend
  8827. me.touchendEvent(); // 提前触发touchend
  8828. return;
  8829. }
  8830. me.preventDefault(e); // 阻止默认事件
  8831. var diff = curPoint.y - me.lastPoint.y; // 和上次比,移动的距离 (大于0向下,小于0向上)
  8832. // 下拉距离 < 指定距离
  8833. if (me.downHight < me.optDown.offset) {
  8834. if (me.movetype !== 1) {
  8835. me.movetype = 1; // 加入标记,保证只执行一次
  8836. me.optDown.inOffset && me.optDown.inOffset(me); // 进入指定距离范围内那一刻的回调,只执行一次
  8837. me.isMoveDown = true; // 标记下拉区域高度改变,在touchend重置回来
  8838. }
  8839. me.downHight += diff * me.optDown.inOffsetRate; // 越往下,高度变化越小
  8840. // 指定距离 <= 下拉距离
  8841. } else {
  8842. if (me.movetype !== 2) {
  8843. me.movetype = 2; // 加入标记,保证只执行一次
  8844. me.optDown.outOffset && me.optDown.outOffset(me); // 下拉超过指定距离那一刻的回调,只执行一次
  8845. me.isMoveDown = true; // 标记下拉区域高度改变,在touchend重置回来
  8846. }
  8847. if (diff > 0) {// 向下拉
  8848. me.downHight += diff * me.optDown.outOffsetRate; // 越往下,高度变化越小
  8849. } else {// 向上收
  8850. me.downHight += diff; // 向上收回高度,则向上滑多少收多少高度
  8851. }
  8852. }
  8853. me.downHight = Math.round(me.downHight); // 取整
  8854. var rate = me.downHight / me.optDown.offset; // 下拉区域当前高度与指定距离的比值
  8855. me.optDown.onMoving && me.optDown.onMoving(me, rate, me.downHight); // 下拉过程中的回调,一直在执行
  8856. }
  8857. }
  8858. me.lastPoint = curPoint; // 记录本次移动的点
  8859. };
  8860. /* 列表touchend事件 */
  8861. MeScroll.prototype.touchendEvent = function (e) {
  8862. if (!this.optDown.use) return;
  8863. // 如果下拉区域高度已改变,则需重置回来
  8864. if (this.isMoveDown) {
  8865. if (this.downHight >= this.optDown.offset) {
  8866. // 符合触发刷新的条件
  8867. this.triggerDownScroll();
  8868. } else {
  8869. // 不符合的话 则重置
  8870. this.downHight = 0;
  8871. this.endDownScrollCall(this);
  8872. }
  8873. this.movetype = 0;
  8874. this.isMoveDown = false;
  8875. } else if (!this.isScrollBody && this.getScrollTop() === this.startTop) {// scroll-view到顶/左/右/底的滑动事件
  8876. var isScrollUp = this.getPoint(e).y - this.startPoint.y < 0; // 和起点比,移动的距离,大于0向下拉,小于0向上拉
  8877. // 上滑
  8878. if (isScrollUp) {
  8879. // 需检查滑动的角度
  8880. var angle = this.getAngle(this.getPoint(e), this.startPoint); // 两点之间的角度,区间 [0,90]
  8881. if (angle > 80) {
  8882. // 检查并触发上拉
  8883. this.triggerUpScroll(true);
  8884. }
  8885. }
  8886. }
  8887. };
  8888. /* 根据点击滑动事件获取第一个手指的坐标 */
  8889. MeScroll.prototype.getPoint = function (e) {
  8890. if (!e) {
  8891. return {
  8892. x: 0,
  8893. y: 0 };
  8894. }
  8895. if (e.touches && e.touches[0]) {
  8896. return {
  8897. x: e.touches[0].pageX,
  8898. y: e.touches[0].pageY };
  8899. } else if (e.changedTouches && e.changedTouches[0]) {
  8900. return {
  8901. x: e.changedTouches[0].pageX,
  8902. y: e.changedTouches[0].pageY };
  8903. } else {
  8904. return {
  8905. x: e.clientX,
  8906. y: e.clientY };
  8907. }
  8908. };
  8909. /* 计算两点之间的角度: 区间 [0,90]*/
  8910. MeScroll.prototype.getAngle = function (p1, p2) {
  8911. var x = Math.abs(p1.x - p2.x);
  8912. var y = Math.abs(p1.y - p2.y);
  8913. var z = Math.sqrt(x * x + y * y);
  8914. var angle = 0;
  8915. if (z !== 0) {
  8916. angle = Math.asin(y / z) / Math.PI * 180;
  8917. }
  8918. return angle;
  8919. };
  8920. /* 触发下拉刷新 */
  8921. MeScroll.prototype.triggerDownScroll = function () {
  8922. if (this.optDown.beforeLoading && this.optDown.beforeLoading(this)) {
  8923. //return true则处于完全自定义状态
  8924. } else {
  8925. this.showDownScroll(); // 下拉刷新中...
  8926. !this.optDown.native && this.optDown.callback && this.optDown.callback(this); // 执行回调,联网加载数据
  8927. }
  8928. };
  8929. /* 显示下拉进度布局 */
  8930. MeScroll.prototype.showDownScroll = function () {
  8931. this.isDownScrolling = true; // 标记下拉中
  8932. if (this.optDown.native) {
  8933. uni.startPullDownRefresh(); // 系统自带的下拉刷新
  8934. this.showDownLoadingCall(0); // 仍触发showLoading,因为上拉加载用到
  8935. } else {
  8936. this.downHight = this.optDown.offset; // 更新下拉区域高度
  8937. this.showDownLoadingCall(this.downHight); // 下拉刷新中...
  8938. }
  8939. };
  8940. MeScroll.prototype.showDownLoadingCall = function (downHight) {
  8941. this.optDown.showLoading && this.optDown.showLoading(this, downHight); // 下拉刷新中...
  8942. this.optDown.afterLoading && this.optDown.afterLoading(this, downHight); // 下拉刷新中...触发之后马上要执行的代码
  8943. };
  8944. /* 显示系统自带的下拉刷新时需要处理的业务 */
  8945. MeScroll.prototype.onPullDownRefresh = function () {
  8946. this.isDownScrolling = true; // 标记下拉中
  8947. this.showDownLoadingCall(0); // 仍触发showLoading,因为上拉加载用到
  8948. this.optDown.callback && this.optDown.callback(this); // 执行回调,联网加载数据
  8949. };
  8950. /* 结束下拉刷新 */
  8951. MeScroll.prototype.endDownScroll = function () {
  8952. if (this.optDown.native) {// 结束原生下拉刷新
  8953. this.isDownScrolling = false;
  8954. this.endDownScrollCall(this);
  8955. uni.stopPullDownRefresh();
  8956. return;
  8957. }
  8958. var me = this;
  8959. // 结束下拉刷新的方法
  8960. var endScroll = function endScroll() {
  8961. me.downHight = 0;
  8962. me.isDownScrolling = false;
  8963. me.endDownScrollCall(me);
  8964. if (!me.isScrollBody) {
  8965. me.setScrollHeight(0); // scroll-view重置滚动区域,使数据不满屏时仍可检查触发翻页
  8966. me.scrollTo(0, 0); // scroll-view需重置滚动条到顶部,避免startTop大于0时,对下拉刷新的影响
  8967. }
  8968. };
  8969. // 结束下拉刷新时的回调
  8970. var delay = 0;
  8971. if (me.optDown.beforeEndDownScroll) delay = me.optDown.beforeEndDownScroll(me); // 结束下拉刷新的延时,单位ms
  8972. if (typeof delay === 'number' && delay > 0) {
  8973. setTimeout(endScroll, delay);
  8974. } else {
  8975. endScroll();
  8976. }
  8977. };
  8978. MeScroll.prototype.endDownScrollCall = function () {
  8979. this.optDown.endDownScroll && this.optDown.endDownScroll(this);
  8980. this.optDown.afterEndDownScroll && this.optDown.afterEndDownScroll(this);
  8981. };
  8982. /* 锁定下拉刷新:isLock=ture,null锁定;isLock=false解锁 */
  8983. MeScroll.prototype.lockDownScroll = function (isLock) {
  8984. if (isLock == null) isLock = true;
  8985. this.optDown.isLock = isLock;
  8986. };
  8987. /* 锁定上拉加载:isLock=ture,null锁定;isLock=false解锁 */
  8988. MeScroll.prototype.lockUpScroll = function (isLock) {
  8989. if (isLock == null) isLock = true;
  8990. this.optUp.isLock = isLock;
  8991. };
  8992. /* -------初始化上拉加载------- */
  8993. MeScroll.prototype.initUpScroll = function () {
  8994. var me = this;
  8995. // 配置参数
  8996. me.optUp = me.options.up || { use: false };
  8997. if (!me.optUp.textColor && me.hasColor(me.optUp.bgColor)) me.optUp.textColor = "#fff"; // 当bgColor有值且textColor未设置,则textColor默认白色
  8998. me.extendUpScroll(me.optUp);
  8999. if (me.optUp.use === false) return; // 配置不使用上拉加载时,则不初始化上拉布局
  9000. me.optUp.hasNext = true; // 如果使用上拉,则默认有下一页
  9001. me.startNum = me.optUp.page.num + 1; // 记录page开始的页码
  9002. // 初始化完毕的回调
  9003. if (me.optUp.inited) {
  9004. setTimeout(function () {// 待主线程执行完毕再执行,避免new MeScroll未初始化,在回调获取不到mescroll的实例
  9005. me.optUp.inited(me);
  9006. }, 0);
  9007. }
  9008. };
  9009. /*滚动到底部的事件 (仅mescroll-body生效)*/
  9010. MeScroll.prototype.onReachBottom = function () {
  9011. if (this.isScrollBody && !this.isUpScrolling) {// 只能支持下拉刷新的时候同时可以触发上拉加载,否则滚动到底部就需要上滑一点才能触发onReachBottom
  9012. if (!this.optUp.isLock && this.optUp.hasNext) {
  9013. this.triggerUpScroll();
  9014. }
  9015. }
  9016. };
  9017. /*列表滚动事件 (仅mescroll-body生效)*/
  9018. MeScroll.prototype.onPageScroll = function (e) {
  9019. if (!this.isScrollBody) return;
  9020. // 更新滚动条的位置 (主要用于判断下拉刷新时,滚动条是否在顶部)
  9021. this.setScrollTop(e.scrollTop);
  9022. // 顶部按钮的显示隐藏
  9023. if (e.scrollTop >= this.optUp.toTop.offset) {
  9024. this.showTopBtn();
  9025. } else {
  9026. this.hideTopBtn();
  9027. }
  9028. };
  9029. /*列表滚动事件*/
  9030. MeScroll.prototype.scroll = function (e, onScroll) {
  9031. // 更新滚动条的位置
  9032. this.setScrollTop(e.scrollTop);
  9033. // 更新滚动内容高度
  9034. this.setScrollHeight(e.scrollHeight);
  9035. // 向上滑还是向下滑动
  9036. if (this.preScrollY == null) this.preScrollY = 0;
  9037. this.isScrollUp = e.scrollTop - this.preScrollY > 0;
  9038. this.preScrollY = e.scrollTop;
  9039. // 上滑 && 检查并触发上拉
  9040. this.isScrollUp && this.triggerUpScroll(true);
  9041. // 顶部按钮的显示隐藏
  9042. if (e.scrollTop >= this.optUp.toTop.offset) {
  9043. this.showTopBtn();
  9044. } else {
  9045. this.hideTopBtn();
  9046. }
  9047. // 滑动监听
  9048. this.optUp.onScroll && onScroll && onScroll();
  9049. };
  9050. /* 触发上拉加载 */
  9051. MeScroll.prototype.triggerUpScroll = function (isCheck) {
  9052. if (!this.isUpScrolling && this.optUp.use && this.optUp.callback) {
  9053. // 是否校验在底部; 默认不校验
  9054. if (isCheck === true) {
  9055. var canUp = false;
  9056. // 还有下一页 && 没有锁定 && 不在下拉中
  9057. if (this.optUp.hasNext && !this.optUp.isLock && !this.isDownScrolling) {
  9058. if (this.getScrollBottom() <= this.optUp.offset) {// 到底部
  9059. canUp = true; // 标记可上拉
  9060. }
  9061. }
  9062. if (canUp === false) return;
  9063. }
  9064. this.showUpScroll(); // 上拉加载中...
  9065. this.optUp.page.num++; // 预先加一页,如果失败则减回
  9066. this.isUpAutoLoad = true; // 标记上拉已经自动执行过,避免初始化时多次触发上拉回调
  9067. this.num = this.optUp.page.num; // 把最新的页数赋值在mescroll上,避免对page的影响
  9068. this.size = this.optUp.page.size; // 把最新的页码赋值在mescroll上,避免对page的影响
  9069. this.time = this.optUp.page.time; // 把最新的页码赋值在mescroll上,避免对page的影响
  9070. this.optUp.callback(this); // 执行回调,联网加载数据
  9071. }
  9072. };
  9073. /* 显示上拉加载中 */
  9074. MeScroll.prototype.showUpScroll = function () {
  9075. this.isUpScrolling = true; // 标记上拉加载中
  9076. this.optUp.showLoading && this.optUp.showLoading(this); // 回调
  9077. };
  9078. /* 显示上拉无更多数据 */
  9079. MeScroll.prototype.showNoMore = function () {
  9080. this.optUp.hasNext = false; // 标记无更多数据
  9081. this.optUp.showNoMore && this.optUp.showNoMore(this); // 回调
  9082. };
  9083. /* 隐藏上拉区域**/
  9084. MeScroll.prototype.hideUpScroll = function () {
  9085. this.optUp.hideUpScroll && this.optUp.hideUpScroll(this); // 回调
  9086. };
  9087. /* 结束上拉加载 */
  9088. MeScroll.prototype.endUpScroll = function (isShowNoMore) {
  9089. if (isShowNoMore != null) {// isShowNoMore=null,不处理下拉状态,下拉刷新的时候调用
  9090. if (isShowNoMore) {
  9091. this.showNoMore(); // isShowNoMore=true,显示无更多数据
  9092. } else {
  9093. this.hideUpScroll(); // isShowNoMore=false,隐藏上拉加载
  9094. }
  9095. }
  9096. this.isUpScrolling = false; // 标记结束上拉加载
  9097. };
  9098. /* 重置上拉加载列表为第一页
  9099. *isShowLoading 是否显示进度布局;
  9100. * 1.默认null,不传参,则显示上拉加载的进度布局
  9101. * 2.传参true, 则显示下拉刷新的进度布局
  9102. * 3.传参false,则不显示上拉和下拉的进度 (常用于静默更新列表数据)
  9103. */
  9104. MeScroll.prototype.resetUpScroll = function (isShowLoading) {
  9105. if (this.optUp && this.optUp.use) {
  9106. var page = this.optUp.page;
  9107. this.prePageNum = page.num; // 缓存重置前的页码,加载失败可退回
  9108. this.prePageTime = page.time; // 缓存重置前的时间,加载失败可退回
  9109. page.num = this.startNum; // 重置为第一页
  9110. page.time = null; // 重置时间为空
  9111. if (!this.isDownScrolling && isShowLoading !== false) {// 如果不是下拉刷新触发的resetUpScroll并且不配置列表静默更新,则显示进度;
  9112. if (isShowLoading == null) {
  9113. this.removeEmpty(); // 移除空布局
  9114. this.showUpScroll(); // 不传参,默认显示上拉加载的进度布局
  9115. } else {
  9116. this.showDownScroll(); // 传true,显示下拉刷新的进度布局,不清空列表
  9117. }
  9118. }
  9119. this.isUpAutoLoad = true; // 标记上拉已经自动执行过,避免初始化时多次触发上拉回调
  9120. this.num = page.num; // 把最新的页数赋值在mescroll上,避免对page的影响
  9121. this.size = page.size; // 把最新的页码赋值在mescroll上,避免对page的影响
  9122. this.time = page.time; // 把最新的页码赋值在mescroll上,避免对page的影响
  9123. this.optUp.callback && this.optUp.callback(this); // 执行上拉回调
  9124. }
  9125. };
  9126. /* 设置page.num的值 */
  9127. MeScroll.prototype.setPageNum = function (num) {
  9128. this.optUp.page.num = num - 1;
  9129. };
  9130. /* 设置page.size的值 */
  9131. MeScroll.prototype.setPageSize = function (size) {
  9132. this.optUp.page.size = size;
  9133. };
  9134. /* 联网回调成功,结束下拉刷新和上拉加载
  9135. * dataSize: 当前页的数据量(必传)
  9136. * totalPage: 总页数(必传)
  9137. * systime: 服务器时间 (可空)
  9138. */
  9139. MeScroll.prototype.endByPage = function (dataSize, totalPage, systime) {
  9140. var hasNext;
  9141. if (this.optUp.use && totalPage != null) hasNext = this.optUp.page.num < totalPage; // 是否还有下一页
  9142. this.endSuccess(dataSize, hasNext, systime);
  9143. };
  9144. /* 联网回调成功,结束下拉刷新和上拉加载
  9145. * dataSize: 当前页的数据量(必传)
  9146. * totalSize: 列表所有数据总数量(必传)
  9147. * systime: 服务器时间 (可空)
  9148. */
  9149. MeScroll.prototype.endBySize = function (dataSize, totalSize, systime) {
  9150. var hasNext;
  9151. if (this.optUp.use && totalSize != null) {
  9152. var loadSize = (this.optUp.page.num - 1) * this.optUp.page.size + dataSize; // 已加载的数据总数
  9153. hasNext = loadSize < totalSize; // 是否还有下一页
  9154. }
  9155. this.endSuccess(dataSize, hasNext, systime);
  9156. };
  9157. /* 联网回调成功,结束下拉刷新和上拉加载
  9158. * dataSize: 当前页的数据个数(不是所有页的数据总和),用于上拉加载判断是否还有下一页.如果不传,则会判断还有下一页
  9159. * hasNext: 是否还有下一页,布尔类型;用来解决这个小问题:比如列表共有20条数据,每页加载10条,共2页.如果只根据dataSize判断,则需翻到第三页才会知道无更多数据,如果传了hasNext,则翻到第二页即可显示无更多数据.
  9160. * systime: 服务器时间(可空);用来解决这个小问题:当准备翻下一页时,数据库新增了几条记录,此时翻下一页,前面的几条数据会和上一页的重复;这里传入了systime,那么upCallback的page.time就会有值,把page.time传给服务器,让后台过滤新加入的那几条记录
  9161. */
  9162. MeScroll.prototype.endSuccess = function (dataSize, hasNext, systime) {
  9163. var me = this;
  9164. // 结束下拉刷新
  9165. if (me.isDownScrolling) me.endDownScroll();
  9166. // 结束上拉加载
  9167. if (me.optUp.use) {
  9168. var isShowNoMore; // 是否已无更多数据
  9169. if (dataSize != null) {
  9170. var pageNum = me.optUp.page.num; // 当前页码
  9171. var pageSize = me.optUp.page.size; // 每页长度
  9172. // 如果是第一页
  9173. if (pageNum === 1) {
  9174. if (systime) me.optUp.page.time = systime; // 设置加载列表数据第一页的时间
  9175. }
  9176. if (dataSize < pageSize || hasNext === false) {
  9177. // 返回的数据不满一页时,则说明已无更多数据
  9178. me.optUp.hasNext = false;
  9179. if (dataSize === 0 && pageNum === 1) {
  9180. // 如果第一页无任何数据且配置了空布局
  9181. isShowNoMore = false;
  9182. me.showEmpty();
  9183. } else {
  9184. // 总列表数少于配置的数量,则不显示无更多数据
  9185. var allDataSize = (pageNum - 1) * pageSize + dataSize;
  9186. if (allDataSize < me.optUp.noMoreSize) {
  9187. isShowNoMore = false;
  9188. } else {
  9189. isShowNoMore = true;
  9190. }
  9191. me.removeEmpty(); // 移除空布局
  9192. }
  9193. } else {
  9194. // 还有下一页
  9195. isShowNoMore = false;
  9196. me.optUp.hasNext = true;
  9197. me.removeEmpty(); // 移除空布局
  9198. }
  9199. }
  9200. // 隐藏上拉
  9201. me.endUpScroll(isShowNoMore);
  9202. }
  9203. };
  9204. /* 回调失败,结束下拉刷新和上拉加载 */
  9205. MeScroll.prototype.endErr = function (errDistance) {
  9206. // 结束下拉,回调失败重置回原来的页码和时间
  9207. if (this.isDownScrolling) {
  9208. var page = this.optUp.page;
  9209. if (page && this.prePageNum) {
  9210. page.num = this.prePageNum;
  9211. page.time = this.prePageTime;
  9212. }
  9213. this.endDownScroll();
  9214. }
  9215. // 结束上拉,回调失败重置回原来的页码
  9216. if (this.isUpScrolling) {
  9217. this.optUp.page.num--;
  9218. this.endUpScroll(false);
  9219. // 如果是mescroll-body,则需往回滚一定距离
  9220. if (this.isScrollBody && errDistance !== 0) {// 不处理0
  9221. if (!errDistance) errDistance = this.optUp.errDistance; // 不传,则取默认
  9222. this.scrollTo(this.getScrollTop() - errDistance, 0); // 往上回滚的距离
  9223. }
  9224. }
  9225. };
  9226. /* 显示空布局 */
  9227. MeScroll.prototype.showEmpty = function () {
  9228. this.optUp.empty.use && this.optUp.empty.onShow && this.optUp.empty.onShow(true);
  9229. };
  9230. /* 移除空布局 */
  9231. MeScroll.prototype.removeEmpty = function () {
  9232. this.optUp.empty.use && this.optUp.empty.onShow && this.optUp.empty.onShow(false);
  9233. };
  9234. /* 显示回到顶部的按钮 */
  9235. MeScroll.prototype.showTopBtn = function () {
  9236. if (!this.topBtnShow) {
  9237. this.topBtnShow = true;
  9238. this.optUp.toTop.onShow && this.optUp.toTop.onShow(true);
  9239. }
  9240. };
  9241. /* 隐藏回到顶部的按钮 */
  9242. MeScroll.prototype.hideTopBtn = function () {
  9243. if (this.topBtnShow) {
  9244. this.topBtnShow = false;
  9245. this.optUp.toTop.onShow && this.optUp.toTop.onShow(false);
  9246. }
  9247. };
  9248. /* 获取滚动条的位置 */
  9249. MeScroll.prototype.getScrollTop = function () {
  9250. return this.scrollTop || 0;
  9251. };
  9252. /* 记录滚动条的位置 */
  9253. MeScroll.prototype.setScrollTop = function (y) {
  9254. this.scrollTop = y;
  9255. };
  9256. /* 滚动到指定位置 */
  9257. MeScroll.prototype.scrollTo = function (y, t) {
  9258. this.myScrollTo && this.myScrollTo(y, t); // scrollview需自定义回到顶部方法
  9259. };
  9260. /* 自定义scrollTo */
  9261. MeScroll.prototype.resetScrollTo = function (myScrollTo) {
  9262. this.myScrollTo = myScrollTo;
  9263. };
  9264. /* 滚动条到底部的距离 */
  9265. MeScroll.prototype.getScrollBottom = function () {
  9266. return this.getScrollHeight() - this.getClientHeight() - this.getScrollTop();
  9267. };
  9268. /* 计步器
  9269. star: 开始值
  9270. end: 结束值
  9271. callback(step,timer): 回调step值,计步器timer,可自行通过window.clearInterval(timer)结束计步器;
  9272. t: 计步时长,传0则直接回调end值;不传则默认300ms
  9273. rate: 周期;不传则默认30ms计步一次
  9274. * */
  9275. MeScroll.prototype.getStep = function (star, end, callback, t, rate) {
  9276. var diff = end - star; // 差值
  9277. if (t === 0 || diff === 0) {
  9278. callback && callback(end);
  9279. return;
  9280. }
  9281. t = t || 300; // 时长 300ms
  9282. rate = rate || 30; // 周期 30ms
  9283. var count = t / rate; // 次数
  9284. var step = diff / count; // 步长
  9285. var i = 0; // 计数
  9286. var timer = setInterval(function () {
  9287. if (i < count - 1) {
  9288. star += step;
  9289. callback && callback(star, timer);
  9290. i++;
  9291. } else {
  9292. callback && callback(end, timer); // 最后一次直接设置end,避免计算误差
  9293. clearInterval(timer);
  9294. }
  9295. }, rate);
  9296. };
  9297. /* 滚动容器的高度 */
  9298. MeScroll.prototype.getClientHeight = function (isReal) {
  9299. var h = this.clientHeight || 0;
  9300. if (h === 0 && isReal !== true) {// 未获取到容器的高度,可临时取body的高度 (可能会有误差)
  9301. h = this.getBodyHeight();
  9302. }
  9303. return h;
  9304. };
  9305. MeScroll.prototype.setClientHeight = function (h) {
  9306. this.clientHeight = h;
  9307. };
  9308. /* 滚动内容的高度 */
  9309. MeScroll.prototype.getScrollHeight = function () {
  9310. return this.scrollHeight || 0;
  9311. };
  9312. MeScroll.prototype.setScrollHeight = function (h) {
  9313. this.scrollHeight = h;
  9314. };
  9315. /* body的高度 */
  9316. MeScroll.prototype.getBodyHeight = function () {
  9317. return this.bodyHeight || 0;
  9318. };
  9319. MeScroll.prototype.setBodyHeight = function (h) {
  9320. this.bodyHeight = h;
  9321. };
  9322. /* 阻止浏览器默认滚动事件 */
  9323. MeScroll.prototype.preventDefault = function (e) {
  9324. // 小程序不支持e.preventDefault, 已在wxs中禁止
  9325. // app的bounce只能通过配置pages.json的style.app-plus.bounce为"none"来禁止, 或使用renderjs禁止
  9326. // cancelable:是否可以被禁用; defaultPrevented:是否已经被禁用
  9327. if (e && e.cancelable && !e.defaultPrevented) e.preventDefault();
  9328. };
  9329. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  9330. /***/ }),
  9331. /* 88 */
  9332. /*!*************************************************************************!*\
  9333. !*** D:/wwwroot/HDhotel/components/mescroll-uni/mescroll-uni-option.js ***!
  9334. \*************************************************************************/
  9335. /*! no static exports found */
  9336. /***/ (function(module, exports, __webpack_require__) {
  9337. "use strict";
  9338. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; // 全局配置
  9339. // mescroll-body 和 mescroll-uni 通用
  9340. var GlobalOption = {
  9341. down: {
  9342. // 其他down的配置参数也可以写,这里只展示了常用的配置:
  9343. textInOffset: '下拉刷新', // 下拉的距离在offset范围内的提示文本
  9344. textOutOffset: '释放更新', // 下拉的距离大于offset范围的提示文本
  9345. textLoading: '加载中 ...', // 加载中的提示文本
  9346. offset: 80, // 在列表顶部,下拉大于80px,松手即可触发下拉刷新的回调
  9347. native: false // 是否使用系统自带的下拉刷新; 默认false; 仅在mescroll-body生效 (值为true时,还需在pages配置enablePullDownRefresh:true;详请参考mescroll-native的案例)
  9348. },
  9349. up: {
  9350. // 其他up的配置参数也可以写,这里只展示了常用的配置:
  9351. textLoading: '加载中 ...', // 加载中的提示文本
  9352. textNoMore: '-- END --', // 没有更多数据的提示文本
  9353. offset: 80, // 距底部多远时,触发upCallback
  9354. toTop: {
  9355. // 回到顶部按钮,需配置src才显示
  9356. src: "http://www.mescroll.com/img/mescroll-totop.png?v=1", // 图片路径 (建议放入static目录, 如 /static/img/mescroll-totop.png )
  9357. offset: 1000, // 列表滚动多少距离才显示回到顶部按钮,默认1000px
  9358. right: 20, // 到右边的距离, 默认20 (支持"20rpx", "20px", "20%"格式的值, 纯数字则默认单位rpx)
  9359. bottom: 120, // 到底部的距离, 默认120 (支持"20rpx", "20px", "20%"格式的值, 纯数字则默认单位rpx)
  9360. width: 72 // 回到顶部图标的宽度, 默认72 (支持"20rpx", "20px", "20%"格式的值, 纯数字则默认单位rpx)
  9361. },
  9362. empty: {
  9363. use: true, // 是否显示空布局
  9364. icon: "http://www.mescroll.com/img/mescroll-empty.png?v=1", // 图标路径 (建议放入static目录, 如 /static/img/mescroll-empty.png )
  9365. tip: '~ 空空如也 ~' // 提示
  9366. } } };var _default =
  9367. GlobalOption;exports.default = _default;
  9368. /***/ }),
  9369. /* 89 */
  9370. /*!****************************************************************!*\
  9371. !*** D:/wwwroot/HDhotel/components/mescroll-uni/wxs/mixins.js ***!
  9372. \****************************************************************/
  9373. /*! no static exports found */
  9374. /***/ (function(module, exports, __webpack_require__) {
  9375. "use strict";
  9376. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; // 定义在wxs (含renderjs) 逻辑层的数据和方法, 与视图层相互通信
  9377. var WxsMixin = {
  9378. data: function data() {
  9379. return {
  9380. // 传入wxs视图层的数据 (响应式)
  9381. wxsProp: {
  9382. optDown: {}, // 下拉刷新的配置
  9383. scrollTop: 0, // 滚动条的距离
  9384. bodyHeight: 0, // body的高度
  9385. isDownScrolling: false, // 是否正在下拉刷新中
  9386. isUpScrolling: false, // 是否正在上拉加载中
  9387. isScrollBody: true, // 是否为mescroll-body滚动
  9388. isUpBoth: true, // 上拉加载时,是否同时可以下拉刷新
  9389. t: 0 // 数据更新的标记 (只有数据更新了,才会触发wxs的Observer)
  9390. },
  9391. // 标记调用wxs视图层的方法
  9392. callProp: {
  9393. callType: '', // 方法名
  9394. t: 0 // 数据更新的标记 (只有数据更新了,才会触发wxs的Observer)
  9395. },
  9396. // 不用wxs的平台使用此处的wxsBiz对象,抹平wxs的写法 (微信小程序和APP使用的wxsBiz对象是./wxs/wxs.wxs)
  9397. // 不用renderjs的平台使用此处的renderBiz对象,抹平renderjs的写法 (app 和 h5 使用的renderBiz对象是./wxs/renderjs.js)
  9398. renderBiz: {
  9399. propObserver: function propObserver() {} // 抹平renderjs的写法
  9400. } };
  9401. },
  9402. methods: {
  9403. // wxs视图层调用逻辑层的回调
  9404. wxsCall: function wxsCall(msg) {
  9405. if (msg.type === 'setWxsProp') {
  9406. // 更新wxsProp数据 (值改变才触发更新)
  9407. this.wxsProp = {
  9408. optDown: this.mescroll.optDown,
  9409. scrollTop: this.mescroll.getScrollTop(),
  9410. bodyHeight: this.mescroll.getBodyHeight(),
  9411. isDownScrolling: this.mescroll.isDownScrolling,
  9412. isUpScrolling: this.mescroll.isUpScrolling,
  9413. isUpBoth: this.mescroll.optUp.isBoth,
  9414. isScrollBody: this.mescroll.isScrollBody,
  9415. t: Date.now() };
  9416. } else if (msg.type === 'setLoadType') {
  9417. // 设置inOffset,outOffset的状态
  9418. this.downLoadType = msg.downLoadType;
  9419. } else if (msg.type === 'triggerDownScroll') {
  9420. // 主动触发下拉刷新
  9421. this.mescroll.triggerDownScroll();
  9422. } else if (msg.type === 'endDownScroll') {
  9423. // 结束下拉刷新
  9424. this.mescroll.endDownScroll();
  9425. } else if (msg.type === 'triggerUpScroll') {
  9426. // 主动触发上拉加载
  9427. this.mescroll.triggerUpScroll(true);
  9428. }
  9429. } },
  9430. mounted: function mounted() {var _this = this;
  9431. // 配置主动触发wxs显示加载进度的回调
  9432. this.mescroll.optDown.afterLoading = function () {
  9433. _this.callProp = { callType: "showLoading", t: Date.now() }; // 触发wxs的方法 (值改变才触发更新)
  9434. };
  9435. // 配置主动触发wxs隐藏加载进度的回调
  9436. this.mescroll.optDown.afterEndDownScroll = function () {
  9437. _this.callProp = { callType: "endDownScroll", t: Date.now() }; // 触发wxs的方法 (值改变才触发更新)
  9438. setTimeout(function () {
  9439. if (_this.downLoadType === 4 || _this.downLoadType === 0) {
  9440. _this.callProp = { callType: "clearTransform", t: Date.now() }; // 触发wxs的方法 (值改变才触发更新)
  9441. }
  9442. }, 320);
  9443. };
  9444. // 初始化wxs的数据
  9445. this.wxsCall({ type: 'setWxsProp' });
  9446. } };var _default =
  9447. WxsMixin;exports.default = _default;
  9448. /***/ })
  9449. ]]);
  9450. //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map