SoFunction
Updated on 2025-04-03

Table highlighting or font color change operations in vue+elementUI

Key code:

:row-style="setRowStyle" is bound to the table tag

:row-style="setRowStyle"

// Just add this method directly to methods, the page will be called automaticallysetRowStyle(row) {
   if ( == true) {
    return 'color:blue;'
   }
  },

Specific code:

hmtl

<el-table width="100%" :data="gridData" border fit highlight-current-row :header-cell-style="{background:'#199ED8'}" :row-style="setRowStyle">
 <el-table-column label="Serial Number" type="index"></el-table-column>
 </el-table>

Just call the method in js

setRowStyle(row) {
   if ( == true) {
    return 'color:blue;'
   }
  },

Supplementary knowledge:vue+element-ui form el-input cannot be entered during the second modification

Since the new and modified use the same pop-up window, when modifying and submitting, you need to clear the value in the input box.

When submitting, you cannot just set the parent object formData to an empty object. That is, = {} is wrong

The correct way to write it is

= {name: '' }

reason:If set to empty, it is undefined and the value will not be assigned at this time.

   <el-form ref="popupContent" :model="formData" :rules="popupContentRules">
    <el-row>
     <el-form-item label="Name" label-width="80px" prop="name">
      <el-input name="name" @="judge" v-model=""/>
     </el-form-item>
    </el-row>
   </el-form>

The above article on the table highlighting or font color change operations in vue+elementUI is all the content I share with you. I hope you can give you a reference and I hope you can support me more.