diff --git a/package/component/src/component/button/interface.ts b/package/component/src/component/button/interface.ts index 3eed0920..ae088632 100644 --- a/package/component/src/component/button/interface.ts +++ b/package/component/src/component/button/interface.ts @@ -1,5 +1,5 @@ export type ButtonType = "primary" | "normal" | "warm" | "danger"; -export type ButtonSize = "lg" | "sm" | "xs"; +export type ButtonSize = "lg" | "md" | "sm" | "xs"; export type ButtonBorder = "green" | "blue" | "orange" | "red" | "black"; export type ButtonNativeType = "button" | "submit" | "reset"; diff --git a/package/component/src/component/cascader/index.vue b/package/component/src/component/cascader/index.vue index d61c5822..8227c56b 100644 --- a/package/component/src/component/cascader/index.vue +++ b/package/component/src/component/cascader/index.vue @@ -74,10 +74,11 @@ import LayInput from "../input/index.vue"; import LayScroll from "../scroll/index.vue"; import LayDropdown from "../dropdown/index.vue"; import { ref, onMounted, watch, useSlots } from "vue"; +import { CascaderSize } from "./interface"; export type DropdownTrigger = "click" | "hover" | "focus" | "contextMenu"; -export interface LayCascaderProps { +export interface CascaderProps { options?: Array | null; modelValue?: string; decollator?: string; @@ -85,11 +86,11 @@ export interface LayCascaderProps { onlyLastLevel?: boolean; replaceFields?: { label: string; value: string; children: string }; allowClear?: boolean; - size?: "lg" | "md" | "sm" | "xs"; + size?: CascaderSize; trigger?: DropdownTrigger | DropdownTrigger[]; } -const props = withDefaults(defineProps(), { +const props = withDefaults(defineProps(), { options: null, modelValue: "", decollator: "/", diff --git a/package/component/src/component/cascader/interface.ts b/package/component/src/component/cascader/interface.ts new file mode 100644 index 00000000..1294d3e8 --- /dev/null +++ b/package/component/src/component/cascader/interface.ts @@ -0,0 +1 @@ +export type CascaderSize = "lg" | "md" | "sm" | "xs"; \ No newline at end of file diff --git a/package/component/src/component/checkbox/index.vue b/package/component/src/component/checkbox/index.vue index 428a6695..f6874b6b 100644 --- a/package/component/src/component/checkbox/index.vue +++ b/package/component/src/component/checkbox/index.vue @@ -8,6 +8,7 @@ export default { import { LayIcon } from "@layui/icons-vue"; import { computed, inject, useSlots } from "vue"; import "./index.less"; +import { CheckboxSize } from "./interface"; export interface LayCheckboxProps { name?: string; @@ -17,7 +18,7 @@ export interface LayCheckboxProps { isIndeterminate?: boolean; modelValue?: boolean | Array; disabled?: boolean; - size?: "lg" | "md" | "sm" | "xs"; + size?: CheckboxSize; } const props = withDefaults(defineProps(), { diff --git a/package/component/src/component/checkbox/interface.ts b/package/component/src/component/checkbox/interface.ts index e69de29b..80a016ed 100644 --- a/package/component/src/component/checkbox/interface.ts +++ b/package/component/src/component/checkbox/interface.ts @@ -0,0 +1 @@ +export type CheckboxSize = "lg" | "md" | "sm" | "xs"; \ No newline at end of file diff --git a/package/component/src/component/checkboxGroup/index.vue b/package/component/src/component/checkboxGroup/index.vue index 79bb4a64..b761a6ab 100644 --- a/package/component/src/component/checkboxGroup/index.vue +++ b/package/component/src/component/checkboxGroup/index.vue @@ -29,7 +29,7 @@ provide("checkboxGroup", { }); watch( - () => modelValue, + () => modelValue, (val) => { emit("change", modelValue.value); emit("update:modelValue", modelValue.value); diff --git a/package/component/src/component/collapse/index.vue b/package/component/src/component/collapse/index.vue index 30f84f5c..d97e74fa 100644 --- a/package/component/src/component/collapse/index.vue +++ b/package/component/src/component/collapse/index.vue @@ -8,25 +8,25 @@ export default { import "./index.less"; import { withDefaults, provide, ref, watch } from "vue"; -export interface LayCollapseProps { - modelValue?: number | string | []; +export interface CollapseProps { accordion?: boolean; + modelValue?: number | string | number[] | string[]; collapseTransition?: boolean; } -const props = withDefaults(defineProps(), { +const props = withDefaults(defineProps(), { modelValue: () => [], accordion: false, collapseTransition: true, }); -// 监听传入的值 watch( () => props.modelValue, - (val, oldVal) => { + (val) => { activeValues.value = ([] as any[]).concat(val); } ); + const emit = defineEmits(["update:modelValue", "change"]); const activeValues = ref>(([] as any[]).concat(props.modelValue)); diff --git a/package/component/src/component/collapseItem/index.vue b/package/component/src/component/collapseItem/index.vue index 887ff95d..421132a3 100644 --- a/package/component/src/component/collapseItem/index.vue +++ b/package/component/src/component/collapseItem/index.vue @@ -8,13 +8,13 @@ export default { import LayTransition from "../transition/index.vue"; import { withDefaults, inject, computed, ref } from "vue"; -export interface LayCollapseItemProps { +export interface CollapseItemProps { id: number | string; title: string; disabled?: boolean; } -const props = withDefaults(defineProps(), { +const props = withDefaults(defineProps(), { disabled: false, }); diff --git a/package/component/src/component/countUp/index.vue b/package/component/src/component/countUp/index.vue index 195c86e9..425e6c48 100644 --- a/package/component/src/component/countUp/index.vue +++ b/package/component/src/component/countUp/index.vue @@ -41,12 +41,9 @@ const props = withDefaults(defineProps(), { let localStartVal: Ref = ref(props.startVal); const isNumber = (val: string) => !isNaN(parseFloat(val)); -/** - * from: https://github.com/PanJiaChen/vue-countTo/blob/master/src/vue-countTo.vue - * @description 格式化数字 - * @param num 要格式化的数字 - * @returns 格式化后的数字 - */ +/** + * from: https://github.com/PanJiaChen/vue-countTo/blob/master/src/vue-countTo.vue + * */ const formatNumber = (num: number | string): string => { if (typeof num != "number") return "0"; num = num.toFixed(props.decimalPlaces); @@ -69,6 +66,7 @@ const printVal = useTransition(localStartVal, { disabled: !props.useEasing, transition: typeof props.easingFn === "string" + // @ts-ignore ? TransitionPresets[props.easingFn] : props.easingFn, }); diff --git a/package/component/src/component/input/index.vue b/package/component/src/component/input/index.vue index a4c6a10d..a0ea4b5e 100644 --- a/package/component/src/component/input/index.vue +++ b/package/component/src/component/input/index.vue @@ -11,6 +11,7 @@ import { computed, ref, useSlots, watch } from "vue"; import { useI18n } from "../../language"; import PasswordIcon from "./svg/Password.vue"; import UnPasswordIcon from "./svg/unPassword.vue"; +import { InputSize } from "./interface"; export interface LayInputProps { name?: string; @@ -25,7 +26,7 @@ export interface LayInputProps { disabled?: boolean; readonly?: boolean; password?: boolean; - size?: "lg" | "md" | "sm" | "xs"; + size?: InputSize; maxlength?: number; } diff --git a/package/component/src/component/input/interface.ts b/package/component/src/component/input/interface.ts new file mode 100644 index 00000000..364643f8 --- /dev/null +++ b/package/component/src/component/input/interface.ts @@ -0,0 +1 @@ +export type InputSize = "lg" | "md" | "sm" | "xs"; \ No newline at end of file diff --git a/package/component/src/component/inputNumber/index.vue b/package/component/src/component/inputNumber/index.vue index 14f1fde2..22373ae3 100644 --- a/package/component/src/component/inputNumber/index.vue +++ b/package/component/src/component/inputNumber/index.vue @@ -10,6 +10,7 @@ import layInput from "../input/index.vue"; import { LayIcon } from "@layui/icons-vue"; import layButton from "../button/index.vue"; import { ref, watch, withDefaults, computed, Ref } from "vue"; +import { InputNumberSize } from "./interface"; export interface LayInputNumberProps { modelValue?: number; @@ -20,7 +21,7 @@ export interface LayInputNumberProps { position?: "right"; min?: number; max?: number; - size?: "lg" | "md" | "sm" | "xs"; + size?: InputNumberSize; } const props = withDefaults(defineProps(), { diff --git a/package/component/src/component/inputNumber/interface.ts b/package/component/src/component/inputNumber/interface.ts new file mode 100644 index 00000000..2b4ee32e --- /dev/null +++ b/package/component/src/component/inputNumber/interface.ts @@ -0,0 +1 @@ +export type InputNumberSize = "lg" | "md" | "sm" | "xs"; \ No newline at end of file diff --git a/package/component/src/component/radio/index.vue b/package/component/src/component/radio/index.vue index ccaa7605..4b24812f 100644 --- a/package/component/src/component/radio/index.vue +++ b/package/component/src/component/radio/index.vue @@ -1,5 +1,6 @@