Home > Web Front-end > JS Tutorial > body text

vue2.0 changes the style display method based on the status value

亚连
Release: 2018-05-30 15:33:16
Original
2799 people have browsed it

Below I will share with you an article on how to change the display style of vue2.0 based on the status value. It has a good reference value and I hope it will be helpful to everyone.

When users perform process operations, they are generally divided into in-progress, not started, and completed. The front-end page must display corresponding status distinctions. What is tested here is background color distinction.

demo:

<span class="contract-span" :class="statusText[item.status][0]">{{statusText[item.status][1]}}</span>
Copy after login

   statusText: {
    0: [&#39;span-delay&#39;, &#39;进行中&#39;],
    1: [&#39;span-finish&#39;, &#39;已完成&#39;],
    2: [&#39;span-rough&#39;, &#39;未开始&#39;],
   },//显示状态
Copy after login

By assigning values ​​to status during loop traversal, you can display different background colors in different states.

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

Related articles:

Example of the function of uploading pictures to the database and displaying them on the page implemented by vue

Solution using vue. The problem of invalidity after js routing

How to perfectly parse data in js

The above is the detailed content of vue2.0 changes the style display method based on the status value. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!