How to return boolean and not string when using select?

Viewed 12275

I have this:-

            <div class="form-group">
                <label for="">Allow Multiple</label>
                <select class="form-control" v-model="allowMultiple">
                    <option value=true>Yes</option>
                    <option value=false>No</option>
                </select>
            </div>

I set allowMultiple=true when I initialize it, but when I select No then allowMultiple='false' So its no longer a Boolean but a String? How to get it to be Boolean?

4 Answers

The easier and quicker way I found that works for me is this:

<select id="selected" v-model="item.selected">
    <option :value=0>No</option>
    <option :value=1>Yes</option>
</select>

Maybe it's useful for anyone.

Related