I trying to pass variable tab in showTab in x-for my code look like this
<div x-data ="tabs">
<ul >
<template x-for="tab in items">
<li>
<button @click="showtabs('tab')"></button>
<button x-text= "tab" @click="tab.current = 'second'"></button>
</li>
</template>
</ul>
<div x-show='current'>
fsfsdfds
</div>
<div x-show='current'>
nice
</div>
in my script below I want to pass parameters in showtab()
document.addEventListener('alpine:init', () => {
Alpine.data('tabs', () => ({
open: false,
current: 'first',
items: ['first', 'second'],
showtabs(data_id){
for(keys in items){
var obj = items[keys]
if(obj == data_id){
}
}
}
}))
})