refactor(frontend): use composition api

This commit is contained in:
syuilo 2023-05-14 12:23:39 +09:00
parent 3d4a90b08a
commit 0717afc312
8 changed files with 495 additions and 621 deletions

View file

@ -7,17 +7,17 @@ export default defineComponent({
required: true,
},
},
render() {
const options = this.$slots.default();
setup(props, { emit, slots }) {
const options = slots.default();
return h('div', {
return () => h('div', {
class: 'pxhvhrfw',
}, options.map(option => withDirectives(h('button', {
class: ['_button', { active: this.modelValue === option.props.value }],
class: ['_button', { active: props.modelValue === option.props.value }],
key: option.key,
disabled: this.modelValue === option.props.value,
disabled: props.modelValue === option.props.value,
onClick: () => {
this.$emit('update:modelValue', option.props.value);
emit('update:modelValue', option.props.value);
},
}, option.children), [
[resolveDirective('click-anime')],