(component): update

This commit is contained in:
就眠儀式 2022-10-15 08:58:44 +08:00
parent 8bc1d329cd
commit 8af4ddbf6a
4 changed files with 49 additions and 61 deletions

View File

@ -8,21 +8,26 @@ export default {
<script setup lang="ts">
import "./index.less";
import { computed } from "vue";
import { ButtonBorder, ButtonEmits, ButtonNativeType, ButtonSize, ButtonType } from "./interface";
import { BooleanOrString, String } from "../../types";
import {
ButtonBorder,
ButtonEmits,
ButtonNativeType,
ButtonSize,
ButtonType,
} from "./interface";
export interface ButtonProps {
type?: ButtonType;
size?: ButtonSize;
prefixIcon?: String;
suffixIcon?: String;
loadingIcon?: String;
borderStyle?: String;
prefixIcon?: string;
suffixIcon?: string;
loadingIcon?: string;
borderStyle?: string;
border?: ButtonBorder;
fluid?: BooleanOrString;
radius?: BooleanOrString;
loading?: BooleanOrString;
disabled?: BooleanOrString;
fluid?: string | boolean;
radius?: string | boolean;
loading?: string | boolean;
disabled?: string | boolean;
nativeType?: ButtonNativeType;
}
@ -81,4 +86,4 @@ const classes = computed(() => {
<slot v-else></slot>
<i v-if="suffixIcon" :class="`layui-icon ${suffixIcon}`"></i>
</button>
</template>
</template>

View File

@ -7,11 +7,10 @@ export default {
<script setup lang="ts">
import "./index.less";
import { computed, useSlots } from "vue";
import { String } from "../../types";
import { CardShadow } from "./interface";
export interface CardProps {
title?: String;
title?: string;
shadow?: CardShadow;
}
@ -19,7 +18,7 @@ const props = withDefaults(defineProps<CardProps>(), {
shadow: "always",
});
const slot = useSlots();
const slots = useSlots();
const classes = computed(() => {
return {
@ -31,20 +30,20 @@ const classes = computed(() => {
<template>
<div class="layui-card" :class="classes">
<div class="layui-card-header" v-if="slot.title || title || slot.extra">
<div class="layui-card-header" v-if="slots.title || title || slots.extra">
<span class="layui-card-header-title">
<slot name="title">{{ title }}</slot>
</span>
<span class="layui-card-header-extra" v-if="slot.extra">
<span class="layui-card-header-extra" v-if="slots.extra">
<slot name="extra"></slot>
</span>
</div>
<div class="layui-card-body">
<slot name="body" v-if="slot.body"></slot>
<slot name="body" v-if="slots.body"></slot>
<slot v-else></slot>
</div>
<div class="layui-card-footer" v-if="slot.footer">
<div class="layui-card-footer" v-if="slots.footer">
<slot name="footer"></slot>
</div>
</div>
</template>
</template>

View File

@ -1 +1 @@
export type CardShadow = "always" | "hover" | "never";
export type CardShadow = "always" | "hover" | "never";

View File

@ -6,46 +6,35 @@ export default {
<script setup lang="ts">
import "./index.less";
import {
withDefaults,
provide,
useSlots,
ref,
computed,
VNode,
Ref,
Component,
watch,
} from "vue";
import { withDefaults, provide, useSlots, ref, computed, VNode, Ref, Component, watch } from "vue";
import CarouselItem from "../carouselItem/index.vue";
export interface CarouselProps {
width?: string;
height?: string;
modelValue: string;
anim?: string;
autoplay?: boolean;
arrow?: string;
interval?: number;
indicator?: string;
pauseOnHover?: boolean;
}
const props = withDefaults(defineProps<CarouselProps>(), {
width: "100%",
height: "280px",
anim: "default",
autoplay: true,
arrow: "hover",
interval: 3000,
indicator: "inside",
pauseOnHover: true,
});
const slot = useSlots() as any;
const slots = slot.default && (slot.default() as any[]);
const props = withDefaults(
defineProps<{
width?: string;
height?: string;
modelValue: string;
anim?: string;
autoplay?: boolean;
arrow?: string;
interval?: number;
indicator?: string;
pauseOnHover?: boolean;
}>(),
{
width: "100%",
height: "280px",
anim: "default",
autoplay: true,
arrow: "hover",
interval: 3000,
indicator: "inside",
pauseOnHover: true,
}
);
const active = computed({
get() {
return props.modelValue;
@ -55,12 +44,7 @@ const active = computed({
},
});
const anim = computed({
get() {
return props.anim;
},
set() {},
});
const anim = computed(() => props.anim);
const emit = defineEmits(["update:modelValue", "change"]);