|
@@ -3,6 +3,7 @@ import { BannerCarousel } from '../pages-home/components/banner-carousel/banner-
|
|
import { QuickDesignEntry } from '../pages-home/components/quick-design-entry/quick-design-entry';
|
|
import { QuickDesignEntry } from '../pages-home/components/quick-design-entry/quick-design-entry';
|
|
import { PopularDesigns } from '../pages-home/components/popular-designs/popular-designs';
|
|
import { PopularDesigns } from '../pages-home/components/popular-designs/popular-designs';
|
|
import { AiRecommendation } from '../pages-home/components/ai-recommendation/ai-recommendation';
|
|
import { AiRecommendation } from '../pages-home/components/ai-recommendation/ai-recommendation';
|
|
|
|
+import { Router } from '@angular/router'; // 添加导入
|
|
@Component({
|
|
@Component({
|
|
selector: 'app-page-home',
|
|
selector: 'app-page-home',
|
|
standalone: true,
|
|
standalone: true,
|
|
@@ -14,5 +15,24 @@ import { AiRecommendation } from '../pages-home/components/ai-recommendation/ai-
|
|
styleUrl: './page-home.scss'
|
|
styleUrl: './page-home.scss'
|
|
})
|
|
})
|
|
export class PageHome {
|
|
export class PageHome {
|
|
|
|
+constructor(private router: Router) {} // 注入Router服务
|
|
|
|
|
|
|
|
+ // 导航到设计中心
|
|
|
|
+ navigateToDesignCenter() {
|
|
|
|
+ console.log('正在导航到设计中心');
|
|
|
|
+
|
|
|
|
+ // 修正路径为 /cloth/design-center
|
|
|
|
+ this.router.navigate(['/cloth', 'design-center'])
|
|
|
|
+ .then(navResult => {
|
|
|
|
+ if (navResult) {
|
|
|
|
+ console.log('导航成功');
|
|
|
|
+ window.scrollTo(0, 0); // 滚动到页面顶部
|
|
|
|
+ } else {
|
|
|
|
+ console.log('导航失败 - 路径未匹配');
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .catch(error => {
|
|
|
|
+ console.error('导航错误:', error);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|