单击按钮后如何清除 VueJS 中的输入文本?

How can I clear my input text in VueJS after a button is clicked?

我希望输入框中的文本在按下输入按钮并将 addTask 函数添加到列表后清除。我尝试了 document.getElementById("inp").innerHTML = "" 但它没有用。我该怎么做?

HTML:

<div id="todo">
    <h1>To-Do List</h1>
    <section>
        <input type="input" placeholder="what do you need to do?" v-model="newTask" v-on:keyup.enter="addTask" id="inp">
    </section>

    <ul>
        <li v-for="task in todoList">
            <label>{{ task }}</label>
            <button type="button" v-on:click="removeTask(task)">X</button>
        </li>
    </ul>

</div>

VueJS:

var todo = new Vue({
    el: 'div#todo',
    data: {
        newTask:'',
        todoList: []
    },
    methods: {
        addTask: function() {
            var task = this.newTask
            this.todoList.push(task)
        },
        removeTask: function(task) {
            var index = this.todoList.indexOf(task)
            this.todoList.splice(index, 1)
        }

    }
})

清除您的模型:

addTask: function() {
                var task = this.newTask
                this.todoList.push(task)

                this.newTask = ''
            }