types: optimize data types (#254)

This commit is contained in:
Fine0830
2023-04-06 21:50:57 +08:00
committed by GitHub
parent 8bb45bb453
commit 49a5481fb0
50 changed files with 263 additions and 213 deletions

View File

@@ -162,7 +162,7 @@ limitations under the License. -->
import { computed, onMounted, watch, reactive } from "vue";
import type { PropType } from "vue";
import { useI18n } from "vue-i18n";
/*global defineProps, defineEmits */
/*global defineProps, defineEmits, Indexable, Recordable*/
const emit = defineEmits(["input", "setDates", "ok"]);
const { t } = useI18n();
const props = defineProps({
@@ -191,7 +191,7 @@ limitations under the License. -->
minute: 0,
second: 0,
});
const get = (time: Date): { [key: string]: any } => {
const get = (time: Date): Indexable => {
return {
year: time.getFullYear(),
month: time.getMonth(),
@@ -390,7 +390,7 @@ limitations under the License. -->
state.year--;
}
};
const is = (e: any) => {
const is = (e: Recordable) => {
return e.target.className.indexOf(`${state.pre}-date-disabled`) === -1;
};
const ok = (info: any) => {

View File

@@ -54,7 +54,7 @@ limitations under the License. -->
import Trace from "@/views/dashboard/related/trace/Index.vue";
import associateProcessor from "@/hooks/useAssociateProcessor";
/*global Nullable, defineProps, defineEmits*/
/*global Nullable, defineProps, defineEmits, Indexable*/
const emits = defineEmits(["select"]);
const { t } = useI18n();
const chartRef = ref<Nullable<HTMLDivElement>>(null);
@@ -70,7 +70,7 @@ limitations under the License. -->
height: { type: String, default: "100%" },
width: { type: String, default: "100%" },
option: {
type: Object as PropType<{ [key: string]: any }>,
type: Object as PropType<Indexable>,
default: () => ({}),
},
filters: {

View File

@@ -76,7 +76,7 @@ limitations under the License. -->
function handleClick() {
visible.value = false;
}
function setPopper(event: any) {
function setPopper(event: MouseEvent) {
event.stopPropagation();
visible.value = !visible.value;
}

View File

@@ -40,7 +40,7 @@ limitations under the License. -->
// value: string | number;
// }
/*global defineProps, defineEmits*/
/*global defineProps, defineEmits, Indexable*/
const emit = defineEmits(["change", "query"]);
const props = defineProps({
options: {
@@ -71,7 +71,7 @@ limitations under the License. -->
const selected = ref<string[] | string>(props.value);
function changeSelected() {
const options = props.options.filter((d: any) =>
const options = props.options.filter((d: Indexable) =>
props.multiple ? selected.value.includes(d.value) : selected.value === d.value,
);
emit("change", options);

View File

@@ -112,7 +112,7 @@ limitations under the License. -->
import { useI18n } from "vue-i18n";
import DateCalendar from "./DateCalendar.vue";
import { useTimeoutFn } from "@/hooks/useTimeout";
/*global defineProps, defineEmits */
/*global defineProps, defineEmits*/
const datepicker = ref(null);
const { t } = useI18n();
const show = ref<boolean>(false);
@@ -241,7 +241,7 @@ limitations under the License. -->
}
dates.value[0] = d;
};
const dc = (e: any) => {
const dc = (e: MouseEvent) => {
show.value = (datepicker.value as any).contains(e.target) && !props.disabled;
};
const quickPick = (type: string) => {

View File

@@ -23,7 +23,7 @@ import Radio from "./Radio.vue";
import SelectSingle from "./SelectSingle.vue";
import VueGridLayout from "vue-grid-layout";
const components: { [key: string]: any } = {
const components: Indexable = {
Icon,
TimePicker,
VueGridLayout,