as the title
!important
but if I write this, I can overwrite the following, which can take effect. Is there a big god to explain?
ask for a big god answer
I posted the whole code
< html lang= "en" >
< head >
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script src="https://unpkg.com/vue"></script>
<link rel="stylesheet" href="./test.less">
<!-- -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://unpkg.com/element-ui@2.0.8/lib/index.js"></script>
< / head >
< body >
<div id="app">
<template>
<el-table :data="tableData2" style="width: 100%" :row-class-name="tableRowClassName" :header-row-class-name="demo" border :header-row-class-name="demo">
<el-table-column prop="date" label="" width="180">
</el-table-column>
<el-table-column prop="name" label="" width="180">
</el-table-column>
<el-table-column prop="address" label="">
</el-table-column>
</el-table>
</template>
</div>
<style>
.el-table .warning-row {
background: oldlace;
}
.el-table .success-row {
background: -sharpf0f9eb;
}
.el-table th, .el-table tr.demo {
background-color: -sharp0f0!important;
}
/* .el-table th, .el-table tr.demo{
background: red;
} */
</style>
<script>
var Main = {
methods: {
tableRowClassName({
row,
rowIndex
}) {
if (rowIndex === 1) {
return "warning-row";
} else if (rowIndex === 3) {
return "success-row";
}
return "";
},
demo({row, rowIndex}){
return "demo";
}
},
data() {
return {
tableData2: [{
date: "2016-05-02",
name: "",
address: " 1518 ",
}, {
date: "2016-05-04",
name: "",
address: " 1518 "
}, {
date: "2016-05-01",
name: "",
address: " 1518 ",
}, {
date: "2016-05-03",
name: "",
address: " 1518 "
}]
}
}
}
var Ctor = Vue.extend(Main)
new Ctor().$mount("-sharpapp")
</script>
< / body >
< / html >