2022-01-04 17:41:36 -05:00
< template >
2022-01-05 11:19:51 -08:00
< div class = "bg-white grid place-content-center border-2 w-3/4 mx-auto" >
2022-01-06 14:28:23 -08:00
< div > Energy : { { $store . state . incremental . currency . energy } } < / div >
< div > Time : { { timecurrency } } < / div >
2022-01-04 17:41:36 -05:00
< nav class = "flex flex-col sm:flex-row" >
2022-01-05 11:19:51 -08:00
< button
id = "tab1"
class = "text-gray-600 py-4 px-6 block hover:text-blue-500 focus:outline-none text-blue-500 border-b-2 font-medium border-blue-500"
@ click = "tabclicked(1)"
>
Tab 1 < / b u t t o n
> < button
id = "tab2"
class = "text-gray-600 py-4 px-6 block hover:text-blue-500 focus:outline-none"
@ click = "tabclicked(2)"
>
Tab 2 < / b u t t o n
> < button
id = "tab3"
class = "text-gray-600 py-4 px-6 block hover:text-blue-500 focus:outline-none"
@ click = "tabclicked(3)"
>
Tab 3 < / b u t t o n
> < button
id = "tab4"
class = "text-gray-600 py-4 px-6 block hover:text-blue-500 focus:outline-none"
@ click = "tabclicked(4)"
>
Tab 4
< / button >
2022-01-04 17:41:36 -05:00
< / nav >
< JohnHacks id = "tabcontents1" class = "tabshown" / >
< InfinityTester id = "tabcontents2" class = "tabhidden" / >
< JohnHacks id = "tabcontents3" class = "tabhidden" / >
< JohnHacks id = "tabcontents4" class = "tabhidden" / >
2022-01-05 11:19:51 -08:00
< / div >
2022-01-04 17:41:36 -05:00
< / template >
< script >
2022-01-06 14:28:23 -08:00
import Decimal from "break_infinity.js"
2022-01-04 17:41:36 -05:00
export default {
2022-01-05 11:19:51 -08:00
name : 'TabNav' ,
data ( ) {
2022-01-06 14:28:23 -08:00
return {
energycurrency : new Decimal ( 0 ) ,
timecurrency : new Decimal ( 0 )
}
2022-01-05 11:19:51 -08:00
} ,
methods : {
tabclicked ( tabnumber ) {
const tabSelected =
'text-gray-600 py-4 px-6 block hover:text-blue-500 focus:outline-none text-blue-500 border-b-2 font-medium border-blue-500'
const tabDeselected =
'text-gray-600 py-4 px-6 block hover:text-blue-500 focus:outline-none'
console . log ( 'clicked ' + tabnumber )
for ( let i = 1 ; i <= 4 ; i ++ ) {
const tabE = document . getElementById ( 'tab' + i )
const viewE = document . getElementById ( 'tabcontents' + i )
if ( i === tabnumber ) {
tabE . className = tabSelected
viewE . className = 'tabshown'
} else {
tabE . className = tabDeselected
viewE . className = 'tabhidden'
2022-01-04 17:41:36 -05:00
}
2022-01-05 11:19:51 -08:00
}
} ,
2022-01-06 14:28:23 -08:00
increaseCurrency ( energy , time ) {
this . energycurrency = Decimal . add ( this . energycurrency , energy )
this . timecurrency = Decimal . add ( this . timecurrency , time )
} ,
2022-01-05 11:19:51 -08:00
} ,
2022-01-04 17:41:36 -05:00
}
< / script >
< style scoped >
. tabshown {
2022-01-05 11:19:51 -08:00
display : show ;
2022-01-04 17:41:36 -05:00
}
. tabhidden {
2022-01-05 11:19:51 -08:00
display : none ;
2022-01-04 17:41:36 -05:00
}
< / style >