[Vuejs]-Conditional within textarea tag

2👍

How about that?

<textarea 
    v-model="feedback_text"
    v-bind:placeholder='activity.feedback ? activity.feedback : "Leave some formative feedback"'
></textarea>

Demo:

var demo = new Vue({
    el: '#demo',
    data: {
        feedback_text: "",
        feedback_check: false
    },
    computed: {
        activity: function () {
          return this.feedback_check ? "You have checked that box" : false;
        }
    }
});
<script src="https://cdn.jsdelivr.net/npm/vue"></script>        
<div id="demo">
    <input type="checkbox" id="checkbox" v-model="feedback_check">
    <label for="checkbox">Test for computed changes</label>
    <textarea 
        v-model="feedback_text"
        v-bind:placeholder='activity ? activity : "Leave some formative feedback"'
    ></textarea>
</div>

Leave a comment