(component): 优化 badge 代码警告

This commit is contained in:
就眠儀式 2022-10-18 00:00:04 +08:00
parent 3c808aa9a2
commit 60aaa9fea2
5 changed files with 13 additions and 12 deletions

View File

@ -20,13 +20,13 @@ import {
StyleValue,
} from "vue";
export interface LayAiffxProps {
export interface AiffxProps {
offset?: number;
target?: HTMLElement;
position?: string;
}
const props = withDefaults(defineProps<LayAiffxProps>(), {
const props = withDefaults(defineProps<AiffxProps>(), {
offset: 0,
position: "top",
target: () => {
@ -134,4 +134,4 @@ onMounted(() => {
onUnmounted(() => {
props.target.removeEventListener("scroll", checkInWindow);
});
</script>
</script>

View File

@ -9,7 +9,7 @@ export default {
<script setup lang="ts">
import "./index.less";
export interface LayAvatarProps {
export interface AvatarProps {
src?: string;
size?: "xs" | "sm" | "md" | "lg";
radius?: boolean;
@ -17,7 +17,7 @@ export interface LayAvatarProps {
alt?: string;
}
const props = withDefaults(defineProps<LayAvatarProps>(), {
const props = withDefaults(defineProps<AvatarProps>(), {
size: "md",
radius: false,
icon: "layui-icon-username",

View File

@ -16,7 +16,7 @@ import {
import { LayIcon } from "@layui/icons-vue";
import "./index.less";
export interface LayBacktopProps {
export interface BackTopProps {
target?: string;
showHeight?: number;
disabled?: boolean;
@ -34,7 +34,7 @@ export interface LayBacktopProps {
iconColor?: string;
}
const props = withDefaults(defineProps<LayBacktopProps>(), {
const props = withDefaults(defineProps<BackTopProps>(), {
target: "window",
showHeight: 200,
icon: "layui-icon-top",

View File

@ -8,14 +8,14 @@ export default {
import { computed, StyleValue } from "vue";
import "./index.less";
export interface LayBadgeProps {
export interface BadgeProps {
type?: "dot" | "rim";
theme?: string;
color?: string;
ripple?: boolean;
}
const props = defineProps<LayBadgeProps>();
const props = defineProps<BadgeProps>();
const classes = computed(() => {
return [
@ -30,8 +30,9 @@ const classes = computed(() => {
});
const styles = computed<StyleValue>(() => {
props.color ? `background-color: ${props.color}` : "";
});
return [props.color ? `background-color: ${props.color}` : ""]
})
</script>
<template>

View File

@ -61,7 +61,7 @@ const checkedKeys = computed({
return props.multiple ? props.modelValue : [];
},
set(value) {
if(props.multiple) {
if (props.multiple) {
emits("update:modelValue", value);
emits("change", value);
}