【问题标题】:NativeScript cannot override ActionBar "preview"NativeScript 无法覆盖 ActionBar“预览”
【发布时间】:2019-12-02 05:52:35
【问题描述】:

我有一个 NativeScript 6.0.x 应用程序,并且我有一个列表组件,我通过路由导航到其中。一旦我到达那里,即使我将其设置为“列表”,ActionBar 也会显示“预览”。

list.component.html 文件

<ActionBar title="Listing"></ActionBar>
<Label text="Hello world"></Label>

list.component.ts 文件

import { Component } from "@angular/core";

@Component({
  selector: "gr-list",
  moduleId: module.id,
  templateUrl: "./list.component.html",
  styleUrls: ["./list.component.css"]
})

export class ListComponent { }

【问题讨论】:

  • 可以分享 Playground 链接吗?
  • 这是本地开发的应用程序,不在游乐场网站上,所以我没有链接或方法将其导入游乐场

标签: angular nativescript


【解决方案1】:

我错过了 NativeScriptCommonModule。当我真正应该列出的时候,我没有单独的模块来列出。我在我的应用程序路由模块中作弊。现在看起来像这样;

import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
import { NativeScriptCommonModule } from "nativescript-angular/common";

import { NativeScriptUIListViewModule } from "nativescript-ui-listview/angular/listview-directives";

import { ListRoutingModule } from "./list-routing.module";
import { ListComponent } from "./list.component";

@NgModule({
    imports: [
        NativeScriptCommonModule,
        NativeScriptUIListViewModule,
        ListRoutingModule
    ],
    declarations: [
        ListComponent
    ],
    schemas: [
        NO_ERRORS_SCHEMA
    ]
})
export class ListModule { }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-03
    • 2016-10-14
    • 2016-06-21
    • 2016-03-27
    • 2022-10-14
    相关资源
    最近更新 更多