chore: prefer arrow function shorthand

This commit is contained in:
chenjiahan
2021-03-02 17:45:12 +08:00
parent 2fd0d54da1
commit a0addef294
42 changed files with 98 additions and 249 deletions
+3 -8
View File
@@ -65,18 +65,15 @@ export default createComponent({
emits: ['cancel', 'select', 'update:show'],
setup(props, { emit, slots }) {
const toggle = (value: boolean) => {
emit('update:show', value);
};
const toggle = (value: boolean) => emit('update:show', value);
const onCancel = () => {
toggle(false);
emit('cancel');
};
const onSelect = (option: ShareSheetOption, index: number) => {
const onSelect = (option: ShareSheetOption, index: number) =>
emit('select', option, index);
};
const renderHeader = () => {
const title = slots.title ? slots.title() : props.title;
@@ -103,9 +100,7 @@ export default createComponent({
role="button"
tabindex={0}
class={[bem('option'), className]}
onClick={() => {
onSelect(option, index);
}}
onClick={() => onSelect(option, index)}
>
<img src={getIconURL(icon)} class={bem('icon')} />
{name && <span class={bem('name')}>{name}</span>}