开源地址:https://github.com/fdddf/vue3-aplayer
项目fork自 https://github.com/SevenOutman/vue-aplayer
适配vue3,需要vue3.0.7支持,更新了相关依赖。
2篇 vue related articles
开源地址:https://github.com/fdddf/vue3-aplayer
项目fork自 https://github.com/SevenOutman/vue-aplayer
适配vue3,需要vue3.0.7支持,更新了相关依赖。
如下,button1 按下后想触发 button 2 的click事件,可以这样做:
<template>
<button type="primary" @click="event2" ref="myBtn">
button 2
</button>
<button type="primary" @click="event1">
button 1
</button>
</template>
<script>
export default {
methods: {
event1($event) {
this.$refs.myBtn.$el.click()
}
}
}
</script>
这里注意是用this.$refs.myBtn.$el.click()
,而不是this.$refs.myBtn.click()
。