vue實現單擊選中效果
阿新 • • 發佈:2020-12-23
技術標籤:vue教程
<button type="button" class="changeBtn" :class="{'activeBtn':isLife}" @click="isLife = !isLife">抬動</button> <style> .formText .changeBtn{ margin-left: 1.2rem; color: #aeaeae; border-color: #939393; background: #fff; } .formText .activeBtn{ color: #fff; border-color: #2b73c9; background: #2b73c9; } </style> <script> export default { data() { return { isLife:false, } } } </script>
效果圖: