Home Web Front-end JS Tutorial How to set the background color for a separate page in Vue-cli

How to set the background color for a separate page in Vue-cli

Jun 06, 2018 am 10:25 AM
vue-cli background color set up

Below I will share with you an implementation method of setting the background color for a separate page in Vue-cli. It has a good reference value and I hope it will be helpful to everyone.

Example:

<template>
 <p class="finish-wrap">
  <p class="finish-header">
   <p class="finish-img">
   </p>
  </p>
  <p class="finish-tip">
   支付成功
  </p>
  <p class="finish-footer">
    <router-link to="/">学车所需资料</router-link>
    <span>
     <router-link to="/">学车考照流程</router-link>
    </span>
  </p>
 </p>
</template>
Copy after login

1. If you set the background-color of the body directly in css, it will cause the background color of other pages to change accordingly. , so it is not advisable;

2. As in the above example, if you set the background color and height of .finish-wrap to 100%, you will find that only a part of the background color is changed, but the background color of the entire screen cannot be changed. ;

Reason: Open app.vue, you will see

<template>
    <p>
     <router-view></router-view>
    </p>
   </template>
Copy after login

The reason is that there is another layer of p here, so what you change is not The background color of the outermost p, but you cannot modify it here, so:

Solution:

We need to make .finish- Wrap is separated from the document flow and adds a fixed attribute to it. The final result is:

.finish-wrap
background-color rgb(255,255,255)
height: 100%
position: fixed
width: 100%
Copy after login

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

How to implement the password display and hide switching function in vue

Interpret this.$ in detail in vue.js How to use emit

#How to use the modifier .self in vue.js?

The above is the detailed content of How to set the background color for a separate page in Vue-cli. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to set the scheduled time for publishing works on Douyin? How does it set the video duration? How to set the scheduled time for publishing works on Douyin? How does it set the video duration? Mar 27, 2024 pm 06:11 PM

How to set the scheduled time for publishing works on Douyin? How does it set the video duration?

Where is the Douyin tag set? How can it be tagged so that it can be pushed accurately? Where is the Douyin tag set? How can it be tagged so that it can be pushed accurately? Mar 27, 2024 am 11:01 AM

Where is the Douyin tag set? How can it be tagged so that it can be pushed accurately?

Setting up Chinese with VSCode: The Complete Guide Setting up Chinese with VSCode: The Complete Guide Mar 25, 2024 am 11:18 AM

Setting up Chinese with VSCode: The Complete Guide

How to set the watermark in the middle on Weibo_How to set the watermark in the middle on Weibo How to set the watermark in the middle on Weibo_How to set the watermark in the middle on Weibo Mar 29, 2024 pm 03:31 PM

How to set the watermark in the middle on Weibo_How to set the watermark in the middle on Weibo

Do Not Disturb Mode Not Working in iPhone: Fix Do Not Disturb Mode Not Working in iPhone: Fix Apr 24, 2024 pm 04:50 PM

Do Not Disturb Mode Not Working in iPhone: Fix

Where to set Douyin recommendations and selections Where to set Douyin recommendations and selections Mar 27, 2024 pm 05:06 PM

Where to set Douyin recommendations and selections

How to set up scheduled publishing on Weibo_Tutorial on how to set up scheduled publishing on Weibo How to set up scheduled publishing on Weibo_Tutorial on how to set up scheduled publishing on Weibo Mar 29, 2024 pm 03:51 PM

How to set up scheduled publishing on Weibo_Tutorial on how to set up scheduled publishing on Weibo

How to set the countdown to grab tickets in Damai How to set the countdown to grab tickets in Damai Apr 01, 2024 pm 07:01 PM

How to set the countdown to grab tickets in Damai

See all articles