(component): 整理 tag 组件类型

This commit is contained in:
就眠儀式 2022-10-18 00:59:40 +08:00
parent 8e46f6f6b2
commit b077d81569
5 changed files with 18 additions and 15 deletions

View File

@ -121,4 +121,4 @@ onBeforeUnmount(() => {
>
<slot></slot>
</div>
</template>
</template>

View File

@ -8,7 +8,7 @@ export default {
import { ref, watch, provide, withDefaults } from "vue";
import "./index.less";
export interface LayStepProps {
export interface StepProps {
active?: number;
center?: boolean;
direction?: string;
@ -18,7 +18,7 @@ export interface LayStepProps {
simple?: boolean;
}
const props = withDefaults(defineProps<LayStepProps>(), {
const props = withDefaults(defineProps<StepProps>(), {
active: 0,
center: false,
direction: "horizontal",

View File

@ -18,14 +18,14 @@ import {
import { LayIcon } from "@layui/icons-vue";
import type { ComputedRef } from "vue";
export interface LayStepItemProps {
export interface StepItemProps {
title?: string;
content?: string;
icon?: string;
status?: string;
}
const props = withDefaults(defineProps<LayStepItemProps>(), {
const props = withDefaults(defineProps<StepItemProps>(), {
title: "",
content: "",
icon: "",

View File

@ -8,21 +8,21 @@ import "./index.less";
import { LayIcon } from "@layui/icons-vue";
import { computed, ref } from "vue";
import { TinyColor } from "@ctrl/tinycolor";
import { tagType } from "./interface";
import { TagShape, TagType, TagVariant } from "./interface";
export interface LayTagProps {
type?: tagType;
export interface TagProps {
type?: TagType;
color?: string;
closable?: boolean;
size?: string;
bordered?: boolean;
disabled?: boolean;
shape?: "square" | "round";
shape?: TagShape;
maxWidth?: string;
variant?: "dark" | "light" | "plain";
variant?: TagVariant;
}
const props = withDefaults(defineProps<LayTagProps>(), {
const props = withDefaults(defineProps<TagProps>(), {
size: "md",
shape: "square",
variant: "dark",
@ -35,7 +35,6 @@ const visible = ref(true);
const handleClose = (e: MouseEvent) => {
if (props.disabled) return;
//visible.value = false;
emit("close", e);
};
@ -61,7 +60,7 @@ const styleTag = computed(() => [
},
]);
function useTagCustomStyle(props: LayTagProps) {
function useTagCustomStyle(props: TagProps) {
return computed(() => {
let styles: Record<string, string> = {};
@ -120,4 +119,4 @@ function useTagCustomStyle(props: LayTagProps) {
</slot>
</span>
</span>
</template>
</template>

View File

@ -1,3 +1,7 @@
export const TAG_COLORS = ["primary", "normal", "warm", "danger"] as const;
export type tagType = typeof TAG_COLORS[number];
export type TagType = typeof TAG_COLORS[number];
export type TagShape = "square" | "round";
export type TagVariant = "dark" | "light" | "plain";