✨(component): 新增 date-picker 组件 placeholder 属性
This commit is contained in:
parent
a939c48b79
commit
9ef5a01fbc
@ -5,6 +5,8 @@
|
||||
readonly
|
||||
:name="name"
|
||||
:model-value="dateValue || modelValue"
|
||||
:placeholder="placeholder"
|
||||
:allow-clear="true"
|
||||
prefix-icon="layui-icon-date"
|
||||
>
|
||||
</lay-input>
|
||||
@ -279,13 +281,14 @@ import { getDayLength, getYears, getMonth, getYear } from "./day";
|
||||
import { ref, watch, computed, defineProps, defineEmits, onMounted } from "vue";
|
||||
|
||||
export interface LayDatePickerProps {
|
||||
modelValue?: string;
|
||||
type?: "date" | "datetime" | "year" | "time" | "month" | "yearmonth";
|
||||
placeholder?: string;
|
||||
modelValue?: string;
|
||||
disabled?: boolean;
|
||||
simple?: boolean;
|
||||
name?: string;
|
||||
max?: string;
|
||||
min?: string;
|
||||
disabled?: boolean;
|
||||
simple?: boolean;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<LayDatePickerProps>(), {
|
||||
@ -299,20 +302,7 @@ const dropdownRef = ref(null);
|
||||
const $emits = defineEmits(["update:modelValue"]);
|
||||
|
||||
const WEEK_NAME = ["日", "一", "二", "三", "四", "五", "六"];
|
||||
const MONTH_NAME = [
|
||||
"1月",
|
||||
"2月",
|
||||
"3月",
|
||||
"4月",
|
||||
"5月",
|
||||
"6月",
|
||||
"7月",
|
||||
"8月",
|
||||
"9月",
|
||||
"10月",
|
||||
"11月",
|
||||
"12月",
|
||||
];
|
||||
const MONTH_NAME = ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"];
|
||||
|
||||
const hms = ref({
|
||||
hh: dayjs(props.modelValue).hour(),
|
||||
|
@ -45,13 +45,17 @@ const emit = defineEmits<InputEmits>();
|
||||
|
||||
const { t } = useI18n();
|
||||
const slots = useSlots();
|
||||
const currentValue = ref<string>(String(props.modelValue == null ? '' : props.modelValue));
|
||||
const currentValue = ref<string>(
|
||||
String(props.modelValue == null ? "" : props.modelValue)
|
||||
);
|
||||
const hasContent = computed(() => (props.modelValue as string)?.length > 0);
|
||||
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
() => {
|
||||
currentValue.value = String(props.modelValue == null ? '' : props.modelValue);
|
||||
currentValue.value = String(
|
||||
props.modelValue == null ? "" : props.modelValue
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
@ -126,7 +130,7 @@ const classes = computed(() => {
|
||||
></lay-icon>
|
||||
</span>
|
||||
<span class="layui-input-clear" v-if="allowClear && hasContent">
|
||||
<lay-icon type="layui-icon-close-fill" @click="onClear"></lay-icon>
|
||||
<lay-icon type="layui-icon-close-fill" @click.stop="onClear"></lay-icon>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -18,8 +18,6 @@ export type MaybeRef<T> = Ref<T> | T;
|
||||
|
||||
export type Recordable = Record<string, any>;
|
||||
|
||||
/************************/
|
||||
|
||||
export type Number = number;
|
||||
|
||||
export type String = string;
|
||||
|
@ -16,8 +16,9 @@
|
||||
<li>
|
||||
<h3>1.2.8 <span class="layui-badge-rim">2022-07-08</span></h3>
|
||||
<ul>
|
||||
<li>[修复] layer 组件 Notifiy 缺失关闭图标。 by @SmallWai</li>
|
||||
<li>[修复] layer 组件 notifiy 缺失关闭图标。 by @SmallWai</li>
|
||||
<li>[修复] input 组件 modelValue 设置为 zero 不显示的问题。by @Jmysy</li>
|
||||
<li>[新增] date-picker 组件 placeholder 属性, 设置提示信息。by @Jmysy</li>
|
||||
<li>[新增] textarea 组件 allow-clear 属性, 允许清空。by @Jmysy</li>
|
||||
<li>[新增] textarea 组件 change 回调函数。by @Jmysy</li>
|
||||
<li>[新增] textarea 组件 clear 回调函数。by @Jmysy</li>
|
||||
|
Loading…
Reference in New Issue
Block a user