关于uniapp css背景图不能用本地文件的解决办法

2023-11-09

参考:http://ask.dcloud.net.cn/question/62417

 

uni-app解决无法加载本地图片的方法【动态加载背景图片*唯一的解决办法】

特别注意:千万别忘记了【`url(${indexBackgroundImage})`】

<template>
	<view class="index" :style="{backgroundImage:`url(${indexBackgroundImage})`,backgroundSize: 'cover'}">
		<!--你的内容-->
	</view>
</template>

<script>
	
	import indexBackgroundImage from "@/static/img/account_index.jpg"
	
	export default {
		data() {
			return {
				indexBackgroundImage:indexBackgroundImage
			}
		},
		methods: {
			
		}
	}
</script>


<style lang="scss" scoped="">
</style>

 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

关于uniapp css背景图不能用本地文件的解决办法 的相关文章

随机推荐