JSFiddle - React, Tailwind, and code Playground
by skirtle
HTML
<script src="https://unpkg.com/[email protected]/dist/vue.js"></script>
<div id="app">
<button v-for="(item, index) in arr" :ref="index === arr.length - 4 ? 'myRef' : null">
{{ item }}
</button>
</div>
JavaScript
new Vue({
el: '#app',
data () {
return {
arr: [4, 5, 6, 7, 8, 9, 10]
}
},
mounted () {
console.log(this.$refs.myRef[0].innerHTML)
}
})