screen_rotation
Copied to Clipboard
<script type="importmap"> { "imports": { "vue": "https://unpkg.com/vue@3/dist/vue.esm-browser.js" } } </script> <div id="app"> <button @click="toggleColor" :class="[btnClass, 'my-btn']">Toggle Color</button> </div> <script type="module"> import { createApp } from 'vue' createApp({ data() { return { btnClass: "red-color", } }, methods:{ toggleColor() { if(this.btnClass === "red-color") { this.btnClass = "yellow-color"; } else { this.btnClass = "red-color"; } } } }).mount('#app') </script> <style> .my-btn { padding:10px 150px; color: #fff; border: none; } .red-color { background: red; } .yellow-color { background: yellow; } </style>