Browse Source

✨ feat(page): 修改大小样式,添加menu,order

Mcal 2 tuần trước cách đây
mục cha
commit
728021d937

+ 5 - 0
src/assets/img/menu/add.svg

@@ -0,0 +1,5 @@
+<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
+<rect x="0.333333" y="0.333333" width="39.3333" height="39.3333" rx="7.66667" fill="#F67F20"/>
+<rect x="0.333333" y="0.333333" width="39.3333" height="39.3333" rx="7.66667" stroke="#E6E6E6" stroke-width="0.666667"/>
+<path d="M20.0003 12.2917V20M20.0003 27.7084V20M20.0003 20H27.7087M20.0003 20H12.292" stroke="white" stroke-width="1.85" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>

+ 4 - 0
src/assets/img/menu/delete.svg

@@ -0,0 +1,4 @@
+<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
+<rect x="0.699148" y="0.699148" width="38.6017" height="38.6017" rx="9.73563" stroke="#E03B1F" stroke-width="1.3983"/>
+<path d="M29.969 15.7202L30.1132 15.722C30.6481 15.7618 31.0581 16.1615 31.0865 16.6427L31.0727 16.911L30.6169 21.9343L30.1388 26.8366C30.0376 27.8152 29.9471 28.6407 29.8689 29.2904C29.5973 31.5549 27.964 32.9552 25.5019 32.9967C21.6653 33.0605 17.9775 33.0598 14.3962 32.9901C12.0053 32.9449 10.3961 31.5295 10.1293 29.2996L9.94489 27.6567L9.62263 24.4701L9.29252 20.9732L8.91507 16.7755C8.86815 16.237 9.30317 15.7653 9.8867 15.722C10.4216 15.6823 10.8956 16.0163 11.007 16.4871L11.0504 16.8718L11.4048 20.807L11.7918 24.886C11.9654 26.6517 12.116 28.0807 12.2364 29.0845C12.3885 30.3552 13.132 31.0092 14.4403 31.0339C17.9935 31.1031 21.6538 31.1038 25.4634 31.0404C26.8513 31.0171 27.6066 30.3695 27.7619 29.0748L27.9455 27.4408C27.9992 26.9372 28.0567 26.3813 28.1174 25.7774L28.5048 21.7658L28.9714 16.6185C29.0146 16.1248 29.4477 15.7464 29.969 15.7202ZM8.01604 13.4642C7.43063 13.4642 6.95605 13.0262 6.95605 12.4859C6.95605 11.9906 7.35483 11.5813 7.87221 11.5165L8.01604 11.5076H12.6339C13.1827 11.5076 13.6631 11.1817 13.8349 10.7121L13.877 10.5671L14.2358 8.92001C14.5519 7.82911 15.5781 7.0524 16.7807 6.9648L17.0081 6.95654H22.9907C24.2132 6.95654 25.2928 7.66908 25.7084 8.77009L25.7784 8.981L26.1217 10.5668C26.2295 11.0636 26.6699 11.4346 27.2025 11.498L27.3649 11.5076H31.983C32.5684 11.5076 33.043 11.9456 33.043 12.4859C33.043 12.9811 32.6442 13.3905 32.1269 13.4552L31.983 13.4642H8.01604ZM22.9907 8.91314H17.0081C16.7107 8.91314 16.4463 9.07379 16.3365 9.27571L16.2993 9.36442L15.9558 10.951C15.9137 11.1446 15.8528 11.3311 15.7751 11.5089L24.2239 11.5091C24.1753 11.3982 24.1334 11.2839 24.0984 11.1666L24.0429 10.9506L23.7149 9.42541C23.6383 9.16078 23.4015 8.96704 23.1158 8.92274L22.9907 8.91314Z" fill="#E03B1F"/>
+</svg>

+ 5 - 0
src/assets/img/menu/reduce.svg

@@ -0,0 +1,5 @@
+<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
+<rect x="0.333333" y="0.333333" width="39.3333" height="39.3333" rx="7.66667" fill="#F67F20"/>
+<rect x="0.333333" y="0.333333" width="39.3333" height="39.3333" rx="7.66667" stroke="#E6E6E6" stroke-width="0.666667"/>
+<path d="M27.7087 20H20.0003H12.292" stroke="white" stroke-width="1.85" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>

+ 10 - 0
src/components/noProduct.vue

@@ -0,0 +1,10 @@
+<template>
+    <div class="w-full h-[80%] flex flex-col items-center justify-center">
+        <img class="w-[45%]" src="/imgs/noFoods.svg" alt="" />
+        <div class="text-[15px] font-semibold">{{ t('menu.noProducts') }}</div>
+    </div>
+</template>
+<script setup>
+import { useI18n } from 'vue-i18n'
+const { t } = useI18n()
+</script>

+ 2 - 2
src/views/layout/components/Header.vue

@@ -1,7 +1,7 @@
 <template>
-    <header class="flex h-[100px] items-center px-[48px] border-b-[1px] border-b-[#e6e6e6] justify-between ">
+    <header class="flex h-[60px] items-center px-[48px] border-b-[1px] border-b-[#e6e6e6] justify-between ">
             <div class="flex items-center">
-                <img class="w-[156px] mr-[10px]" src="/imgs/logo.svg" alt="">
+                <img class="w-[100px] mr-[10px]" src="/imgs/logo.svg" alt="">
                 <el-input v-model="keword" :input-style="{ boxShadow: 'none' }" style="width: 240px"
                     placeholder="Please input" :prefix-icon="Search" />
             </div>

+ 3 - 3
src/views/layout/components/Menu.vue

@@ -1,9 +1,9 @@
 <template>
     <div class="flex flex-col items-center">
-        <div class="rounded-[20px] flex items-center justify-center  w-[75px] h-[75px]" :class="[props.info.slected?'active':'']">
-            <img :src="props.info?.img" class="w-[70px] h-[70px]" />
+        <div class="rounded-[20px] flex items-center justify-center  w-[45px] h-[45px]" :class="[props.info.slected?'active':'']">
+            <img :src="props.info?.img" class="w-full h-full" />
         </div>
-        <div class="text-[16px] text-center text-[16px] w-[75px]" :class="[props.info.slected?'font-semibold':'']">
+        <div class=" text-center text-[12px] w-[75px]" :class="[props.info.slected?'font-semibold':'']">
             {{ t(props.info.name) }}
         </div>
     </div>

+ 1 - 1
src/views/layout/index.vue

@@ -2,7 +2,7 @@
     <div class="main flex flex-col">
         <Header></Header>
         <div class="flex-1 flex shrink-0" style="height:calc(100vh - 100px)">
-            <div class="h-full w-[168px] border-r-[1px] border-r-[#e6e6e6] flex flex-col justify-around">
+            <div class="h-full w-[75px] border-r-[1px] border-r-[#e6e6e6] flex flex-col justify-around">
                 <Menu @click="handleClick(item)" v-for="item in menus" :info="item" />
             </div>
             <div class="h-full flex-1 overflow-y-auto">

+ 122 - 0
src/views/menu/components/rightOrder/components/order.vue

@@ -0,0 +1,122 @@
+<!-- 代码已包含 CSS:使用 TailwindCSS , 安装 TailwindCSS 后方可看到布局样式效果 -->
+
+<template>
+    <div class="h-full bg-gray-50">
+      <div class="w-full mx-auto ">
+        <div class="bg-white rounded-lg  p-3">
+          <div class="flex items-center justify-between mb-3">
+            <h1 class="text-sm font-medium">Orders #45892</h1>
+          </div>
+  
+          <div class="space-y-4 mb-6 overflow-auto h-[200px]">
+            <div v-for="(item, index) in orderItems" :key="index" 
+              class="flex items-center justify-between p-4 bg-white border border-gray-100 rounded-lg">
+              <div class="flex items-center space-x-4">
+                <div class="w-16 h-16 rounded-full overflow-hidden">
+                  <img :src="item.image" :alt="item.name" class="w-full h-full object-cover"/>
+                </div>
+                <div>
+                  <h3 class="font-sm">{{ item.name }}</h3>
+                  <p class="text-xxs text-gray-500">Size: Large, Middle, Small</p>
+                  <p class="text-orange-500 font-medium mt-1">${{ item.price.toFixed(2) }}</p>
+                </div>
+              </div>
+              <div class="flex items-center space-x-4">
+                <button class="w-4 h-4 flex items-center justify-center bg-orange-100 text-orange-500 rounded-lg !rounded-button whitespace-nowrap"
+                  @click="decreaseQuantity(index)">
+                  <img src="../../../../../assets/img/menu/reduce.svg" alt="">
+                  
+                </button>
+                <span class="w-4 text-center">{{ item.quantity }}</span>
+                <button class="w-4 h-4 flex items-center justify-center bg-orange-500 text-white rounded-lg !rounded-button whitespace-nowrap"
+                  @click="increaseQuantity(index)">
+                  <img src="../../../../../assets/img/menu/add.svg" alt="">
+
+                </button>
+                <button class="w-4 h-4 flex items-center justify-center text-gray-400 hover:text-red-500 !rounded-button whitespace-nowrap"
+                  @click="removeItem(index)">
+                  <img src="../../../../../assets/img/menu/delete.svg" alt="">
+                </button>
+              </div>
+            </div>
+          </div>
+  
+          <div class="border-t border-gray-100 pt-4">
+            <div class="mb-4">
+              <h3 class="font-medium mb-2">Order Notes</h3>
+              <p class="text-gray-600 text-sm">No Chili, No Cilantro</p>
+            </div>
+            
+            <div class="flex items-center justify-between pt-4 border-t border-gray-100">
+              <span class="font-medium">Total</span>
+              <span class="text-sm font-medium">${{ total.toFixed(2) }}</span>
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+  </template>
+  
+  <script lang="ts" setup>
+  import { ref, computed } from 'vue';
+  
+  interface OrderItem {
+    name: string;
+    price: number;
+    quantity: number;
+    image: string;
+  }
+  
+  const orderItems = ref<OrderItem[]>([
+    {
+      name: 'Spicy Seasoned Seafood',
+      price: 4.85,
+      quantity: 2,
+      image: 'https://ai-public.mastergo.com/ai/img_res/1c3d3c5704265a819a659a8d3589bc21.jpg'
+    },
+    {
+      name: 'Premium Grade Mackerel (Cleaned)',
+      price: 4.65,
+      quantity: 2,
+      image: 'https://ai-public.mastergo.com/ai/img_res/6d4be10ce5e234dcec1509d199a41a99.jpg'
+    },
+    {
+      name: 'Grilled Sea Bass',
+      price: 4.85,
+      quantity: 2,
+      image: 'https://ai-public.mastergo.com/ai/img_res/a20aaccbc775fd5729c8b8c6dac46563.jpg'
+    }
+  ]);
+  
+  const total = computed(() => {
+    return orderItems.value.reduce((sum, item) => sum + item.price * item.quantity, 0);
+  });
+  
+  const increaseQuantity = (index: number) => {
+    orderItems.value[index].quantity += 1;
+  };
+  
+  const decreaseQuantity = (index: number) => {
+    if (orderItems.value[index].quantity > 1) {
+      orderItems.value[index].quantity -= 1;
+    }
+  };
+  
+  const removeItem = (index: number) => {
+    orderItems.value.splice(index, 1);
+  };
+  </script>
+  
+  <style scoped>
+  .order-item {
+    transition: all 0.3s ease;
+  }
+  
+  input[type="number"]::-webkit-inner-spin-button,
+  input[type="number"]::-webkit-outer-spin-button {
+    -webkit-appearance: none;
+    margin: 0;
+  }
+  </style>
+  
+  

+ 36 - 0
src/views/menu/components/rightOrder/rightOrder.vue

@@ -0,0 +1,36 @@
+<!-- 代码已包含 CSS:使用 TailwindCSS , 安装 TailwindCSS 后方可看到布局样式效果 -->
+
+<template>
+    <div class=" h-full bg-white flex flex-col items-center justify-between ">
+      <!-- Empty state section -->
+      <div class="h-[70%]">
+        <noProduct v-if="false"></noProduct>
+        <order v-else></order>
+      </div>
+      <!-- Action buttons section -->
+      <div class="w-full max-w-md px-4 space-y-4">
+        <div class="grid grid-cols-2 gap-4">
+          <button class="rounded text-sm py-3 px-6 bg-white border border-gray-200 text-gray-700 !rounded-button whitespace-nowrap hover:bg-gray-50 transition-colors">
+            Registration
+          </button>
+          <button class="rounded text-sm py-3 px-6 bg-white border border-gray-200 text-gray-700 !rounded-button whitespace-nowrap hover:bg-gray-50 transition-colors">
+            Kitchen Receipt
+          </button>
+        </div>
+        <button class="rounded text-sm w-full py-3 px-6 text-white bg-[#999]  !rounded-button whitespace-nowrap hover:bg-gray-200 transition-colors">
+          Choose A Table For Payment
+        </button>
+      </div>
+    </div>
+  </template>
+  
+  <script lang="ts" setup>
+  import noProduct from '../../../../components/noProduct.vue';
+  import order from './components/order.vue';
+  </script>
+  
+  <style scoped>
+
+  </style>
+  
+  

+ 110 - 0
src/views/menu/components/test.vue

@@ -0,0 +1,110 @@
+<!-- 代码已包含 CSS:使用 TailwindCSS , 安装 TailwindCSS 后方可看到布局样式效果 -->
+
+<template>
+    <div class="min-h-screen bg-gray-50">
+      <div class="container mx-auto px-4 py-8">
+        <header class="mb-8">
+          <h1 class="text-3xl font-bold text-gray-900">Fresh Food Menu</h1>
+          <div class="flex items-center mt-4">
+            <div class="relative flex-1 max-w-lg">
+              <input
+                type="text"
+                placeholder="Search for dishes..."
+                class="w-full pl-10 pr-4 py-2 text-sm text-gray-700 bg-white rounded-lg border-none shadow-sm"
+              />
+              <i class="fas fa-search absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm"></i>
+            </div>
+          </div>
+        </header>
+  
+        <div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6">
+          <div v-for="product in products" :key="product.id" class="bg-white rounded-xl shadow-sm p-4 transition-transform hover:scale-105">
+            <div class="relative aspect-square mb-4 rounded-full overflow-hidden">
+              <img :src="product.image" :alt="product.name" class="w-full h-full object-cover" />
+            </div>
+            <div class="text-center">
+              <h3 class="text-gray-800 font-medium text-sm mb-2">{{ product.name }}</h3>
+              <p class="text-orange-500 font-semibold">${{ product.price.toFixed(2) }}</p>
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+  </template>
+  
+  <script lang="ts" setup>
+  import { ref } from 'vue';
+  
+  interface Product {
+    id: number;
+    name: string;
+    price: number;
+    image: string;
+  }
+  
+  const products = ref<Product[]>([
+    {
+      id: 1,
+      name: 'Spicy Seasoned Seafood Noodles',
+      price: 2.29,
+      image: 'https://ai-public.mastergo.com/ai/img_res/e53b11a05b7778db2bc50338e47047c4.jpg'
+    },
+    {
+      id: 2,
+      name: 'Grilled Salmon Bowl',
+      price: 3.49,
+      image: 'https://ai-public.mastergo.com/ai/img_res/07e4619fc2f26fe9f6a0afaebc47dceb.jpg'
+    },
+    {
+      id: 3,
+      name: 'Teriyaki Chicken Rice',
+      price: 2.99,
+      image: 'https://ai-public.mastergo.com/ai/img_res/1709d2e0e3495f8089da24be4ad2d26a.jpg'
+    },
+    {
+      id: 4,
+      name: 'Vegetable Stir Fry Noodles',
+      price: 2.49,
+      image: 'https://ai-public.mastergo.com/ai/img_res/043e50f136a6ec7f5f37eb448cf298c7.jpg'
+    },
+    {
+      id: 5,
+      name: 'Spicy Tuna Poke Bowl',
+      price: 3.99,
+      image: 'https://ai-public.mastergo.com/ai/img_res/7f8ad399ad651c8de6896bc611be1936.jpg'
+    },
+    {
+      id: 6,
+      name: 'Beef Bulgogi Bowl',
+      price: 3.79,
+      image: 'https://ai-public.mastergo.com/ai/img_res/49b0d0fbf6654dcef422a7e3334c8b6a.jpg'
+    },
+    {
+      id: 7,
+      name: 'Shrimp Pad Thai',
+      price: 3.29,
+      image: 'https://ai-public.mastergo.com/ai/img_res/ca1fef96dffcfa401768314721606c8f.jpg'
+    },
+    {
+      id: 8,
+      name: 'Miso Ramen Bowl',
+      price: 2.89,
+      image: 'https://ai-public.mastergo.com/ai/img_res/210debe79bb22fec1944cab575f2759f.jpg'
+    }
+  ]);
+  </script>
+  
+  <style scoped>
+  .container {
+    max-width: 1440px;
+    min-height: 1024px;
+  }
+  
+  input[type="number"]::-webkit-inner-spin-button,
+  input[type="number"]::-webkit-outer-spin-button {
+    -webkit-appearance: none;
+    margin: 0;
+  }
+  </style>
+  
+  

+ 115 - 24
src/views/menu/index.vue

@@ -1,6 +1,6 @@
 <template>
     <div class="w-full h-full overflow-hidden flex justify-between">
-        <div class="shrink-0 min-w-[800px] flex-1">
+        <div class="shrink-0 min-w-[600px] flex-1">
             <div class="w-full h-full overflow-y-auto relative hide-bar">
                 <div class="sticky top-0 w-full bg-[#fff] p-[10px]">
                     <div class="h-[60px] flex justify-between items-center">
@@ -12,58 +12,149 @@
                                     <ArrowLeft />
                                 </el-icon>
                             </div>
-                            <div ref="scrollRef" class="overflow-x-auto bg-[#666]" style="width:calc(100% - 108px)">
+                            <div ref="scrollRef" class="overflow-x-auto bg-[#fff]" style="width:calc(100% - 108px)">
                                 <div ref="" class="flex flex-nowrap items-center ">
-                                    <div @click="catgroyClick" v-for="item in 50"  class="flex items-center shrink-0 mr-[20px] h-[34px] w-[55px] border">{{ item }}</div>
+                                    <div @click="catgroyClick" v-for="item in products"
+                                        class="flex items-center shrink-0 mr-[20px] h-[34px] ">{{ item.name }}
+                                    </div>
                                 </div>
                             </div>
-                            <div @click="handleRightClick" class="text-[#999] shrink-0 flex items-center justify-center h-[34px] w-[44px] border border-[#e6e6e6] rounded-[12px]">
+                            <div @click="handleRightClick"
+                                class="text-[#999] shrink-0 flex items-center justify-center h-[34px] w-[44px] border border-[#e6e6e6] rounded-[12px]">
                                 <el-icon>
                                     <ArrowRight />
                                 </el-icon>
                             </div>
-                            <!-- <div class="w-full h-full overflow-hidden flex items-center justify-between">
-                                
-                                
-                            </div> -->
                         </div>
-                        <div
-                            class="h-[34px] px-[10px] cursor-pointer shrink-0 border rounded border-[#e6e6e6] flex items-center justify-between hover:bg-[#f67f20] hover:text-[#fff]">
-                            <span>{{ t('menu.pendingOrders') }}</span>
-                            <div class="ml-[10px] text-[#fff] rounded-full bg-[#f67f20] text-[14px] px-[3px]">
-                                99+
+
+                    </div>
+                    <div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6">
+                            <div v-for="product in products" :key="product.id"
+                                class="bg-white rounded-xl shadow-sm  transition-transform ">
+                                <div class="relative flex items-center bg-[#fef8f4] justify-center mb-4 rounded overflow-hidden">
+                                    <img :src="product.image" :alt="product.name" class="w-25 h-25 my-1 object-cover rounded-full" />
+                                </div>
+                                <div class="text-left px-2">
+                                    <h3 class="text-gray-800 font-medium text-sm mb-2 h-8">{{ product.name }}</h3>
+                                    <p class="text-orange-500 font-semibold">${{ product.price.toFixed(2) }}</p>
+                                </div>
                             </div>
                         </div>
-                    </div>
                 </div>
-                <div class="h-[50px] " v-for="item in 50">{{ item }}</div>
             </div>
         </div>
-        <div class="w-[400px] h-full overflow-hidden border-l border-gray-200">
-
+        <div class="w-[500px] h-full overflow-hidden border-l border-gray-200">
+            <rightOrder></rightOrder>
         </div>
     </div>
 </template>
 <script setup>
-import { ref,onMounted } from 'vue'
+import { ref, onMounted } from 'vue'
 import { useStore } from '../../stores'
 import { storeToRefs } from 'pinia'
 import { useI18n } from 'vue-i18n'
 import { ArrowRight, ArrowLeft } from '@element-plus/icons-vue'
+import rightOrder from './components/rightOrder/rightOrder.vue'
 const { t } = useI18n()
 const store = useStore()
 const { count } = storeToRefs(store)
 const scrollRef = ref(null)
-function handleRightClick(){
-    
-    scrollRef.value.scrollLeft += 100
-}
-onMounted(()=>{
-    
+
+onMounted(() => {
+
 })
+const products = ref([
+    {
+        id: 1,
+        name: 'Spicy Seasoned Seafood Noodles',
+        price: 2.29,
+        image: 'https://ai-public.mastergo.com/ai/img_res/e53b11a05b7778db2bc50338e47047c4.jpg'
+    },
+    {
+        id: 2,
+        name: 'Grilled Salmon Bowl',
+        price: 3.49,
+        image: 'https://ai-public.mastergo.com/ai/img_res/07e4619fc2f26fe9f6a0afaebc47dceb.jpg'
+    },
+    {
+        id: 3,
+        name: 'Teriyaki Chicken Rice',
+        price: 2.99,
+        image: 'https://ai-public.mastergo.com/ai/img_res/1709d2e0e3495f8089da24be4ad2d26a.jpg'
+    },
+    {
+        id: 4,
+        name: 'Vegetable Stir Fry Noodles',
+        price: 2.49,
+        image: 'https://ai-public.mastergo.com/ai/img_res/043e50f136a6ec7f5f37eb448cf298c7.jpg'
+    },
+    {
+        id: 5,
+        name: 'Spicy Tuna Poke Bowl',
+        price: 3.99,
+        image: 'https://ai-public.mastergo.com/ai/img_res/7f8ad399ad651c8de6896bc611be1936.jpg'
+    },
+    {
+        id: 6,
+        name: 'Beef Bulgogi Bowl',
+        price: 3.79,
+        image: 'https://ai-public.mastergo.com/ai/img_res/49b0d0fbf6654dcef422a7e3334c8b6a.jpg'
+    },
+    {
+        id: 7,
+        name: 'Shrimp Pad Thai',
+        price: 3.29,
+        image: 'https://ai-public.mastergo.com/ai/img_res/ca1fef96dffcfa401768314721606c8f.jpg'
+    },
+    {
+        id: 8,
+        name: 'Miso Ramen Bowl',
+        price: 2.89,
+        image: 'https://ai-public.mastergo.com/ai/img_res/210debe79bb22fec1944cab575f2759f.jpg'
+    }
+]);
+const handleLeftClick = () => {
+  if (!scrollRef.value) return;
+  const target = findTargetElement(scrollRef.value);
+  const leftSibling = target.previousElementSibling;
+  if (leftSibling) {
+    scrollRef.value.scrollLeft = leftSibling.offsetLeft - (scrollRef.value.offsetWidth - leftSibling.offsetWidth) / 2;
+  }
+};
+
+const handleRightClick = () => {
+  if (!scrollRef.value) return;
+  const target = findTargetElement(scrollRef.value);
+  const rightSibling = target.nextElementSibling;
+  if (rightSibling) {
+    scrollRef.value.scrollLeft = rightSibling.offsetLeft - (scrollRef.value.offsetWidth - rightSibling.offsetWidth) / 2;
+  }
+};
+
+const findTargetElement = (scrollContainer) => {
+  const scrollLeft = scrollContainer.scrollLeft;
+  const children = scrollContainer.children[0].children;
+  for (let i = 0; i < children.length; i++) {
+    const child = children[i];
+    const childEnd = child.offsetLeft + child.offsetWidth;
+    if (child.offsetLeft <= scrollLeft + scrollContainer.offsetWidth && childEnd > scrollLeft) {
+      return child;
+    }
+  }
+  return children[0];
+};
 </script>
 <style scoped>
 ::-webkit-scrollbar-thumb {
     background-color: red;
 }
+/* 隐藏整个滚动条 */
+::-webkit-scrollbar {
+    display: none;
+}
+
+/* 或者仅隐藏滚动条的轨道,保留滑块可操作性,但视觉上不显示滚动条 */
+::-webkit-scrollbar-track {
+    display: none;
+}
 </style>