gpt4 book ai didi

android - NativeScript float 提示

转载 作者:行者123 更新时间:2023-11-29 15:03:54 24 4
gpt4 key购买 nike

我正在用 nativescript 创建一个表单,我希望我的字段有 float 提示,就像 TextInputLayout 我找到了这个插件 nativescript-textinputlayout这在技术上完全符合我的要求,但问题是我在我的应用程序中使用了 angular 2,而且我似乎无法弄清楚如何使用带有 angular 2 的插件。有人可以帮忙吗?除了使用插件实现 float 提示之外,我也对其他解决方案持开放态度

最佳答案

nativescript-textinputlayout是一个“ Vanilla ”NativeScript 组件。为了将它与 Angular 一起使用,您需要使用 element registry API 将其注册为 Angular 模板的有效标签。 .

示例:

我的组件.component.ts

import { registerElement } from "nativescript-angular/element-registry";

registerElement("TextInputLayout", () => require("nativescript-textinputlayout").TextInputLayout);

@Component({
selector: "my-component",
moduleId: module.id,
templateUrl: "./my-component.component.html"
})
export class MyComponent {}

我的组件.component.html

<StackLayout>
<TextInputLayout hint="my hint" hintAnimationEnabled="true">
<TextField text="my content"></TextField>
</TextInputLayout>
</StackLayout>

关于android - NativeScript float 提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40607787/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com