扫码关注官方订阅号
.vue中的style标签中的background的路径应该怎么写才能正确的打包出来
走同样的路,发现不同的人生
<p :style="backgroundp" class="background-img"></p> <script> export default { data () { return { backgroundp: { backgroundImage: 'url(' + require('../assets/images/1.jpg') + ')', } } } } </script> <style scoped> .background-img { background: no-repeat center top; background-size: contain; height: 150px; } </style>
`<p :style="{backgroundImage: 'url(https://cn.vuejs.org/images/logo.png)', width: '400px', height: '400px'}">foo</p>`
大兄弟,要多看文档哦https://cn.vuejs.org/v2/guide...
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
大兄弟,要多看文档哦
https://cn.vuejs.org/v2/guide...