瀏覽代碼

年份单选

duy 2 年之前
父節點
當前提交
fd7ed1f21b
共有 1 個文件被更改,包括 7 次插入9 次删除
  1. 7 9
      src/views/using/query.vue

+ 7 - 9
src/views/using/query.vue

@@ -33,7 +33,7 @@
                         <div class="hc-search-screening-item">
                             <div class="title">年度:</div>
                             <template v-for="item in annuals">
-                                <div class="screening-key" :class="isIndex(annual,'key', item.key) ? 'cut': ''" @click="annualClick(item)">{{item.name}}</div>
+                                <div class="screening-key" :class="item.select ? 'cut': ''" @click="annualClick(item)">{{item.name}}</div>
                             </template>
                         </div>
                         <div class="hc-search-screening-item">
@@ -295,7 +295,7 @@ const clickHottitle=(item)=>{
 //年度
 const annuals = ref([])
 const setAnnuals = () => {
-    let annualArr = [{key: 'all', name: '所有'}]
+    let annualArr = [{key: 'all', name: '所有',select:true}]
     const year = new Date().getFullYear()
     for (let i = 0; i < 8; i++) {
         const item = year - i + ''
@@ -309,13 +309,11 @@ const setAnnuals = () => {
 const annual = ref([{key: 'all', name: '所有'}])
 const annualClick = (item) => {
     annual.value = setQueryFiltering(annual.value, item)
-    console.log(item,'item');
-    searchForm.value.year=item.name
-    // let arr=[]
-    // annual.value.forEach((item)=>{
-    //     arr.push(item.name)
-    // })
-    // searchForm.value.year=arr+''
+    searchForm.value.year=item.name;
+    annuals.value.forEach((ele)=>{
+        ele.select=false
+    })
+    item.select=true
 }