El *_*bre 4 css vue.js vuetify.js
在Vuetify中(Vue组件超级集)中,我想在背景中添加图像图案。
\n\n我试过
\n\nbody {\n background: url("/images/background.png") no-repeat center center fixed;\n background-size: cover;\n}\nRun Code Online (Sandbox Code Playgroud)\n\n但这不起作用,某些 vuetify 组件取消了这种样式。我想要一种优雅的方式来做到这一点,而不是直接在组件或 html 中插入样式。
\n\n有人遇到过这个错误吗?我如何解决它?
\n小智 5
在你的 v-container 上放置一个类
<template>
<v-container class="hero">
</v-container>
</template>
<style scoped>
.hero {
background: url('../assets/yourImage.jpg');
background-size: cover;
height: 100vh;
}
</style>
Run Code Online (Sandbox Code Playgroud)