✨(component): [tag]添加 shape, disabled 属性
This commit is contained in:
parent
d30a3b0012
commit
e9e54bb967
@ -34,6 +34,36 @@
|
|||||||
border-color: var(--global-neutral-color-5);
|
border-color: var(--global-neutral-color-5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-disabled {
|
||||||
|
opacity: 0.4;
|
||||||
|
cursor: not-allowed;
|
||||||
|
|
||||||
|
& .layui-tag-close-icon {
|
||||||
|
.layui-icon {
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
cursor: not-allowed !important;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-shap {
|
||||||
|
&-square {
|
||||||
|
border-radius: var(--global-border-radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
&-round {
|
||||||
|
border-radius: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&-ellipsis {
|
||||||
|
white-space: nowwrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
&-size-lg {
|
&-size-lg {
|
||||||
height: @tag-size-lg;
|
height: @tag-size-lg;
|
||||||
font-size: @tag-size-lg-font-size;
|
font-size: @tag-size-lg-font-size;
|
||||||
@ -82,7 +112,8 @@
|
|||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,13 +14,14 @@ export interface LayTagProps {
|
|||||||
closable?: boolean;
|
closable?: boolean;
|
||||||
size?: string;
|
size?: string;
|
||||||
bordered?: boolean;
|
bordered?: boolean;
|
||||||
|
disabled?: boolean;
|
||||||
|
shape?: "square" | "round";
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<LayTagProps>(), {
|
const props = withDefaults(defineProps<LayTagProps>(), {
|
||||||
color: "green",
|
color: "#EEE",
|
||||||
size: "md",
|
size: "md",
|
||||||
closable: false,
|
shape: "square"
|
||||||
bordered: false,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(["close"]);
|
const emit = defineEmits(["close"]);
|
||||||
@ -35,6 +36,7 @@ const isCustomColor = computed(
|
|||||||
const visible = ref(true);
|
const visible = ref(true);
|
||||||
|
|
||||||
const handleClose = (e: MouseEvent) => {
|
const handleClose = (e: MouseEvent) => {
|
||||||
|
if(props.disabled) return;
|
||||||
//visible.value = false;
|
//visible.value = false;
|
||||||
emit("close", e);
|
emit("close", e);
|
||||||
};
|
};
|
||||||
@ -42,9 +44,11 @@ const handleClose = (e: MouseEvent) => {
|
|||||||
const classTag = computed(() => [
|
const classTag = computed(() => [
|
||||||
"layui-tag",
|
"layui-tag",
|
||||||
`layui-tag-size-${props.size}`,
|
`layui-tag-size-${props.size}`,
|
||||||
|
`layui-tag-shap-${props.shape}`,
|
||||||
{
|
{
|
||||||
[`layui-bg-${props.color}`]: isBuiltInColor,
|
[`layui-bg-${props.color}`]: isBuiltInColor,
|
||||||
"layui-tag-bordered": props.bordered,
|
"layui-tag-bordered": props.bordered,
|
||||||
|
"layui-tag-disabled": props.disabled,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
<lay-tag bordered color="#FFF">tag</lay-tag>
|
<lay-tag bordered color="#FFF">tag</lay-tag>
|
||||||
  
|
  
|
||||||
<lay-tag closable>tag</lay-tag>
|
<lay-tag closable>tag</lay-tag>
|
||||||
|
  
|
||||||
|
<lay-tag closable disabled>tag</lay-tag>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
Loading…
Reference in New Issue
Block a user