<template>
<input class="content" @tap="testFunc" type="text" :disabled="testDisabled" :focus="testFocus" />
</template>
<script>
export default {
data() {
return {
testDisabled: true,
testFocus: false
}
},
methods: {
testFunc() {
var self = this;
console.log('点击了');
this.testDisabled = false;
setTimeout(() => {
console.log('获取焦点中');
self.testFocus = true;
}, 500)
}
}
}
</script>
<style>
.content {
display: flex;
width: 700rpx;
height: 100rpx;
margin: 0 auto;
border: 1px solid red;
}
</style>