Vue之设置背景图片
放置背景图片路径:设置背景图片<template><div class="background"><img :src="imgSrc" width="100%" height="100%" alt="" /></div></template><script>export default {data () {return {im
·
放置背景图片路径:
设置背景图片
<template>
<div class="background">
<img :src="imgSrc" width="100%" height="100%" alt="" />
</div>
</template>
<script>
export default {
data () {
return {
imgSrc: require('../assets/1.png')
}
}
}
</script>
<style>
.background {
left: 0;
top: 0;
width:100%;
height:100%; /**宽高100%是为了图片铺满屏幕 */
z-index:-1;
position: absolute;
}
</style>
更多推荐
已为社区贡献7条内容
所有评论(0)