(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 += '"; } for(i=year-1; i>=2016; i--){ if(i == (year-1) && now.getMonth() < 6){ yearHtml += '"; }else{ yearHtml += '"; } } this.yearHtml = yearHtml; }, }, mounted: function(){ this.formatYearData(); } }); })()