vue:异步async and await与this.nextTick()的使用

项目例子:

async focusInput (index) {
  await this.$nextTick(() => {
    let el = this.$refs[`scopeInput-${index}`].$el
    let input = el.querySelector('.el-input__inner')
    input.focus()
  })
},

<el-input
  @blur="blurInput"
  @keyup.native="enterInput"
  :ref="`scopeInput-${scope.$index}`"
  v-model="coursePrice"
  size="small">
</el-input>

猜你喜欢

转载自blog.csdn.net/weixin_41143662/article/details/84303377