JSFiddle - React, Tailwind, and code Playground

HTML

<div id="app">
  <ul>
    <li :class="chapouu">A</li>
    <li :class="chapouu">B</li>
    <li>C</li>
    <li>D</li>
  </ul>
  <button @click="toggle">Toggle</button>
</div>

CSS

.red {
  background: red
}

JavaScript

new Vue({
	el: '#app',
  computed: {
  	chapouu () {
    	return [this.className]
    }
  },
  data: () => ({
  	className: ''
  }),
  methods: {
  	toggle () {
    	this.className = this.className === '' ? 'red' : ''
    }
  }
})