【发布时间】:2019-02-27 16:37:34
【问题描述】:
我正在尝试使用 Ionic 3 创建我自己的组件,我按照以下步骤操作
-
第 1 步 - 使用命令行创建组件
离子 g 分量崩溃
-
第 2 步 - 在 app.module 中添加
-
第 3 步 - 尝试使用标签
折叠
但我有这个错误。
我尝试了很多替代方案,但都没有奏效。
-
collapse.ts 文件 从'@angular/core'导入{组件};
@Component({ selector: 'collapse', templateUrl: 'collapse.html' }) export class CollapseComponent { text: string; constructor() { console.log('Hello CollapseComponent Component'); this.text = 'Hello World'; } }
* component.mudule.ts 文件
import {NgModule} from '@angular/core';
import {PopoverComponent} from './popover/popover';
import {CollapseComponent} from './collapse/collapse';
import {IonicModule} from "ionic-angular";
@NgModule({
declarations: [
PopoverComponent,
CollapseComponent
],
imports: [
IonicModule,
],
exports: [
PopoverComponent,
CollapseComponent
]
})
export class ComponentsModule {
}
【问题讨论】:
-
通常当您执行“离子 g 组件崩溃”时,您应该会在终端中看到
[OK] Generated a component named collapse!您是否收到此消息? -
是的,我收到了这条消息。
标签: ionic-framework ionic2 ionic3