原生:

document.getElementById('input').focus();

vue:

this.$nextTick(() => {
this.$refs.input.focus()
})

uni-app:

<input ref="huifu" v-model="content" :focus="focusState" type="text" />
this.focusState = false;
this.$nextTick(function() {
	this.focusState = true;
});
Logo

前往低代码交流专区

更多推荐