Visual studio code 带有本机脚本的Visual Studio代码无法识别所有本机脚本组件
带有本机脚本的Visual Studio代码无法识别组件XML中的本机脚本组件。我有一个来自官方教程的,其中ActionBar是公认的,但GridLayout不是: “GridLayout”不是已知元素: 1.如果“GridLayout”是一个角度组件,则验证它是否是此模块的一部分。 2.若要允许任何元素,请将“无错误模式”添加到此组件的“@NgModule.schemas” XML如下所示:Visual studio code 带有本机脚本的Visual Studio代码无法识别所有本机脚本组件,visual-studio-code,nativescript,Visual Studio Code,Nativescript,带有本机脚本的Visual Studio代码无法识别组件XML中的本机脚本组件。我有一个来自官方教程的,其中ActionBar是公认的,但GridLayout不是: “GridLayout”不是已知元素: 1.如果“GridLayout”是一个角度组件,则验证它是否是此模块的一部分。 2.若要允许任何元素,请将“无错误模式”添加到此组件的“@NgModule.schemas” XML如下所示: <ActionBar title="Groceries"> <!-- On iO
<ActionBar title="Groceries">
<!-- On iOS devices, <ActionItem>s are placed from left to right in sequence; you can override that (as the code above does) by providing an ios.position attribute. -->
<ActionItem text="Share" (tap)="share()" android.systemIcon="ic_menu_share_holo_dark" ios.systemIcon="9" ios.position="right"></ActionItem>
</ActionBar>
<GridLayout rows="auto, *">
<!-- add-bar necessary since we moved the page up 20 over the status bar on iOS-->
<GridLayout row="0" columns="*, auto" class="add-bar">
<TextField #groceryTextField [(ngModel)]="grocery" hint="Enter a grocery item" (returnPress)="add()" col="0"></TextField>
<Image src="res://add" (tap)="add()" col="1"></Image>
</GridLayout>...
...
它似乎完全是任意的,因为例如,StackLayout在同一个项目中的另一个XML中没有问题。如错误日志中所建议的,请确保在相应的
NgModule
中包含no\u ERRORS\u SCHEMA
(如果使用延迟加载的模块,也包括那里的SCHEMA)
旁注:它可能只是一个不完整的片段,但仍然。。。父级
GridLayout
没有封闭标签在我的例子中,它只发生在一个组件html中,尽管该文件的相应模块中没有包含任何错误模式,删除和创建该文件解决了我的问题,但它确实发生了 但为什么这对某些组件是必要的,而不是所有组件?
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
@NgModule({
schemas: [NO_ERRORS_SCHEMA],
//... more code follows here