🐛(select): 修复多选模式下 disabled 属性失效

This commit is contained in:
就眠儀式 2022-10-24 09:36:50 +08:00
parent 5646ae298e
commit 326dc13ec3
7 changed files with 56 additions and 10 deletions

View File

@ -1,7 +1,10 @@
<template> <template>
<div <div
:size="size" :size="size"
:class="['layui-cascader', { 'layui-cascader-opend': openState, 'layui-disabled': disabled }]" :class="[
'layui-cascader',
{ 'layui-cascader-opend': openState, 'layui-disabled': disabled },
]"
> >
<lay-dropdown <lay-dropdown
ref="dropdownRef" ref="dropdownRef"

View File

@ -411,7 +411,10 @@ function hex2rgba(s: any) {
:contentStyle="contentStyle" :contentStyle="contentStyle"
updateAtScroll updateAtScroll
> >
<div class="layui-unselect layui-colorpicker" :class="[{'layui-disabled': disabled}]"> <div
class="layui-unselect layui-colorpicker"
:class="[{ 'layui-disabled': disabled }]"
>
<span> <span>
<span <span
class="layui-colorpicker-trigger-span" class="layui-colorpicker-trigger-span"

View File

@ -146,7 +146,8 @@ const searchList = (str: string, container: any) => {
updateAtScroll updateAtScroll
> >
<div <div
class="layui-inline layui-border-box layui-iconpicker layui-iconpicker-split" :class="[{'layui-disabled': disabled}]" class="layui-inline layui-border-box layui-iconpicker layui-iconpicker-split"
:class="[{ 'layui-disabled': disabled }]"
> >
<div class="layui-inline layui-iconpicker-main"> <div class="layui-inline layui-iconpicker-main">
<i class="layui-inline layui-icon" :class="[selectedIcon]"></i> <i class="layui-inline layui-icon" :class="[selectedIcon]"></i>

View File

@ -121,7 +121,10 @@ const onCompositionend = (event: Event) => {
}; };
const classes = computed(() => { const classes = computed(() => {
return { "layui-input-disabled": props.disabled, 'layui-input-has-prefix': slots.prefix || props.prefixIcon }; return {
"layui-input-disabled": props.disabled,
"layui-input-has-prefix": slots.prefix || props.prefixIcon,
};
}); });
const showPassword = () => { const showPassword = () => {
@ -134,11 +137,7 @@ const showPassword = () => {
</script> </script>
<template> <template>
<div <div class="layui-input" :class="classes" :size="size">
class="layui-input"
:class="classes"
:size="size"
>
<div class="layui-input-prepend" v-if="slots.prepend"> <div class="layui-input-prepend" v-if="slots.prepend">
<slot name="prepend"></slot> <slot name="prepend"></slot>
</div> </div>

View File

@ -190,6 +190,7 @@ provide("multiple", multiple);
:collapseTagsTooltip="collapseTagsTooltip" :collapseTagsTooltip="collapseTagsTooltip"
:minCollapsedNum="minCollapsedNum" :minCollapsedNum="minCollapsedNum"
:disabledInput="true" :disabledInput="true"
:disabled="disabled"
:size="size" :size="size"
:class="{ 'layui-unselect': true }" :class="{ 'layui-unselect': true }"
@clear="handleClear" @clear="handleClear"

View File

@ -181,7 +181,7 @@ const components: Record<string, Plugin> = {
LaySpace, LaySpace,
LayTag, LayTag,
LayTagInput, LayTagInput,
LayTreeSelect LayTreeSelect,
}; };
const install = (app: App, options?: InstallOptions): void => { const install = (app: App, options?: InstallOptions): void => {

View File

@ -71,6 +71,45 @@ export default {
::: :::
::: title 禁止选择
:::
::: demo 通过 show-search 属性开启内容检索, input 变为可输入状态。在 multiple 模式下, 检索框位于 dropdown 顶部。
<template>
<lay-space>
<lay-select v-model="value3" :disabled="true">
<lay-select-option value="1" label="学习"></lay-select-option>
<lay-select-option value="2" label="编码"></lay-select-option>
<lay-select-option value="3" label="运动"></lay-select-option>
</lay-select>
<lay-select v-model="value4" :disabled="true" :multiple="true">
<lay-select-option value="1" label="学习"></lay-select-option>
<lay-select-option value="2" label="编码"></lay-select-option>
<lay-select-option value="3" label="运动"></lay-select-option>
</lay-select>
</lay-space>
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
const value3 = ref('1')
const value4 = ref(['1'])
return {
value3,
value4
}
}
}
</script>
:::
::: title 开启检索 ::: title 开启检索
::: :::