chore: update

This commit is contained in:
xiaoxian521 2024-03-31 12:34:30 +08:00
parent db2b59ed51
commit 6b351d75c7
2 changed files with 8 additions and 12 deletions

View File

@ -38,7 +38,7 @@ const props = {
size: {
type: String as PropType<"small" | "default" | "large">
},
/** 是否global禁用默认false */
/** 是否全局禁用,默认 `false` */
disabled: {
type: Boolean,
default: false
@ -62,8 +62,7 @@ export default defineComponent({
: ref(0);
function handleChange({ option, index }, event: Event) {
if (props.disabled) return;
if (option.disabled) return;
if (props.disabled || option.disabled) return;
event.preventDefault();
isNumber(props.modelValue)
? emit("update:modelValue", index)
@ -138,8 +137,9 @@ export default defineComponent({
style={{
background:
curMouseActive.value === index ? segmentedItembg.value : "",
color:
!option.disabled &&
color: props.disabled
? null
: !option.disabled &&
(curIndex.value === index || curMouseActive.value === index)
? isDark.value
? "rgba(255, 255, 255, 0.85)"

View File

@ -241,11 +241,7 @@ watch(size, val => (dynamicSize.value = size.value));
<Segmented :options="optionsDisabled" :size="dynamicSize" />
<el-divider />
<p class="mb-2">全局禁用</p>
<Segmented
:options="optionsDisabled"
:size="dynamicSize"
:disabled="true"
/>
<Segmented :options="optionsBasis" :size="dynamicSize" disabled />
<el-divider />
<p class="mb-2">block 属性(将宽度调整为父元素宽度)</p>
<Segmented :options="optionsBlock" block :size="dynamicSize" />