Nativescript:加载外部图像和应用渐变时下载位图出错

问题描述

我不明白为什么我会收到 4 次此错误 下载位图错误 - java.net.MalformedURLException: no protocol: function String() { [native code] } 使用以下代码

其中 background 是由 unsplash API 收集的外部 URL(例如:https://images.unsplash.com/photo-1506761121438-a89f7835bae2?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MXwyMDExODd8MHwxfHNlYXJjaHw4fHxWaWxsZXVyYmFubmUsYnJva2VuLGNsb3Vkc3xlbnwwfHx8&ixlib=rb-1.2.1&q=80&w=1080

gradient css 线性渐变(例如:linear-gradient(135deg,rgba(251,194,235,0.8) 0%,rgba(166,193,238,0.8) 100%) ))

<template>
    <Page :style="{backgroundImage:`url('${background}')`}">
        <FlexBoxLayout :style="{backgroundImage:`${gradient}`}"></FlexBoxLayout>
    </page>
</template>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)