vue中class样式与内联样式
(1):style使用
<div class="score" :style="{ color: colorComputed(item.status) }">{{item.score}}</div>
computed: {
colorComputed() {
return (status) => {
if (status === 1 || status === 2) {
return '#FF1E00';
}
if (status === 3 || status === 4) {
return '#F7B500';
}
if (status === 5) {
return '#00DA62';
}
};
}
},
<template slot-scope="scope">
<span :style="{ color: colorComputed(scope.row.hegezhuangtai) }">{{ scope.row.shijiedefen }}-{{ scope.row.hegezhuangtai }}</span>
</template> computed: {
colorComputed() {
return (text) => {
if (text === '优秀') {
return '#00AE65';
}
if (text === '良好') {
return '#FA8C15';
}
if (status === '不合格') {
return '#E62512';
}
};
}
},
(2):class用法
<i
class="my-radio"
:class="[thirdItem.isChecked ? 'is-checked' : '']"
@click="selectScore(shipInfo,item, subItem, thirdItem)"
></i>
<ul class="position-nav" :class="{'fixed-menu': fixedMenu}" v-if="shipInfos.length>0">
<li
class="nav-item"
:class="menuClickIndex === index ? 'active' : ''"
@click="clickMenu(index)"
v-for="(shipInfo, index) in shipInfos"
:key="index"
>
{{ shipInfo.yinsufenlei }}({{ shipInfo.quanzhong }})
</li>
</ul>
vue中class样式与内联样式的更多相关文章
- wxss--外联样式与内联样式
外联样式 有样式表a.wxss和index.wxss如下: /**a.wxss**/ .container1{ border: 1px solid #000; } /**index.wxss**/ . ...
- vue中,class、内联style绑定、computed属性
1.绑定Class ①对象语法 <li :class="{ 'active': activeIdx==0 }" @click="fnClickTab(0)" ...
- JS获取内联样式
JS获取内联样式 //获取内联样式 function getCss(obj,attr){//obj:对象,name:style属性 if(obj.currentStyle) { return obj. ...
- vue 内联样式style中的background
在我们使用vue开发的时候 有很多时候我们需要用到背景图 这个时候会直接使用 内联样式 直接把你拿到的数据拼接上去 注意 在vue中直接使用style时 花括号一定别忘记 还有就是你的url一定 ...
- Vue 内联样式的数据绑定
Vue 内联样式的数据绑定 之前学的是数据绑定 class,现在可以将数据绑定到 style 中. <div id="app"> <div v-bind:styl ...
- react中内联样式的z-index不起作用.
<div style={{z-index: -100}} > hello,money. </div> 以上z-index样式如上写法是不起作用,原因是在react中内联样式的写 ...
- Vue.js style(内联样式)
Vue.js style(内联样式) 我们可以在 v-bind:style 直接设置样式: <div id="app"> <div v-bind:style=&q ...
- Vue学习之路第十二篇:为页面元素设置内联样式
1.有了上一篇的基础,接下来理解内联样式的设置会更简单一点,先看正常的css内联样式: <dvi id="app"> <p style="font-si ...
- vue 绑定 class 和 内联样式(style)
<div id="app31"> <!--多个属性 ,号隔开--> <!-- v-bind:style="{fontSize: fontSi ...
- Vue 内联样式
前置说明 Vue 绑定HTML 全局属性style,可以动态地改变属性值.这里就不讲内联样式的基础了,具体轻查看官网文档 Class 与 Style 绑定. 主要分为以下两个步骤进行: v-bind ...
随机推荐
- Redis本地安装以及使用(详细教程)
Redis 安装 Windows 下载安装 Redis默认端口:6379 整个过程如下: 1.下载连接 https://github.com/tporadowski/redis/releases Re ...
- [ABC261E] Many Operations
Problem Statement We have a variable \(X\) and \(N\) kinds of operations that change the value of \( ...
- 带圆角的虚线边框?CSS 不在话下
今天,我们来看这么一个非常常见的切图场景,我们需要一个带圆角的虚线边框,像是这样: 这个我们使用 CSS 还是可以轻松解决的,代码也很简单,核心代码: div { border-radius: 25p ...
- CISC与RISC
- Vite4+Typescript+Vue3+Pinia 从零搭建(7) - request封装
项目代码同步至码云 weiz-vue3-template 基于 axios 封装请求,支持多域名请求地址 安装 npm i axios 封装 utils 目录下新建 request 文件夹,并新建 i ...
- 36. 干货系列从零用Rust编写负载均衡及代理,内网穿透中内网代理的实现
wmproxy wmproxy已用Rust实现http/https代理, socks5代理, 反向代理, 静态文件服务器,四层TCP/UDP转发,七层负载均衡,内网穿透,后续将实现websocket代 ...
- 【2】从零玩转OSS阿里云存储服务之Java代码操作-2-cong-ling-wan-zhuan-oss-a-li-yun-cun-chu-fu-wu-zhi-java-dai-ma-cao-zuo
title: [2]从零玩转OSS阿里云存储服务之Java代码操作 date: 2021-06-09 17:37:14.486 updated: 2021-12-26 17:43:12.779 url ...
- 斯坦福 UE4 C++ ActionRoguelike游戏实例教程 05.认识GameMode&自动生成AI角色
斯坦福课程 UE4 C++ ActionRoguelike游戏实例教程 0.绪论 概述 本篇文章将会讲述UE中Gamemode的基本概念,并在C++中开发GameMode,为游戏设置一个简单的玩法:使 ...
- 2023-05-30:Redis6.0为什么要引入多线程呢?
2023-05-30:Redis6.0为什么要引入多线程呢? 答案2023-05-30: Redis多线程比单线程性能提升一倍: Redis 6.0 引入多线程 IO 特性对性能提升至少是一倍以上.据 ...
- 9、线性布局(Row和Column)
自定义的IconContainer void main() { runApp(MaterialApp( theme: ThemeData(primarySwatch: Colors.yellow), ...