【问题标题】:What is the div equivalent element in NativescriptNativescript中的div等效元素是什么
【发布时间】:2016-03-30 02:53:18
【问题描述】:

我正在尝试包装一些元素以提供样式,但我没有看到任何可以用作容器的元素。

在这种情况下应该使用什么?

还请链接到 Nativescript 中可用的 css 属性,因为我无法找到可用 css 属性的列表。

【问题讨论】:

标签: nativescript


【解决方案1】:

StackLayoutGridLayout 是常用的,但不是最佳实践。嵌套许多 StackLayoutGridLayout 会降低应用程序的性能,因此请谨慎使用它们。更频繁地使用Label。另外,一个方便的技巧是使用FormattedString 嵌套一些成对的元素。

例子:

<Button class="-primary p-8">
    <FormattedString>
        <Span text="&#xf007;" class="fas t-18"></Span>
        <Span text=" Different " color="red"></Span>
        <Span text="colors in "></Span>
        <Span text=" Button " backgroundColor="green" color="whitesmoke"></Span>
    </FormattedString>
</Button>

https://docs.nativescript.org/angular/ui/ng-components/formatted-string

【讨论】:

    【解决方案2】:

    虽然样式元素很有用,但我认为您的问题的答案是使用 StackLayoutGridLayout,具体取决于您想要做什么。

    【讨论】:

    • NativeScript 中的所有内容基本上都是“可样式化的”。所以布局适合您的需求。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-08
    相关资源
    最近更新 更多