Files
mixtape/zero.Web.UI/App/components/tabs/tab.vue
T

76 lines
1.2 KiB
Vue
Raw Normal View History

2020-04-08 13:52:45 +02:00
<template>
2020-06-24 11:53:20 +02:00
<section v-show="active" class="ui-tab" :aria-hidden="!active" role="tabpanel">
2020-04-08 13:52:45 +02:00
<slot />
</section>
</template>
<script>
import Strings from 'zero/helpers/strings.js';
2020-09-09 13:43:01 +02:00
2020-04-08 13:52:45 +02:00
export default {
name: 'uiTab',
props: {
label: {
type: String,
required: true
},
count: {
type: Number,
default: 0
},
disabled: {
type: Boolean,
default: false
}
},
data: () => ({
2020-09-09 13:43:01 +02:00
id: null,
2020-06-17 11:34:32 +02:00
loaded: false,
2020-09-09 13:43:01 +02:00
active: false,
2020-10-01 16:06:44 +02:00
hasErrors: false,
countOutput: 0
2020-04-08 13:52:45 +02:00
}),
2020-06-17 11:34:32 +02:00
watch: {
active(val)
{
this.loaded = true;
2020-10-01 16:06:44 +02:00
},
count(val)
{
this.countOutput = val;
2020-06-17 11:34:32 +02:00
}
},
2020-10-01 16:06:44 +02:00
created()
2020-04-08 13:52:45 +02:00
{
2020-09-09 13:43:01 +02:00
this.id = Strings.guid();
2020-06-17 11:34:32 +02:00
this.loaded = this.active;
2020-10-01 16:06:44 +02:00
this.countOutput = this.count;
2020-04-08 13:52:45 +02:00
},
methods: {
2020-10-01 16:06:44 +02:00
setCount(count)
{
this.countOutput = count;
},
2020-09-09 13:43:01 +02:00
// set and display errors
setErrors(errors, append)
{
this.hasErrors = !!errors;
},
// clear errors and hide
clearErrors()
{
this.hasErrors = false;
}
2020-04-08 13:52:45 +02:00
}
}
</script>