How does vue control the click events that trigger el-button through js?

html:

<el-button ref="inputResult" @click="inputResult"></el-button>

js:

this.$nextTick(() => {
    this.$refs.inputResult.click()
})

error log:

Vue warn]: Error in nextTick: "TypeError: _this.$refs.inputResult.click is not a function"

how to trigger the click time of el-button through js?

May.14,2021

I don't understand why not directly

 this.inputResult()

, do you have to rely on the event of button to trigger it?

-asseek 5 days ago
replied to asseek:
@ asseek brain seems to have a short circuit.

-coder94 5 days ago


this.$refs.inputResult.$emit('click')


Menu