Vue.component('header-prompt', { template: '
\ {{areaName}} (\
', props: [], data: function() { return { areaName:"", jieZhiTime:"", selectDate:"", dimensionVal:"", dimensionVal2: "" } }, mounted: function() { var vm = this; getJieZhiTime(vm); //更新区域名称 EventBus.$on('update-area-name', function(arg) { vm.areaName = arg.areaName; }); //更新统计时间 EventBus.$on('update-statistics-time', function(arg) { getJieZhiTime(vm); }); //更新年份 EventBus.$on('update-statistics-year', function(arg) { vm.selectDate = arg.selectDate; }); //更新维度名称 EventBus.$on('update-dimension-name', function(arg) { vm.dimensionVal = arg.dimensionVal; }); //更新维度2名称 EventBus.$on('update-dimension2-name', function(arg){ vm.dimensionVal2 = arg.dimensionVal2; }); //更新所有信息 EventBus.$on('update-all-prompt-info', function(arg) { vm.areaName = arg.areaName; getJieZhiTime(vm); vm.selectDate = arg.selectDate; vm.dimensionVal = arg.dimensionVal; }); }, methods: { } }) //获取统计时间 function getJieZhiTime(vm){ statisticAPI.statisticsTime({}).then(function(res) { if(res.status=="200"){ var date = (res.data && res.data.substring(11,16)) || ""; vm.jieZhiTime = date; } }) }