2020-07-27 04:34:20 +00:00
|
|
|
<script lang="ts">
|
2020-11-17 05:59:15 +00:00
|
|
|
import { defineComponent, h, resolveDirective, withDirectives } from 'vue';
|
2020-07-27 04:34:20 +00:00
|
|
|
|
2020-10-17 11:12:00 +00:00
|
|
|
export default defineComponent({
|
2020-07-27 04:34:20 +00:00
|
|
|
props: {
|
2021-09-29 15:50:45 +00:00
|
|
|
modelValue: {
|
2020-07-27 04:34:20 +00:00
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
2020-11-17 05:59:15 +00:00
|
|
|
render() {
|
|
|
|
const options = this.$slots.default();
|
|
|
|
|
|
|
|
return withDirectives(h('div', {
|
|
|
|
class: 'pxhvhrfw',
|
2021-04-24 13:36:28 +00:00
|
|
|
}, options.map(option => withDirectives(h('button', {
|
2021-10-01 10:34:24 +00:00
|
|
|
class: ['_button', { active: this.modelValue === option.props.value }],
|
2021-07-19 14:30:12 +00:00
|
|
|
key: option.key,
|
2021-10-01 10:34:24 +00:00
|
|
|
disabled: this.modelValue === option.props.value,
|
2020-11-17 05:59:15 +00:00
|
|
|
onClick: () => {
|
2021-10-01 10:34:24 +00:00
|
|
|
this.$emit('update:modelValue', option.props.value);
|
2020-11-17 05:59:15 +00:00
|
|
|
}
|
2021-04-24 13:36:28 +00:00
|
|
|
}, option.children), [
|
|
|
|
[resolveDirective('click-anime')]
|
|
|
|
]))), [
|
2020-11-17 05:59:15 +00:00
|
|
|
[resolveDirective('size'), { max: [500] }]
|
|
|
|
]);
|
|
|
|
}
|
2020-07-27 04:34:20 +00:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2020-11-17 05:59:15 +00:00
|
|
|
<style lang="scss">
|
2020-07-27 04:34:20 +00:00
|
|
|
.pxhvhrfw {
|
|
|
|
display: flex;
|
2021-04-22 13:29:33 +00:00
|
|
|
font-size: 90%;
|
2020-07-27 04:34:20 +00:00
|
|
|
|
|
|
|
> button {
|
|
|
|
flex: 1;
|
2020-10-17 11:12:00 +00:00
|
|
|
padding: 15px 12px 12px 12px;
|
2020-07-27 04:34:20 +00:00
|
|
|
border-bottom: solid 3px transparent;
|
|
|
|
|
2020-11-01 05:05:06 +00:00
|
|
|
&:disabled {
|
|
|
|
opacity: 1 !important;
|
|
|
|
cursor: default;
|
|
|
|
}
|
|
|
|
|
2020-07-27 04:34:20 +00:00
|
|
|
&.active {
|
|
|
|
color: var(--accent);
|
|
|
|
border-bottom-color: var(--accent);
|
|
|
|
}
|
2020-07-28 01:08:08 +00:00
|
|
|
|
2020-11-01 05:05:06 +00:00
|
|
|
&:not(.active):hover {
|
|
|
|
color: var(--fgHighlighted);
|
|
|
|
}
|
|
|
|
|
2020-07-28 01:08:08 +00:00
|
|
|
> .icon {
|
|
|
|
margin-right: 6px;
|
|
|
|
}
|
2020-07-27 04:34:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
&.max-width_500px {
|
|
|
|
font-size: 80%;
|
2020-10-17 11:12:00 +00:00
|
|
|
|
|
|
|
> button {
|
|
|
|
padding: 11px 8px 8px 8px;
|
|
|
|
}
|
2020-07-27 04:34:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|