component code:
<template>
<el-input
v-model="val"
:placeholder="tip"
size="small"
clearable
@keyup.enter.native="echo()">
</el-input>
</template>
<script>
export default {
props:["tip"],
data () {
return {
val:""
}
},
methods:{
echo:function(){
alert(val)
}
}
}
</script>
Why do you always prompt: val is not defined? every time you press enter? Haven"t I already defined val