"use weex:vue";

if (typeof Promise !== 'undefined' && !Promise.prototype.finally) {
  Promise.prototype.finally = function(callback) {
    const promise = this.constructor
    return this.then(
      value => promise.resolve(callback()).then(() => value),
      reason => promise.resolve(callback()).then(() => {
        throw reason
      })
    )
  }
};

if (typeof uni !== 'undefined' && uni && uni.requireGlobal) {
  const global = uni.requireGlobal()
  ArrayBuffer = global.ArrayBuffer
  Int8Array = global.Int8Array
  Uint8Array = global.Uint8Array
  Uint8ClampedArray = global.Uint8ClampedArray
  Int16Array = global.Int16Array
  Uint16Array = global.Uint16Array
  Int32Array = global.Int32Array
  Uint32Array = global.Uint32Array
  Float32Array = global.Float32Array
  Float64Array = global.Float64Array
  BigInt64Array = global.BigInt64Array
  BigUint64Array = global.BigUint64Array
};


(()=>{var x=Object.create;var u=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var y=(e,i)=>()=>(i||e((i={exports:{}}).exports,i),i.exports);var S=(e,i,a,r)=>{if(i&&typeof i=="object"||typeof i=="function")for(let s of v(i))!I.call(e,s)&&s!==a&&u(e,s,{get:()=>i[s],enumerable:!(r=L(i,s))||r.enumerable});return e};var C=(e,i,a)=>(a=e!=null?x(T(e)):{},S(i||!e||!e.__esModule?u(a,"default",{value:e,enumerable:!0}):a,e));var g=y((N,b)=>{b.exports=Vue});var t=C(g());var p=(e,i)=>{let a=e.__vccOpts||e;for(let[r,s]of i)a[r]=s;return a};var z={"uni-swiper-page":{"":{flex:1,position:"absolute",left:0,top:0,right:0,bottom:0}},list:{"":{flex:1,backgroundColor:"#ebebeb"}},"list-item":{"":{marginLeft:12,marginRight:12,marginTop:12,paddingTop:20,paddingRight:20,paddingBottom:20,paddingLeft:20,backgroundColor:"#ffffff",borderRadius:5}},loading:{"":{height:20}}},A={props:{pid:{type:[Number,String],default:""},parentId:{type:String,default:""}},data(){return{scrollable:!0,dataList:[]}},created(){for(var e=0;e<30;e++)this.dataList.push({id:e,name:e})},methods:{setScrollRef(e){this.$refs.list.setSpecialEffects&&this.$refs.list.setSpecialEffects({id:this.parentId,headerHeight:e})},loadData(){},clear(){this.dataList.length=0}}};function D(e,i,a,r,s,n){return(0,t.openBlock)(),(0,t.createElementBlock)("view",{class:"uni-swiper-page",renderWhole:!0},[(0,t.createElementVNode)("list",{ref:"list",class:"list",offsetAccuracy:5,bounce:!1,fixFreezing:"true"},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(s.dataList,(o,c)=>((0,t.openBlock)(),(0,t.createElementBlock)("cell",{key:o.id,ref_for:!0,ref:"item"+c},[(0,t.createElementVNode)("view",{class:"list-item"},[(0,t.createElementVNode)("u-text",null,(0,t.toDisplayString)(o.name),1)])]))),128)),(0,t.createElementVNode)("cell",{class:"loading"})],512)])}var k=p(A,[["render",D],["styles",[z]]]),W={page:{"":{flex:1}},header:{"":{height:160,flexDirection:"row",alignItems:"center",justifyContent:"center",backgroundColor:"#f4f4f4"}},"header-title":{"":{fontSize:30,fontWeight:"bold",color:"#444444"}},"flexible-view":{"":{backgroundColor:"#f823ff"}},"page-head":{"":{height:200,flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:"#FF0000"}},tabs:{"":{flexDirection:"column",overflow:"hidden",backgroundColor:"#ffffff"}},"tab-bar":{"":{width:"750rpx",height:"84rpx",flexDirection:"row"}},"scroll-view-indicator":{"":{position:"relative",height:2,backgroundColor:"rgba(0,0,0,0)"}},"scroll-view-underline":{"":{position:"absolute",top:0,bottom:0,width:0,backgroundColor:"#007AFF"}},"scroll-view-animation":{"":{transitionDuration:200,transitionProperty:"left"}},"tab-bar-line":{"":{height:"1rpx",backgroundColor:"#cccccc"}},"tab-view":{"":{flex:1}},"uni-tab-item":{"":{flexWrap:"nowrap",paddingLeft:25,paddingRight:25}},"uni-tab-item-title":{"":{color:"#555555",fontSize:"30rpx",height:"80rpx",lineHeight:"80rpx",flexWrap:"nowrap"}},"uni-tab-item-title-active":{"":{color:"#007AFF"}},"swiper-item":{"":{flex:1,flexDirection:"column"}},"swiper-page":{"":{flex:1,flexDirection:"row",position:"absolute",left:0,top:0,right:0,bottom:0}},"@TRANSITION":{"scroll-view-animation":{duration:200,property:"left"}}},E=weex.requireModule("dom"),R=100,F=3,w=1,H={components:{swiperPage:k},data(){return{tabList:[],tabIndex:0,cacheTab:[],scrollInto:"",indicatorLineLeft:0,indicatorLineWidth:0,isTap:!1,showTitleView:!0,pageHeight:300,pageId:"page"}},onLoad(){for(var e=0;e<6;e++)this.tabList.push({id:"tab"+e,name:"Tab "+(e+1),pageid:e+1})},onReady(){this.pageHeight=uni.getSystemInfoSync().windowHeight,this._lastTabIndex=0,this.swiperWidth=0,this.tabbarWidth=0,this.tabListSize={},this._touchTabIndex=0,this._headHeight=100,this.pageList=this.$refs.page,this.selectorQuery()},methods:{ontabtap(e){let i=e.target.dataset.current||e.currentTarget.dataset.current;this.isTap=!0;var a=this.tabListSize[i];this.updateIndicator(a.left,a.width),this._touchTabIndex=i,this.switchTab(i)},onswiperchange(e){},onswiperscroll(e){if(!this.isTap){var i=e.detail.dx,a=this._lastTabIndex;if(i>w?a++:i<-w&&a--,!(a===this._lastTabIndex||a<0||a>this.pageList.length-1)){this.pageList[a].dataList.length===0&&this.loadTabData(a);var r=Math.abs(this.swiperWidth/i),s=this.tabListSize[this._lastTabIndex],n=this.tabListSize[a],o=s.left+(n.left-s.left)/r,c=s.width+(n.width-s.width)/r;this.updateIndicator(o,c)}}},animationfinish(e){let i=e.detail.current;this._touchTabIndex===i&&(this.isTap=!1),this._lastTabIndex=i,this.switchTab(i),this.updateIndicator(this.tabListSize[i].left,this.tabListSize[i].width)},selectorQuery(){uni.createSelectorQuery().in(this).select("#head").boundingClientRect().exec(a=>{this._headHeight=a[0].height}),uni.createSelectorQuery().in(this).select("#tab-bar").boundingClientRect().exec(a=>{this.tabbarWidth=a[0].width}),uni.createSelectorQuery().in(this).select("#tab-bar-view").boundingClientRect().exec(a=>{this.swiperWidth=a[0].width});for(var e=uni.createSelectorQuery().in(this),i=0;i<this.tabList.length;i++)e.select("#"+this.tabList[i].id).boundingClientRect();e.exec(a=>{a.forEach(r=>{this.tabListSize[r.dataset.id]=r}),this.updateIndicator(this.tabListSize[this.tabIndex].left,this.tabListSize[this.tabIndex].width),this.switchTab(this.tabIndex)})},updateIndicator(e,i){this.indicatorLineLeft=e,this.indicatorLineWidth=i},switchTab(e){if(this.pageList[e].dataList.length===0&&this.loadTabData(e),this.pageList[e].setScrollRef(this._headHeight),this.tabIndex!==e&&(this.pageList[this.tabIndex].dataList.length>R&&this.cacheTab.indexOf(this.tabIndex)<0&&this.cacheTab.push(this.tabIndex),this.tabIndex=e,this.scrollTabTo(e),this.cacheTab.length>F)){let i=this.cacheTab[0];this.clearTabData(i),this.cacheTab.splice(0,1)}},scrollTabTo(e){let i=this.$refs["tabitem"+e][0],a=0;e>0&&(a=this.tabbarWidth/2-this.tabListSize[e].width/2,this.tabListSize[e].right<this.tabbarWidth/2&&(a=this.tabListSize[0].width)),E.scrollToElement(i,{offset:-a})},loadTabData(e){this.pageList[e].loadData()},clearTabData(e){this.pageList[e].clear()}}};function O(e,i,a,r,s,n){let o=(0,t.resolveComponent)("swiper-page"),c=(0,t.resolveComponent)("swiper-item"),m=(0,t.resolveComponent)("swiper");return(0,t.openBlock)(),(0,t.createElementBlock)("list",{id:s.pageId,class:"page",bounce:!1,fixFreezing:"true"},[(0,t.createElementVNode)("cell",null,[(0,t.createElementVNode)("view",{id:"head",class:"header"},[(0,t.createElementVNode)("u-text",{class:"header-title"},"header")])]),(0,t.createElementVNode)("cell",null,[(0,t.createElementVNode)("view",{class:"tabs",style:(0,t.normalizeStyle)("height:"+s.pageHeight+"px")},[(0,t.createElementVNode)("scroll-view",{ref:"tabbar1",id:"tab-bar",class:"tab-bar",scroll:!1,scrollX:!0,showScrollbar:!1,scrollIntoView:s.scrollInto},[(0,t.createElementVNode)("view",{style:{"flex-direction":"column"}},[(0,t.createElementVNode)("view",{style:{"flex-direction":"row"}},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(s.tabList,(h,l)=>((0,t.openBlock)(),(0,t.createElementBlock)("view",{class:"uni-tab-item",key:h.id,id:h.id,ref_for:!0,ref:"tabitem"+l,"data-id":l,"data-current":l,onClick:i[0]||(i[0]=(..._)=>n.ontabtap&&n.ontabtap(..._))},[(0,t.createElementVNode)("u-text",{class:(0,t.normalizeClass)(["uni-tab-item-title",s.tabIndex==l?"uni-tab-item-title-active":""])},(0,t.toDisplayString)(h.name),3)],8,["id","data-id","data-current"]))),128))]),(0,t.createElementVNode)("view",{class:"scroll-view-indicator"},[(0,t.createElementVNode)("view",{ref:"underline",class:(0,t.normalizeClass)(["scroll-view-underline",s.isTap?"scroll-view-animation":""]),style:(0,t.normalizeStyle)({left:s.indicatorLineLeft+"px",width:s.indicatorLineWidth+"px"})},null,6)])])],8,["scrollIntoView"]),(0,t.createElementVNode)("view",{class:"tab-bar-line"}),(0,t.createVNode)(m,{class:"tab-view",ref:"swiper1",id:"tab-bar-view",current:s.tabIndex,duration:300,onChange:n.onswiperchange,onTransition:n.onswiperscroll,onAnimationfinish:n.animationfinish,onOnAnimationEnd:n.animationfinish},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(s.tabList,(h,l)=>((0,t.openBlock)(),(0,t.createBlock)(c,{class:"swiper-item",key:l},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(o,{class:"swiper-page",pid:h.pageid,parentId:s.pageId,ref_for:!0,ref:"page"},null,8,["pid","parentId"])]),_:2},1024))),128))]),_:1},8,["current","onChange","onTransition","onAnimationfinish","onOnAnimationEnd"])],4)])],8,["id"])}var d=p(H,[["render",O],["styles",[W]]]);var f=plus.webview.currentWebview();if(f){let e=parseInt(f.id),i="pages/template/swiper-list-nvue/swiper-list-nvue",a={};try{a=JSON.parse(f.__query__)}catch(s){}d.mpType="page";let r=Vue.createPageApp(d,{$store:getApp({allowDefault:!0}).$store,__pageId:e,__pagePath:i,__pageQuery:a});r.provide("__globalStyles",Vue.useCssStyles([...__uniConfig.styles,...d.styles||[]])),r.mount("#root")}})();
