关于ionic2 更新到ionic3 后组件不能用的解决方案

时间:2021-09-07 19:45:46

错误代码就不贴出来了,直接上代码吧!

首先在xx.module.ts添加

1.import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';

2.添加  schemas:[
  CUSTOM_ELEMENTS_SCHEMA
  ]
完成后的整体代码是这样的
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { GroupBoxComponent } from '../../components/group-box/group-box';
@NgModule({
declarations: [
  GroupBoxComponent,
],
imports: [
  IonicPageModule.forChild(GroupBoxComponent),
],
exports: [
  GroupBoxComponent
],
schemas:[
  CUSTOM_ELEMENTS_SCHEMA
]
})
export class GroupBoxComponentModule {}
别的打发好像不需要做任何修改