我想包装kendo标签条,使所有的标签都在一个地方,每当我想要改变标签组件时,只需更改一个位置。考虑到这一点,我开始包装剑道标签条,但它不起作用。在这一点上我真的很困惑。这是我的代码:
custom-tab-strip.html
<kendo-tabstrip>
<ng-content></ng-content>
</kendo-tabstrip>自定义标签-组件.html:
<kendo-tabstrip-tab [title]="title" [selected]="selected">
<ng-template kendoTabContent>
<ng-content></ng-content>
</ng-template>
</kendo-tabstrip-tab>其中title和selected是此组件中的输入。
最后,我按如下方式使用这些组件:
<app-custom-tab-strip>
<app-custom-tab [title]="'title'" [selected]="true">
test
</app-custom-tab>
</app-custom-tab-strip>有人能帮我找出代码的问题吗?
发布于 2019-11-02 11:41:01
您必须使用@Input()和@output()发射器作为title和selected属性,因为当父组件调用子组件时,您必须为其传递2个值,因为它将设置运行时间。
https://stackoverflow.com/questions/52076852
复制相似问题