<template>
<view class="content">
<input type="number" maxlength="4" @input='moveNext' /> <text>年</text>
<input type="number" maxlength="2" ref="monthInput"/> <text>月</text>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello'
}
},
onLoad() {
},
methods: {
moveNext(e) {
console.log(e)
if(e.detail.value.length == 4){
console.log(this.$refs.monthInput)
this.$refs.monthInput.focus()
//this.$refs.monthInput.focus = true
//这样的写法却可以但是报警告
}
}
}
}
</script>
我这边可以啊,为啥呢?