This is the 30th day of my participation in the Wenwen Challenge

It was the last day. Looking back at the month, I didn’t think I could stick to it. Every day I was very busy, and I forced myself to spend all my time without watching TV, playing games or doing anything meaningless. Sometimes I’m writing code while pasting it into the Markdown editor (thanks MWeb for saving me a lot of trouble).

There is still a bit of water today, but I will focus on the optimization of Warning. Look at the remaining 21 warnings tonight.

Look at VSCode to see which line is on:

Compared with more than 50 before, it is a lot less, really a little happy ~

Optimization of the events

Take a look at this case:

In fact, the events array is in the child component, and we have the Type defined in the FullCalendar:

// FullcalendarSub.vue

import type {
  CalendarApi,
  CalendarOptions,
  DateSelectArg,
  EventClickArg,
  EventInput,
  EventSourceInput,
  DateRangeInput,
  DateInput,
  DayCellContentArg,
} from '@fullcalendar/vue3';

  props: {
    changeShowFestivals: Boolean,
    changeShowWeather: Boolean,
    events: {
      type: Array,
      default: [] as EventInput[],
    },
  },
Copy the code

So you need to go back to the python python python API to find the data returned by the python python API. Incidentally, our EventService returns a result without a return type.

So you can refactor it all together.

Take a look at the EventInput trace code:

declare const EVENT_REFINERS: {
    extendedProps: Identity<Dictionary>;
    start: Identity<DateInput>;
    end: Identity<DateInput>;
    date: Identity<DateInput>;
    allDay: BooleanConstructor;
    id: StringConstructor;
    groupId: StringConstructor;
    title: StringConstructor;
    url: StringConstructor;
};
Copy the code

It contains these parameters, so we can directly as:

// EventService.ts import type { EventInput } from '@fullcalendar/vue3'; list2Events(results: []): EventInput[] { const events = results.map((element: any) => { return { 'id': element.id, 'title': element.properties? .title? .rich_text[0].plain_text, 'start': element.properties? .start? .date.start, 'end': element.properties? .end? .date.start, } as EventInput; }); return events; }Copy the code

Then back on the Main page, we redefine our events in data:

// FullCalendarMain.vue

  data() {
    return {
      location: {},
      changeShowFestivals: false,
      changeShowWeather: false,
      visibleFullDateView: false,
      date: new Date(),
      visibleECSub: false,
      events: [] as EventInput[],
      event: null as EventInput,
Copy the code

Run yarn Lint and see:

There were a few short moments.

summary

These two days did stick to the limit, I wanted to continue to optimize and eliminate all the warnings, but it was a little too much. I think I need a good rest for a few days from tomorrow.

End of this phase!!

The code has been synced to Github: github.com/fanly/fanly…