首页 > 解决方案 > 如何在 nativescript 中设计上标

问题描述

我正在尝试显示购物车中有多少物品。在购物车符号的顶部。但我在使用网格布局时遇到了问题。因为,nativescript 不支持上标。有没有更好的设计方法。

我尝试了类似下面的东西。但商品数量未正确显示在购物车符号的右上角。

 <GridLayout col="2" rows="auto" columns="*,*">
                <Label col="0" text="&#xf07a;" fontSize="28" class="fas" textWrap="true" />
                <Label col="1" text="{{ line_item_no }}" fontSize="10" textWrap="true" margin="0 5 0 5" class="fcw" />
            </GridLayout>

我需要一个 25 字号的购物车符号。在右上角,我需要一个被圆形背景包围的 10 字体大小的数字。请给我一些想法。

标签: nativescript

解决方案


您可以使用text-decoration: line-through;属性,请参阅以下参考资料:

https://docs.nativescript.org/api-reference/modules/ui_enums .textdecoration https://docs.nativescript.org/ui/styling _

在此处输入图像描述


推荐阅读