• vue设置页面背景及背景图片


    本地静态图片 

    1. <template>
    2.     <view class="max">
    3.         <image src="../../static/bg.png" mode="">image>
    4.     view>
    5. template>
    6. <script>
    7.     export default {
    8.         data() {
    9.             return {
    10.                 
    11.             }
    12.         },
    13.         methods: {
    14.             
    15.         }
    16.     }
    17. script>
    18. <style lang="scss" scoped>
    19.     .max{
    20.         image{
    21.              z-index:-1
    22.              width:100%
    23.              height:100%
    24.              position: fixed; 
    25.              top:0
    26.         }
    27.     }
    28. style>

    cdn图片

    1. <template>
    2.     <view class="">
    3.      <view class="max">
    4. <image
    5. src="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-59f27697-00c5-4f1e-8c67-bb56e1e19e78/653c2495-cb7b-49a7-b6cb-f048e16fa5a7.jpg"
    6. mode=""
    7. >image>
    8. view>
    9.     view>
    10. template>
    11. <script>
    12.     export default {
    13.         data() {
    14.             return {
    15.                 
    16.             }
    17.         },
    18.         methods: {
    19.             
    20.         }
    21.     }
    22. script>
    23. <style lang="scss" scoped>
    24.     .max{
    25.         image{
    26.              z-index:-1
    27.              width:100%
    28.              height:100%
    29.              position: fixed; 
    30.              top:0
    31.         }
    32.     }
    33. style>

    设置背景色

    1. <template>
    2. <view class="container"> //最外层
    3. <view class="bg-colore">view> //此标签为最外层view标签的第一个子标签
    4. <view class="content">view>
    5. view>
    6. template>
    7. <script>
    8. script>
    9. style>
    10. .bg-colore{
    11. position: fixed;
    12. width: 100%;
    13. height: 100%;
    14. top: 0;
    15. left: 0;
    16. background-color: #f4f4f4;
    17. z-index: -1;
    18. }
    19. <style>

    实战-PC web登录页

    实战-小程序登录

    1. <template>
    2. <view class="container">
    3. <image class="bg-img" :src="imgSrc">image>
    4. <view class="content">view>
    5. view>
    6. template>
    7. <script>
    8. export default {
    9. name: "index",
    10. data() {
    11. return {
    12. imgSrc: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-59f27697-00c5-4f1e-8c67-bb56e1e19e78/653c2495-cb7b-49a7-b6cb-f048e16fa5a7.jpg',
    13. }
    14. }
    15. }
    16. script>
    17. <style>
    18. .bg-img {
    19. position: fixed;
    20. width: 100%;
    21. height: 100%;
    22. top: 0;
    23. left: 0;
    24. z-index: -1;
    25. }
    26. style>

  • 相关阅读:
    VScode开发STM32/GD32单片机-环境搭建
    LoRaWan模块应用于智慧城市景观灯
    【C语言】归并排序
    LeetCode 2731. 移动机器人【脑筋急转弯,排序,前缀和】1922
    《沟通的方法》作者序读后感
    nginx-日志
    iOS pod install 失败深度解决方案
    【网络安全 --- 任意文件下载漏洞(1)】任意文件下载漏洞
    Linux操作系统资源(持续更新...)
    WordPress主题网站首页添加好看的四格小工具教程
  • 原文地址:https://blog.csdn.net/u013302168/article/details/128106718