I have three div elements that I want to access. I set the same ref value on all three divs, but when trying to retrieve these elements in Vue, the elements variable is empty. WHAT I am expecting here is an array of three div elements with the same ref value.
我的同仁会对这个问题有何影响? 还是我试图以错误的方式对待这些因素?
<template>
<div class="container">
<div ref="newsletterElement">
Element1
</div>
<div ref="newsletterElement">
Element2
</div>
<div ref="newsletterElement">
Element2
</div>
</div>
</template>
<script>
export default {
name: Test ,
mounted() {
const elements = this.$refs.newsletterElement;
console.log(elements);
}
}
</script>