Kaynağa Gözat

fix: tab1 图片相对路径 ../../assets 在子路径部署下解析到域名根 (404)

发布到 https://fmode.cn/aipm-lesson/fmode-app-mirror/ 后, ../../assets 从
路由 /tabs/tab1 解析为 fmode.cn/assets/* → 404。改为 base-href 相对路径
assets/images/*, ng serve 与子路径部署均正确。

Co-Authored-By: Claude Code <noreply@anthropic.com>
liuyuyang 6 gün önce
ebeveyn
işleme
7ac1f936b6
2 değiştirilmiş dosya ile 2 ekleme ve 2 silme
  1. 1 1
      src/app/tab1/tab1.page.html
  2. 1 1
      src/app/tab1/tab1.page.ts

+ 1 - 1
src/app/tab1/tab1.page.html

@@ -25,7 +25,7 @@
   </ion-segment>
   
   <div *ngIf="changeTab === 'default'" style="display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100vh; text-align: center; padding: 20px;">
-    <img src="../../assets/images/1.jpg" alt="" style="max-width: 100%; height: auto; border-radius: 10px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);">
+    <img src="assets/images/1.jpg" alt="" style="max-width: 100%; height: auto; border-radius: 10px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);">
     <h2 style="margin-top: 20px;">欢迎来到虚拟试衣</h2>
     <ion-button color="primary" shape="round" style="margin-top: 20px;" (click)="startDressing()">开始换装</ion-button>
 </div>

+ 1 - 1
src/app/tab1/tab1.page.ts

@@ -19,7 +19,7 @@ import { trigger, transition, style, animate } from '@angular/animations';
   ]
 })
 export class Tab1Page {
-  images: string[] = ['../../assets/images/3.png', '../../assets/images/2.jpg', '../../assets/images/4.jpg'];
+  images: string[] = ['assets/images/3.png', 'assets/images/2.jpg', 'assets/images/4.jpg'];
   currentImageIndex: number = 0;
 
   changeImage(direction: number) {