(function(){ Vue.component('sign-progress-filter',{ template:'
\
统计年份
\
\
\
统计维度
\
\ \
\ \ \
\
\
', props:[], data: function(){ return { yearHtml:"" } }, methods: { yearClick:function(){ $(event.target.closest("div")).addClass('active').siblings().removeClass('active') }, formatYearData: function () { //显示年份最低是2016年 var now = new Date(), year = now.getFullYear(); var yearHtml = ""; if(now.getMonth() >= 6){ yearHtml += '
'+year+"
"; } for(i=year-1; i>=2016; i--){ if(i == (year-1) && now.getMonth() < 6){ yearHtml += '
'+i+"
"; }else{ yearHtml += '
'+i+"
"; } } this.yearHtml = yearHtml; }, }, mounted: function(){ this.formatYearData(); } }); })()