Vue.js: Conditional class style binding

后端 未结 5 815
难免孤独
难免孤独 2020-11-28 08:51

I have some data that is accessible via:

{{ content[\'term_goes_here\'] }}

... and this evaluated to either true or fals

5条回答
  •  误落风尘
    2020-11-28 09:38

    
    

    and add in computed :

    computed: {
        cravings: function() {
            return this.content['cravings'] ? 'fa-checkbox-marked' : 'fa-checkbox-blank-outline';
        }
    }
    

提交回复
热议问题