Click vue text color

Figure style:

 

 

html:

 <div :key="index" v-for="(item, index) in standing" class="Category">
      <label
        class="Planning"
        v-bind:class="{ updata_clable: IsIndex === index }"
        @click="change(index)"
        >{{ item.name }}</label
      >
    </div>

js:

<script>
export default {
  data() {
    return {
      standing: [
        Name {: " Lee now " },
        { name: "邓伦" },
        Name {: " Wang Junkai " },
        { name: "千玺" }
      ],
      Yandex: 0
    };
  },
  methods: {
    change: function(index) {
      this.IsIndex = index;
    }
  }
};
</script>

css:

.Planning {
  font-size: 14px;
  font - Family: DengXian;
  font-weight: bold;
  line-height: 14px;
  color: rgba(112, 112, 112, 1);
  opacity: 1;
  display: block;
  text-align: center;
}
.Category {
  width: 100%;
  height: 40px;
  margin-top: 10px;
}
.updata_clable {
  color: #19874f;
}

v-bind element is used to bind and attribute data

Guess you like

Origin www.cnblogs.com/lovebear123/p/12132898.html