【问题标题】:Use Icon Fonts in TabViewItem - Nativescript-Vue在 TabViewItem 中使用图标字体 - Nativescript-Vue
【发布时间】:2019-06-17 17:10:11
【问题描述】:

我一直在寻找一种干净的方式来为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>

【问题讨论】:

  • 在标题中使用 fonticon 代替 iconSource
  • tried this了吗

标签: nativescript nativescript-vue


【解决方案1】:

不能在iconSource 上使用字体图标,它只接受图像。

但是您可以在title 属性上使用字体图标,但这可能会阻止您使用不同的字体来设置标题的样式,或者您可以使用nativescript-vector-icons,它可以将字体图标即时转换为图像并应用发给iconSource

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-08-05
    • 1970-01-01
    • 1970-01-01
    • 2019-06-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多