[新增] datePicker组件添加simple属性,用于快速交互
This commit is contained in:
parent
1e055e90b3
commit
015f49ceb0
@ -195,6 +195,35 @@ export default {
|
|||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
::: title 一次性选择
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: describe 只需要点击一次后自动关闭,无需点击确认按钮
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: demo
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<lay-date-picker v-model="endTime7" simple></lay-date-picker>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
setup() {
|
||||||
|
|
||||||
|
const endTime7 = ref("2022-03-04 17:35:00");
|
||||||
|
|
||||||
|
return {
|
||||||
|
endTime7
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
::: title Date Picker 属性
|
::: title Date Picker 属性
|
||||||
:::
|
:::
|
||||||
|
|
||||||
@ -205,6 +234,7 @@ export default {
|
|||||||
| v-model | 当前时间 | `string` | -- | — |
|
| v-model | 当前时间 | `string` | -- | — |
|
||||||
| type | 选择类型 | `string` | `date` | `date` `datetime` `year` `month` `time` `yearmonth` |
|
| type | 选择类型 | `string` | `date` | `date` `datetime` `year` `month` `time` `yearmonth` |
|
||||||
| disabled | 是否禁止修改 | `boolean` | false | — |
|
| disabled | 是否禁止修改 | `boolean` | false | — |
|
||||||
|
| simple | 一次性选择,无需点击确认按钮 | `boolean` | false | — |
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
@ -219,13 +219,15 @@ export interface LayDatePickerProps {
|
|||||||
name?: string;
|
name?: string;
|
||||||
max?: string;
|
max?: string;
|
||||||
min?: string;
|
min?: string;
|
||||||
disabled?: boolean
|
disabled?: boolean;
|
||||||
|
simple?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<LayDatePickerProps>(), {
|
const props = withDefaults(defineProps<LayDatePickerProps>(), {
|
||||||
modelValue: "",
|
modelValue: "",
|
||||||
type: "date",
|
type: "date",
|
||||||
disabled: false
|
disabled: false,
|
||||||
|
simple: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const dropdownRef = ref(null);
|
const dropdownRef = ref(null);
|
||||||
@ -316,6 +318,9 @@ const dateValue = computed<string>(() => {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$emits("update:modelValue", momentVal);
|
$emits("update:modelValue", momentVal);
|
||||||
|
if (props.simple) {
|
||||||
|
ok()
|
||||||
|
}
|
||||||
return momentVal;
|
return momentVal;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -372,6 +377,7 @@ watch(
|
|||||||
|
|
||||||
// 确认事件
|
// 确认事件
|
||||||
const ok = () => {
|
const ok = () => {
|
||||||
|
if (dropdownRef.value)
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
dropdownRef.value.hide();
|
dropdownRef.value.hide();
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user