在 TabViewItem 中使用图标字体 - Nativescript-Vue
Use Icon Fonts in TabViewItem - Nativescript-Vue
我一直在寻找一种干净的方法来为 TabViewItem
使用字体图标(在我的例子中是 iconmoon),但没有找到答案。有人知道怎么做吗?
我正在使用 NativeScript-Vue。理想的做法是用字体图标更改 iconSource
,但它不起作用。类似于 :iconSource="String.fromCharCode(0xea0d)"
我使用的代码如下(而不是 labels
我在每个 TabViewItem
中有 frames
)。
<TabView :selectedIndex="selectedIndex" iosIconRenderingMode="alwaysOriginal">
<TabViewItem title="Tab 1" iconSource="~/images/icon.png">
<Label text="Content for Tab 1" />
</TabViewItem>
<TabViewItem title="Tab 2" iconSource="~/images/icon.png">
<Label text="Content for Tab 2" />
</TabViewItem>
</TabView>
无法在 iconSource
上使用字体图标,它只接受图像。
但是您可以在 title
属性上使用字体图标,但这可能会阻止您使用不同的字体设置标题样式,或者您可以使用 nativescript-vector-icons 将字体图标转换为动态图像并将其应用于 iconSource
.
我一直在寻找一种干净的方法来为 TabViewItem
使用字体图标(在我的例子中是 iconmoon),但没有找到答案。有人知道怎么做吗?
我正在使用 NativeScript-Vue。理想的做法是用字体图标更改 iconSource
,但它不起作用。类似于 :iconSource="String.fromCharCode(0xea0d)"
我使用的代码如下(而不是 labels
我在每个 TabViewItem
中有 frames
)。
<TabView :selectedIndex="selectedIndex" iosIconRenderingMode="alwaysOriginal">
<TabViewItem title="Tab 1" iconSource="~/images/icon.png">
<Label text="Content for Tab 1" />
</TabViewItem>
<TabViewItem title="Tab 2" iconSource="~/images/icon.png">
<Label text="Content for Tab 2" />
</TabViewItem>
</TabView>
无法在 iconSource
上使用字体图标,它只接受图像。
但是您可以在 title
属性上使用字体图标,但这可能会阻止您使用不同的字体设置标题样式,或者您可以使用 nativescript-vector-icons 将字体图标转换为动态图像并将其应用于 iconSource
.