uniapp如何设置view背景图

发布时间:2022-05-23 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了uniapp如何设置view背景图脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

uniapp设置view背景图的方法:可以通过设置view的background或者【background-image】属性来实现,代码为【<view class="content" :style="{background: &#39;url】。

uniapp如何设置view背景图

本教程操作环境:windows7系统、uni-app2.5.1版本、Dell G3脑。

推荐(免费):uni-app开发教程

uniapp设置view背景图的方法:

可以通过设置view的background或者background-image属性来实现:

<template>
<view class="content" :style="{background: 'url('+imageURL+')'}">
<!-- 如果是设置background-image则写成:<view class="content" :style="{backgroundImage:                             
        'url('+imageURL+')'}"> -->
</view>
</template>
 
<script>
export default {
data() {
return {
imageURL: '/static/navigation/valIDCode_back.png'
};
}
}
</script>

相关免费学习推荐:编程视频

以上就是uniapp如何设置view背景图的详细内容,更多请关注脚本宝典其它相关文章

脚本宝典总结

以上是脚本宝典为你收集整理的uniapp如何设置view背景图全部内容,希望文章能够帮你解决uniapp如何设置view背景图所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:uniapp