(function(){ Vue.component('area-data-panel',{ template: '
\
\
各区
\
社区
\
\ \ \ \ \ \ \ \ \ \ \ \
{{th}}
\
{{row.rank}}
\
{{col}}
\ {{col}}\
\
', props:[], data: function(){ return { level: '', lowLevel: '', area: '', headers: [], rows: [] } }, mounted: function(){ var vm = this; EventBus.$on("render-area-data", function(arg){ vm.level = arg.level; vm.lowLevel = arg.lowLevel; vm.area = arg.area; vm.headers = arg.headers; vm.rows = arg.rows; }) }, methods: { getLowLeverData: function(row){ if(this.level > 2 && this.lowLevel != 1){ //跳转去下一级数据 if(this.lowLevel && (this.level - this.lowLevel) >= 2){ //从次级tab的内容查看再下一级的数据 this.level = this.level - 2; this.lowLevel --; }else{ this.level --; } this.area = row.code; this.areaTitle = row.name; //触发组件监听事件,去父页面请求新的数据 this.$emit("getnewdata", { level: this.level, area: this.area, areaTitle: this.areaTitle, lowLevel: this.lowLevel, }); } }, getLowCodeData: function(code){ if(code == 3){ this.lowLevel = ''; }else{ this.lowLevel = code; } //触发组件监听事件,去父页面请求新的数据 this.$emit("getnewdata", { level: this.level, area: this.area, lowLevel: this.lowLevel }); } } }); })()