[新增] datePicker添加disabled属性

This commit is contained in:
castleiMac 2022-04-04 10:05:43 +08:00
parent b914103920
commit bcb6109246
2 changed files with 33 additions and 1 deletions

View File

@ -62,6 +62,33 @@ export default {
:::
::: title 禁止修改
:::
::: demo
<template>
<!-- 选择的时间:{{endTime3}} -->
<lay-date-picker disabled type="year" v-model="endTime3"></lay-date-picker>
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
const endTime3 = ref("2022-03-04 17:35:00");
return {
endTime3
}
}
}
</script>
:::
::: title 年份选择
:::
@ -177,6 +204,7 @@ export default {
| ------------- | ------------------------------------------------------------ | -------------- | ------ | -------------- |
| v-model | 当前时间 | `string` | -- | — |
| type | 选择类型 | `string` | `date` | `date` `datetime` `year` `month` `time` `yearmonth` |
| disabled | 是否禁止修改 | `boolean` | false | — |
:::

View File

@ -1,6 +1,6 @@
<template>
<div>
<lay-dropdown ref="dropdownRef">
<lay-dropdown ref="dropdownRef" :disabled="props.disabled">
<lay-input :name="name" :value="dateValue || modelValue" readonly>
<template #prefix>
<lay-icon type="layui-icon-date"></lay-icon>
@ -217,11 +217,15 @@ export interface LayDatePickerProps {
modelValue?: string;
type?: "date" | "datetime" | "year" | "time" | "month" | "yearmonth";
name?: string;
max?: string;
min?: string;
disabled?: boolean
}
const props = withDefaults(defineProps<LayDatePickerProps>(), {
modelValue: "",
type: "date",
disabled: false
});
const dropdownRef = ref(null);