gpt4 book ai didi

typescript - Uncaught Error : Cannot find module - Ionic 2

转载 作者:搜寻专家 更新时间:2023-10-30 21:14:48 25 4
gpt4 key购买 nike

我正在处理将 rootPage 设置为 AuthPage 的 Ionic 2 项目。后来,我创建了另一个名为 SplashPage 的页面(通过控制台),但是当我将 rootPage 设置为 SplashPage 时,我遇到了错误 Uncaught Error: Cannot find module "./pages/splash/splash" (app.bundle.js:3188)。有什么问题的线索吗?

应用.ts

import {App, IonicApp, Platform} from 'ionic-angular';
import {ListPage} from './pages/list/list';
import {WishListPage} from './pages/wishlist/wishlist';
import {AuthPage} from './pages/auth/auth';
import {SplashPage} from './pages/splash/splash';

@App({
templateUrl: 'build/app.html',
config: {}, // http://ionicframework.com/docs/v2/api/config/Config/
providers: [UserService]
})
class MyApp {
rootPage: any = SplashPage;
pages: Array<{title: string, component: any, user: string}>;
user: any;
constructor(private app: IonicApp, private platform: Platform,
private userService: UserService) {
this.initializeApp();
this.user = userService;

// used for an example of ngFor and navigation
this.pages = [

// No need to include this since the user shouldn't see
// the login page again until their session/token expires
//{ title: 'Login', component: AuthPage },

// Since we don't need to fear our user manually navigating
// via url, why not manage naviagtion permissions with simple
// template conditionals `*ngIf`
{ title: 'Wishlist', component: WishListPage, user: "shopper"}, // SHOPPER
{ title: 'Current Orders', component: ListPage, user: "shopper" }, // SHOPPER
{ title: 'Orders', component: ListPage, user: "boxer" }, // BOXER
{ title: 'Profile', component: ProfilePage, user:"both" } // BOTH
];

}

飞溅.ts

import {OnInit} from 'angular2/core';
import {NgIf} from 'angular2/common';
import {Page, NavController} from 'ionic-angular';

// @PAGES
import {AuthPage} from '../auth/auth';

@Page({
templateUrl: 'build/pages/splash/splash.html',
directives: [NgIf],
providers: []
})

export class SplashPage {
constructor() { console.log("@AuthPage: __init__"); }
}

最佳答案

它看起来像 app.ts 你正在调用类 spalsh 但实际的类名是 SplashPage

所以尝试在#splash.ts 中将 SplashPage 重命名为 Splash

关于typescript - Uncaught Error : Cannot find module - Ionic 2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36191983/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com