(component): 临时解决 date-picker 类型警告

This commit is contained in:
就眠儀式 2022-10-18 00:10:35 +08:00
parent 1c804c6db9
commit e732e8ed17
9 changed files with 20 additions and 27 deletions

View File

@ -10,7 +10,7 @@ import { computed, inject, useSlots } from "vue";
import "./index.less"; import "./index.less";
import { CheckboxSize } from "./interface"; import { CheckboxSize } from "./interface";
export interface LayCheckboxProps { export interface CheckboxProps {
name?: string; name?: string;
skin?: string; skin?: string;
value: string | number | object; value: string | number | object;
@ -21,7 +21,7 @@ export interface LayCheckboxProps {
size?: CheckboxSize; size?: CheckboxSize;
} }
const props = withDefaults(defineProps<LayCheckboxProps>(), { const props = withDefaults(defineProps<CheckboxProps>(), {
isIndeterminate: false, isIndeterminate: false,
modelValue: false, modelValue: false,
disabled: false, disabled: false,

View File

@ -8,12 +8,12 @@ export default {
import { provide, ref, watch } from "vue"; import { provide, ref, watch } from "vue";
import { Recordable } from "../../types"; import { Recordable } from "../../types";
export interface LayCheckboxGroupProps { export interface CheckboxGroupProps {
modelValue?: Recordable[]; modelValue?: Recordable[];
disabled?: boolean; disabled?: boolean;
} }
const props = withDefaults(defineProps<LayCheckboxGroupProps>(), { const props = withDefaults(defineProps<CheckboxGroupProps>(), {
modelValue: () => [], modelValue: () => [],
disabled: false, disabled: false,
}); });
@ -22,6 +22,7 @@ const emit = defineEmits(["update:modelValue", "change"]);
const modelValue = ref(props.modelValue); const modelValue = ref(props.modelValue);
const disabled = ref(props.disabled); const disabled = ref(props.disabled);
provide("checkboxGroup", { provide("checkboxGroup", {
name: "LayCheckboxGroup", name: "LayCheckboxGroup",
modelValue: modelValue, modelValue: modelValue,

View File

@ -7,7 +7,7 @@ export default {
<script setup lang="ts"> <script setup lang="ts">
import { computed } from "vue"; import { computed } from "vue";
export interface LayColProps { export interface ColProps {
md?: string | number; md?: string | number;
xs?: string | number; xs?: string | number;
sm?: string | number; sm?: string | number;
@ -18,7 +18,7 @@ export interface LayColProps {
lgOffset?: string | number; lgOffset?: string | number;
} }
const props = defineProps<LayColProps>(); const props = defineProps<ColProps>();
const classes = computed(() => { const classes = computed(() => {
return [ return [

View File

@ -11,7 +11,7 @@ import EyeDropper from "./EyeDropper.vue";
import { ref, computed, watch, onMounted } from "vue"; import { ref, computed, watch, onMounted } from "vue";
import { useEyeDropper } from "@vueuse/core"; import { useEyeDropper } from "@vueuse/core";
export interface LayColorPicker { export interface ColorPicker {
modelValue?: any; modelValue?: any;
preset?: any; preset?: any;
eyeDropper?: boolean; eyeDropper?: boolean;
@ -19,7 +19,7 @@ export interface LayColorPicker {
const emit = defineEmits(["update:modelValue"]); const emit = defineEmits(["update:modelValue"]);
const props = withDefaults(defineProps<LayColorPicker>(), { const props = withDefaults(defineProps<ColorPicker>(), {
modelValue: { r: 255, g: 255, b: 255, a: 1 }, modelValue: { r: 255, g: 255, b: 255, a: 1 },
preset: ["#009688", "#1e9fff", "#ffb800", "#ff5722", "#5fb878"], preset: ["#009688", "#1e9fff", "#ffb800", "#ff5722", "#5fb878"],
}); });
@ -84,7 +84,6 @@ watch(alpha, () => {
"update:modelValue", "update:modelValue",
rgba2hex(red.value, green.value, blue.value, alpha.value) rgba2hex(red.value, green.value, blue.value, alpha.value)
); );
//
alphaSliderStyle.value = `left: ${ alphaSliderStyle.value = `left: ${
alpha.value >= 1 ? "calc(100% - 6px)" : alpha.value * 100 + "%" alpha.value >= 1 ? "calc(100% - 6px)" : alpha.value * 100 + "%"
};`; };`;
@ -108,7 +107,6 @@ let colorObj = computed(() => {
}; };
}); });
// ,
function hexChange(e: any) { function hexChange(e: any) {
let v = e.target.value; let v = e.target.value;
if (/^#?([0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(v)) { if (/^#?([0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(v)) {
@ -158,7 +156,6 @@ function alphaChange(e: any) {
} }
} }
//
function presetChange(item: any) { function presetChange(item: any) {
if (/^#?([0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(item)) { if (/^#?([0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(item)) {
let { r, g, b, a } = hex2rgba(item); let { r, g, b, a } = hex2rgba(item);
@ -169,7 +166,6 @@ function presetChange(item: any) {
} }
} }
//
function handleChangeSV(e: any) { function handleChangeSV(e: any) {
// @ts-ignore // @ts-ignore
let w = saturationValue.value.clientWidth; let w = saturationValue.value.clientWidth;
@ -260,10 +256,6 @@ function mouseupAlpha(e: any) {
window.removeEventListener("mouseup", mouseupAlpha); window.removeEventListener("mouseup", mouseupAlpha);
} }
/**
* 解析输入的数据,只能解析hex颜色和rgb对象形式的数据
* @param color
*/
function parseColor(color: any) { function parseColor(color: any) {
if (color) { if (color) {
let r, g, b, a; let r, g, b, a;

View File

@ -9,11 +9,11 @@ import "./index.less";
import { computed } from "vue"; import { computed } from "vue";
import { BooleanOrString } from "../../types"; import { BooleanOrString } from "../../types";
export interface LayContainerProps { export interface ContainerProps {
fluid?: BooleanOrString; fluid?: BooleanOrString;
} }
const props = withDefaults(defineProps<LayContainerProps>(), { const props = withDefaults(defineProps<ContainerProps>(), {
fluid: false, fluid: false,
}); });

View File

@ -8,7 +8,7 @@ export default {
import { computed, onMounted, Ref, ref, watch } from "vue"; import { computed, onMounted, Ref, ref, watch } from "vue";
import { TransitionPresets, useTransition } from "@vueuse/core"; import { TransitionPresets, useTransition } from "@vueuse/core";
export interface LayCountupProps { export interface CountUpProps {
startVal?: number; // startVal?: number; //
endVal?: number; // endVal?: number; //
decimal?: string; // decimal?: string; //
@ -23,7 +23,7 @@ export interface LayCountupProps {
suffix?: string; // suffix?: string; //
} }
const props = withDefaults(defineProps<LayCountupProps>(), { const props = withDefaults(defineProps<CountUpProps>(), {
startVal: 0, startVal: 0,
endVal: 0, endVal: 0,
decimal: ".", decimal: ".",

View File

@ -117,7 +117,7 @@ import MonthPanel from "./components/MonthPanel.vue";
import DateRange from "./components/DateRange.vue"; import DateRange from "./components/DateRange.vue";
import MonthRange from "./components/MonthRange.vue"; import MonthRange from "./components/MonthRange.vue";
export interface LayDatePickerProps { export interface DatePickerProps {
type?: "date" | "datetime" | "year" | "time" | "month" | "yearmonth"; type?: "date" | "datetime" | "year" | "time" | "month" | "yearmonth";
placeholder?: string; placeholder?: string;
modelValue?: string | number | string[]; modelValue?: string | number | string[];
@ -136,7 +136,7 @@ export interface LayDatePickerProps {
timestamp?: boolean; timestamp?: boolean;
} }
const props = withDefaults(defineProps<LayDatePickerProps>(), { const props = withDefaults(defineProps<DatePickerProps>(), {
modelValue: "", modelValue: "",
type: "date", type: "date",
disabled: false, disabled: false,

View File

@ -50,7 +50,7 @@ import { transformPlacement } from "./util";
export type DropdownTrigger = "click" | "hover" | "focus" | "contextMenu"; export type DropdownTrigger = "click" | "hover" | "focus" | "contextMenu";
export interface LayDropdownProps { export interface DropdownProps {
visible?: boolean; visible?: boolean;
trigger?: DropdownTrigger | DropdownTrigger[]; trigger?: DropdownTrigger | DropdownTrigger[];
placement?: DropdownPlacement; placement?: DropdownPlacement;
@ -73,7 +73,7 @@ export interface LayDropdownProps {
popupContainer?: string | undefined; popupContainer?: string | undefined;
} }
const props = withDefaults(defineProps<LayDropdownProps>(), { const props = withDefaults(defineProps<DropdownProps>(), {
visible: false, visible: false,
trigger: "click", trigger: "click",
disabled: false, disabled: false,

View File

@ -13,12 +13,12 @@ import PasswordIcon from "./svg/Password.vue";
import UnPasswordIcon from "./svg/unPassword.vue"; import UnPasswordIcon from "./svg/unPassword.vue";
import { InputSize } from "./interface"; import { InputSize } from "./interface";
export interface LayInputProps { export interface InputProps {
name?: string; name?: string;
type?: string; type?: string;
prefixIcon?: string; prefixIcon?: string;
suffixIcon?: string; suffixIcon?: string;
modelValue?: string | number; modelValue?: string | number | string[] | undefined;
allowClear?: boolean; allowClear?: boolean;
autocomplete?: string; autocomplete?: string;
placeholder?: string; placeholder?: string;
@ -30,7 +30,7 @@ export interface LayInputProps {
maxlength?: number; maxlength?: number;
} }
const props = withDefaults(defineProps<LayInputProps>(), { const props = withDefaults(defineProps<InputProps>(), {
disabled: false, disabled: false,
readonly: false, readonly: false,
allowClear: false, allowClear: false,