为什么无论我在input框里输什么提交都显示空的?

来源:4-2 使用vue-cli开发TodoList

学习来

2020-03-09 20:12

<template>

<div>

<div>

<h1>Todolist</h1>

<br />

<input v-model="inputvelue" />

<button @click="handleClick" :key="index" :content="item" :index="index" @delete="handledelete">提交</button>

</div>

<ul>

<todo-item v-for="(item, index) of list ">


</todo-item>

</ul>

</div>

</template>


<script>

import todo from './components/todo.vue'


export default {

components: {

'todo-item': todo

},

data: function() {

return {

inputvelue: '',

list: []

}

},

methods: {

handleClick() {

this.list.push(this.inputvelue)

this.inputvelue = ''

},

handledelete(index) {

this.list.splice(index, 1)

}

}

}

</script>


<style>


</style>










<template>

<li @click="handledelete">{{comtent}}</li>

</template>


<script>

export default {

props: ['content', 'index'],

methods: {

handledelete() {

this.$emit('delete', this.index)

}

}

}

</script>


<style scoped>


</style>




下面是子组件

写回答 关注

1回答

  • 学习来
    2020-03-09 20:38:05

    已解决

vue2.5入门

快速理解Vue编程理念上手Vue2.0开发。

146231 学习 · 657 问题

查看课程

相似问题