Skip to content

切换图标,例如单选框的打钩和不打钩

<i :class="[!show ? 'icon iconfont iconopeneye' : 'icon iconfont iconcloseeye']"
  @click="onChange"></i>


 <script>
    export default {
        data() {
            return {
                show: true
            }
        },
        methods: {
            onChange: function() {
                this.show = !this.show;
            }
        }
    }
</script>
<i :class="[!show ? 'icon iconfont iconopeneye' : 'icon iconfont iconcloseeye']"
  @click="onChange"></i>


 <script>
    export default {
        data() {
            return {
                show: true
            }
        },
        methods: {
            onChange: function() {
                this.show = !this.show;
            }
        }
    }
</script>

程序员小洛文档