refactor(布局): 移除多个页面中未使用的右侧内容组件
清理未使用的RightContent组件及相关代码 移除jsx语法声明,统一使用script setup
Showing
3 changed files
with
7 additions
and
84 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2025-03-20 19:55:21 | 2 | * @Date: 2025-03-20 19:55:21 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-12-27 23:41:35 | 4 | + * @LastEditTime: 2025-12-29 17:50:54 |
| 5 | * @FilePath: /mlaj/src/views/HomePage.vue | 5 | * @FilePath: /mlaj/src/views/HomePage.vue |
| 6 | * @Description: 美乐爱觉教育首页组件 | 6 | * @Description: 美乐爱觉教育首页组件 |
| 7 | * | 7 | * |
| ... | @@ -29,7 +29,7 @@ | ... | @@ -29,7 +29,7 @@ |
| 29 | --> | 29 | --> |
| 30 | 30 | ||
| 31 | <template> | 31 | <template> |
| 32 | - <AppLayout title="美乐爱觉教育" :rightContent="rightContent"> | 32 | + <AppLayout title="美乐爱觉教育"> |
| 33 | <div class="bg-gradient-to-b from-white via-green-50/10 to-blue-50/10"> | 33 | <div class="bg-gradient-to-b from-white via-green-50/10 to-blue-50/10"> |
| 34 | <!-- Header Section with Welcome & Weather --> | 34 | <!-- Header Section with Welcome & Weather --> |
| 35 | <div v-if="currentUser" class="px-4 pt-3 pb-4"> | 35 | <div v-if="currentUser" class="px-4 pt-3 pb-4"> |
| ... | @@ -322,7 +322,7 @@ | ... | @@ -322,7 +322,7 @@ |
| 322 | </AppLayout> | 322 | </AppLayout> |
| 323 | </template> | 323 | </template> |
| 324 | 324 | ||
| 325 | -<script setup lang="jsx"> | 325 | +<script setup> |
| 326 | // 导入所需的Vue核心功能和组件 | 326 | // 导入所需的Vue核心功能和组件 |
| 327 | import { ref, onMounted, defineComponent, h, watch, nextTick } from 'vue' | 327 | import { ref, onMounted, defineComponent, h, watch, nextTick } from 'vue' |
| 328 | import { useRoute } from 'vue-router' | 328 | import { useRoute } from 'vue-router' |
| ... | @@ -382,30 +382,6 @@ onMounted(() => { | ... | @@ -382,30 +382,6 @@ onMounted(() => { |
| 382 | }, { immediate: true }) | 382 | }, { immediate: true }) |
| 383 | }) | 383 | }) |
| 384 | 384 | ||
| 385 | -// 右侧导航组件:搜索和消息通知 | ||
| 386 | - | ||
| 387 | -// 右侧内容组件 | ||
| 388 | -const RightContent = defineComponent({ | ||
| 389 | - setup() { | ||
| 390 | - return () => ( | ||
| 391 | - <div class="flex items-center"> | ||
| 392 | - <button class="p-2 mr-1"> | ||
| 393 | - <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-gray-700" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | ||
| 394 | - <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" /> | ||
| 395 | - </svg> | ||
| 396 | - </button> | ||
| 397 | - <button class="p-2"> | ||
| 398 | - <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-gray-700" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | ||
| 399 | - <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9" /> | ||
| 400 | - </svg> | ||
| 401 | - </button> | ||
| 402 | - </div> | ||
| 403 | - ) | ||
| 404 | - } | ||
| 405 | -}) | ||
| 406 | - | ||
| 407 | -const rightContent = h(RightContent) | ||
| 408 | - | ||
| 409 | // 工具函数:处理图片加载错误,设置默认头像 | 385 | // 工具函数:处理图片加载错误,设置默认头像 |
| 410 | const handleImageError = (e) => { | 386 | const handleImageError = (e) => { |
| 411 | e.target.onerror = null // 防止循环触发错误 | 387 | e.target.onerror = null // 防止循环触发错误 | ... | ... |
| 1 | <template> | 1 | <template> |
| 2 | - <AppLayout :rightContent="rightContent" :has-title="false"> | 2 | + <AppLayout :has-title="false"> |
| 3 | <div class="pb-24 mb-6"> | 3 | <div class="pb-24 mb-6"> |
| 4 | <!-- Course Image --> | 4 | <!-- Course Image --> |
| 5 | <div class="mb-4"> | 5 | <div class="mb-4"> |
| ... | @@ -324,7 +324,7 @@ | ... | @@ -324,7 +324,7 @@ |
| 324 | </AppLayout> | 324 | </AppLayout> |
| 325 | </template> | 325 | </template> |
| 326 | 326 | ||
| 327 | -<script setup lang="jsx"> | 327 | +<script setup> |
| 328 | import { ref, onMounted, onUnmounted, defineComponent, h } from 'vue' | 328 | import { ref, onMounted, onUnmounted, defineComponent, h } from 'vue' |
| 329 | import { useRoute, useRouter } from 'vue-router' | 329 | import { useRoute, useRouter } from 'vue-router' |
| 330 | import { useCart } from '@/contexts/cart' | 330 | import { useCart } from '@/contexts/cart' |
| ... | @@ -619,32 +619,6 @@ const handleImageError = (e) => { | ... | @@ -619,32 +619,6 @@ const handleImageError = (e) => { |
| 619 | e.target.src = '' | 619 | e.target.src = '' |
| 620 | } | 620 | } |
| 621 | 621 | ||
| 622 | -// Right content component | ||
| 623 | -const RightContent = defineComponent({ | ||
| 624 | - setup() { | ||
| 625 | - return () => ( | ||
| 626 | - <button class="p-2"> | ||
| 627 | - <svg | ||
| 628 | - xmlns="http://www.w3.org/2000/svg" | ||
| 629 | - class="h-6 w-6 text-gray-700" | ||
| 630 | - fill="none" | ||
| 631 | - viewBox="0 0 24 24" | ||
| 632 | - stroke="currentColor" | ||
| 633 | - > | ||
| 634 | - <path | ||
| 635 | - stroke-linecap="round" | ||
| 636 | - stroke-linejoin="round" | ||
| 637 | - stroke-width="2" | ||
| 638 | - d="M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z" | ||
| 639 | - /> | ||
| 640 | - </svg> | ||
| 641 | - </button> | ||
| 642 | - ) | ||
| 643 | - }, | ||
| 644 | -}) | ||
| 645 | - | ||
| 646 | -const rightContent = h(RightContent) | ||
| 647 | - | ||
| 648 | /** | 622 | /** |
| 649 | * @function handlePurchase | 623 | * @function handlePurchase |
| 650 | * @description 立即购买操作: | 624 | * @description 立即购买操作: | ... | ... |
| 1 | <template> | 1 | <template> |
| 2 | - <AppLayout :rightContent="rightContent"> | 2 | + <AppLayout> |
| 3 | <div class="pb-16"> | 3 | <div class="pb-16"> |
| 4 | <!-- Search Bar --> | 4 | <!-- Search Bar --> |
| 5 | <div class="pb-2"> | 5 | <div class="pb-2"> |
| ... | @@ -93,7 +93,7 @@ | ... | @@ -93,7 +93,7 @@ |
| 93 | </AppLayout> | 93 | </AppLayout> |
| 94 | </template> | 94 | </template> |
| 95 | 95 | ||
| 96 | -<script setup lang="jsx"> | 96 | +<script setup> |
| 97 | import { computed, defineComponent, h } from "vue"; | 97 | import { computed, defineComponent, h } from "vue"; |
| 98 | import { useRoute, useRouter } from 'vue-router' | 98 | import { useRoute, useRouter } from 'vue-router' |
| 99 | import AppLayout from "@/components/layout/AppLayout.vue"; | 99 | import AppLayout from "@/components/layout/AppLayout.vue"; |
| ... | @@ -139,31 +139,4 @@ const todayDate = new Date(); | ... | @@ -139,31 +139,4 @@ const todayDate = new Date(); |
| 139 | const formattedTime = featuredCourse.liveTime.split(":"); | 139 | const formattedTime = featuredCourse.liveTime.split(":"); |
| 140 | const hours = computed(() => formattedTime[0]); | 140 | const hours = computed(() => formattedTime[0]); |
| 141 | const minutes = computed(() => formattedTime[1]); | 141 | const minutes = computed(() => formattedTime[1]); |
| 142 | - | ||
| 143 | -// Right content component | ||
| 144 | - | ||
| 145 | -const RightContent = defineComponent({ | ||
| 146 | - setup() { | ||
| 147 | - return () => ( | ||
| 148 | - <button class="p-2"> | ||
| 149 | - <svg | ||
| 150 | - xmlns="http://www.w3.org/2000/svg" | ||
| 151 | - class="h-6 w-6 text-gray-700" | ||
| 152 | - fill="none" | ||
| 153 | - viewBox="0 0 24 24" | ||
| 154 | - stroke="currentColor" | ||
| 155 | - > | ||
| 156 | - <path | ||
| 157 | - stroke-linecap="round" | ||
| 158 | - stroke-linejoin="round" | ||
| 159 | - stroke-width="2" | ||
| 160 | - d="M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z" | ||
| 161 | - /> | ||
| 162 | - </svg> | ||
| 163 | - </button> | ||
| 164 | - ); | ||
| 165 | - }, | ||
| 166 | -}); | ||
| 167 | - | ||
| 168 | -const rightContent = h(RightContent); | ||
| 169 | </script> | 142 | </script> | ... | ... |
-
Please register or login to post a comment