(function(){
Vue.component('table-panel',{
template: '
\
\
\
\
\
{{firstTh}} | \
{{th.thead}}\
\
\
\
| \
\
\
\
{{row.rank}} | \
\
{{row[th.param]}}\
| \
\
\
无数据 | \
无数据 | \
\
\
\
\
',
props:["index","tabledata","cantclick","hastopbar","reqlength"],
data: function(){
return {
tabList:[{name:"各区",level:"4",lowlevel:"",isShow:true},{name:"社区",level:"3",lowlevel:"2",isShow:true},{name:"团队",level:"2",lowlevel:"1",isShow:true}],
tabActive:0,
headers:[{thead:"排名",param:"name"},{thead:"名称",param:"name",tip:""},{thead:"",param:"address",tip:""}],
firstTh:"排名",
}
},
mounted: function(){
var vm=this
EventBus.$on("render-table-data", function(arg){
vm.firstTh=arg.firstTh||"排名"
})
},
methods: {
initTable:function(arg){
var vm = this;
if(arg.tabList&&arg.tabList.length>0){
vm.tabList=arg.tabList
}
if(arg.headers&&arg.headers.length>0){
vm.headers=arg.headers
}
var showIndex=vm.tabList.length-arg.tabnumber||0 //小于这个值的tab隐藏
_.each(vm.tabList,function(item,index){
if(index