(function(){ Vue.component('special-filter', { template: '
', props:['selectedYear',"minYear","dimensionValList"], data: function(){ return { selyear:"", years: [], dimensionVal:"", } }, methods: { chooseYear:function(year){ this.selyear = year; this[param] = "" }, chooseItem:function(item,param){ this[param] = item this.selyear = "" }, resetClick:function(){ this.selyear = this.years[0]; this[param] = "" }, confirmClick:function(){ //触发刷新 var vm = this; Vuedals.Bus.$emit('close', { chooseYear: vm.selyear, dimensionVal:vm.dimensionVal }); } }, mounted: function(){ //显示年份最低是2016年 var now = new Date(), year = now.getFullYear(); var minYear = 2016 if(this.minYear){ minYear = this.minYear } // if(now.getMonth() >= 6){ // this.years.push(year); // } for(i=year; i>=minYear; i--){ this.years.push(i); } //如果前一个页面返回的选中的年份 if(!this.selectedYear){ this.selyear = this.years[0]; }else{ this.selyear = this.selectedYear } } }) })()