uniapp如何设置view背景图

coldplay.xixi
coldplay.xixi 原创
2023-01-13 00:44:09 13755浏览

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

本教程操作环境: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背景图的详细内容,更多请关注php中文网其它相关文章!

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。