Z
Z
Zubastik_12017-10-12 12:15:47
Vue.js
Zubastik_1, 2017-10-12 12:15:47

How to add disable value to button in vue.js?

I found an example https://jsfiddle.net/asemahle/eo8kd2wd/
But I would like to know how to do this by the condition that the textarea is empty?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Gontarev, 2017-10-12
@Zubastik_1

<template>
    <div>
        <textarea v-model="comment"></textarea>
        <button :disabled="!comment">send</button>
    </div>
</template>

<script>
    export default {
        name: 'my-component',
        data() {
            return {
                comment: ''
            }
        }
    }
</script>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question