The Dom part

<div :key="index" @click="clickProject(item)" class="display-style list-item" v-for="(item,index) in mapList">
              <p style="text-align: left; padding-left: 10px">{{ item.project_name }}</p>
              <p style="text-align: center; padding-left: 10px">{{ item.templateTypeName }}</p>
              <p style="text-align: right"><span :style="getColor(item.status)">{{ item.status | formatStatus }}</span></p>
            </div>
Copy the code

Calculate attribute

computed: {
    getColor() {
      return (value) = > {
        let bgColor = value===0?"#3699FF":value===1?"#00C09A":value===2?"#AAB9CC":"#FF8B35";
        return {'background-color': bgColor}; }}}Copy the code

Computed does not accept parameters, but if you need to pass parameters you can use closures, return a function that accepts parameters, and there you go