【问题标题】:Ionic 3 background-image svg not appering in Ionic ViewIonic 3 background-image svg 未出现在 Ionic View 中
【发布时间】:2018-03-15 07:11:36
【问题描述】:

我正在使用 Ionic 2 开发一个应用程序。现在,我有这种风格:

ion-content {
  background-image: url('/assets/images/orange-background.svg');
  background-repeat: no-repeat;
  background-size: 101%;
}

当我 ionic serve 这工作正常,但是当我将新版本上传到 Ionic View 频道时,此示例不适用于 background-image.svg 的任何示例。

我已经尝试过Ionic - svg does not appear,但没有成功。

提前致谢。

编辑 1

我已经在background-image中尝试过这个网址:

assets/images/orange-background.svg
/assets/images/orange-background.svg
../assets/images/orange-background.svg
./assets/images/orange-background.svg

这些都不起作用:'(

编辑 2

我刚刚发现这个问题只发生在 iOS 上。

【问题讨论】:

    标签: svg ionic3 ionic-view


    【解决方案1】:

    可能是网址不正确。在 .css 文件中:url ('../assets/images/orange-background.svg')

    在其他情况下,您是否有所作为:在 Whindows 中,image.SVG 将在您在浏览器中测试应用程序时有效,但在 Linux(也包括 Android)中无效。似乎image.SVG 与windows 中的image.svg 相同。

    【讨论】:

    • 感谢您的回复,但这没有用。我添加了一个我尝试过的所有 url 的编辑。
    【解决方案2】:

    我遇到了类似的问题,我意识到该文件名为 "Background.svg",在我的 css 上我有:

    background-image: url("../assets/imgs/background.svg");

    一旦我将文件名更改为 "background.svg",问题就解决了。

    【讨论】:

      猜你喜欢
      • 2017-12-29
      • 1970-01-01
      • 1970-01-01
      • 2020-03-04
      • 2017-09-18
      • 2018-06-03
      • 2019-01-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多