Vue 设置背景图片
代码块<template><div class="app-container" :style="backgroundDiv" /></template><script>export default {data() {return {// 背景图片backgroundDiv: {backgroundImage: 'url(' + require('@/
·
- 代码块
<template>
<div class="app-container" :style="backgroundDiv" />
</template>
<script>
export default {
data() {
return {
// 背景图片
backgroundDiv: {
backgroundImage: 'url(' + require('@/assets/image/a.jpg') + ')',
backgroundRepeat: 'no-repeat',
backgroundSize: '100% 100%'
}
}
}
}
</script>
<style>
.app-container{
height: 100%;
width:100%;
}
</style>
- app-container 定义class属性,决定宽高
- backgroundDiv 图片属性
更多推荐
已为社区贡献5条内容
所有评论(0)