<template>
<div>
<input @keypress.enter="setLocation" class="search" type="text" placeholder="find a city" v-model="newCity">
</div>
<script>
export default {
props:['city'],
data(){
return{
newCity:""
}
},
methods:{
setLocation(event){
this.city = newCity
this.$emit('newLocation', this.city)
}
}
}
当我尝试提交它时,它表示未定义newCity。 他们在Vue.js更新中更改了v-model属性吗?