wujingjing
2024-10-25 7d68c674fc27260c59ab66b349c1f3158c0c0843
src/views/project/ch/home/component/waterRight/center.vue
@@ -11,23 +11,26 @@
            <i class="myiconfont icon-shuaxin"></i>
         </div>
      </div>
      <div class="main">
         <div
            class="main_item flex items-center cursor-pointer"
            v-for="(item, index) in state.exampleContent"
            :key="index"
            :class="{ main_item_active: item.sample_id === activeSampleId }"
            @click="changeExample(item)"
         >
            <div class="left flex items-center justify-center" :class="['color' + index]">
               <img :src="item.Icon" alt="" />
            </div>
            <div class="right">
               <h4>{{ item.sample_title }}</h4>
               <p>{{ item.sample_question }}</p>
            </div>
         </div>
         <el-carousel height="80" :interval="5000" indicator-position="none">
            <el-carousel-item v-for="group in batchSourceData" :key="group" class="set-carousel-item">
               <div
                  class="main_item flex items-center cursor-pointer"
                  v-for="(item, index) in state.exampleContent"
                  :key="index"
                  :class="{ main_item_active: item.sample_id === activeSampleId }"
                  @click="changeExample(item)"
               >
                  <div class="left flex items-center justify-center" :class="['color' + index]">
                     <img :src="item.Icon" alt="" />
                  </div>
                  <div class="right">
                     <h4>{{ item.sample_title }}</h4>
                     <p>{{ item.sample_question }}</p>
                  </div>
               </div>
            </el-carousel-item>
         </el-carousel>
      </div>
   </div>
</template>
@@ -48,6 +51,7 @@
onMounted(() => {
   getSelectListSample();
});
//换一批数据源
const groupedArray = computed(() => {
   const groups = [];
   let i = 0;
@@ -55,6 +59,15 @@
      groups.push(state.exampleRandomContent.slice(i, (i += 4)));
   }
   return groups;
});
//自动播放
const batchSourceData = computed(() => {
   const batch = [];
   let i = 0;
   while (exampleList.value.length > i) {
      batch.push(exampleList.value.slice(i, (i += 4)));
   }
   return batch;
});
//获取模版列表
const getSelectListSample = async () => {
@@ -198,6 +211,10 @@
            }
         }
      }
      .set-carousel-item {
         display: flex;
         flex-wrap: wrap;
      }
   }
}
@@ -216,4 +233,11 @@
:deep(.el-drawer__body) {
   overflow-x: hidden;
}
:deep(.el-carousel--horizontal) {
   width: 100%;
}
:deep(.el-carousel__container) {
   width: 100%;
   height: 200px !important;
}
</style>