🐛(component): 修复 layer 在 google 高版本中的警告信息
This commit is contained in:
parent
98ca6a61b5
commit
2f52cc2739
@ -133,7 +133,7 @@ export interface LayDatePickerProps {
|
|||||||
size?: "lg" | "md" | "sm" | "xs";
|
size?: "lg" | "md" | "sm" | "xs";
|
||||||
prefixIcon?: string;
|
prefixIcon?: string;
|
||||||
suffixIcon?: string;
|
suffixIcon?: string;
|
||||||
timestamp?:boolean
|
timestamp?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<LayDatePickerProps>(), {
|
const props = withDefaults(defineProps<LayDatePickerProps>(), {
|
||||||
@ -148,7 +148,7 @@ const props = withDefaults(defineProps<LayDatePickerProps>(), {
|
|||||||
size: "md",
|
size: "md",
|
||||||
prefixIcon: "layui-icon-date",
|
prefixIcon: "layui-icon-date",
|
||||||
suffixIcon: "",
|
suffixIcon: "",
|
||||||
timestamp:false
|
timestamp: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const dropdownRef = ref(null);
|
const dropdownRef = ref(null);
|
||||||
@ -230,9 +230,9 @@ const getDateValue = () => {
|
|||||||
$emits("update:modelValue", "");
|
$emits("update:modelValue", "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(props.timestamp){
|
if (props.timestamp) {
|
||||||
$emits("update:modelValue", dayjs(dayjsVal).unix()*1000);
|
$emits("update:modelValue", dayjs(dayjsVal).unix() * 1000);
|
||||||
}else{
|
} else {
|
||||||
$emits("update:modelValue", dayjsVal);
|
$emits("update:modelValue", dayjsVal);
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -300,12 +300,12 @@ watch(
|
|||||||
if (unWatch) {
|
if (unWatch) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let initModelValue:string =
|
let initModelValue: string =
|
||||||
props.range && props.modelValue
|
props.range && props.modelValue
|
||||||
? (props.modelValue as string[])[0] || ""
|
? (props.modelValue as string[])[0] || ""
|
||||||
: (props.modelValue as string);
|
: (props.modelValue as string);
|
||||||
if(props.type==='month'||props.type==='year'){
|
if (props.type === "month" || props.type === "year") {
|
||||||
initModelValue+='';
|
initModelValue += "";
|
||||||
}
|
}
|
||||||
|
|
||||||
hms.value.hh = isNaN(dayjs(initModelValue).hour())
|
hms.value.hh = isNaN(dayjs(initModelValue).hour())
|
||||||
@ -332,8 +332,10 @@ watch(
|
|||||||
if (props.type === "date" || props.type === "datetime") {
|
if (props.type === "date" || props.type === "datetime") {
|
||||||
if (currentYear.value === -1) currentYear.value = dayjs().year();
|
if (currentYear.value === -1) currentYear.value = dayjs().year();
|
||||||
if (currentMonth.value === -1) currentMonth.value = dayjs().month();
|
if (currentMonth.value === -1) currentMonth.value = dayjs().month();
|
||||||
if(props.timestamp){
|
if (props.timestamp) {
|
||||||
currentDay.value = initModelValue ? dayjs(parseInt(initModelValue)).startOf('date').unix()*1000 : -1;
|
currentDay.value = initModelValue
|
||||||
|
? dayjs(parseInt(initModelValue)).startOf("date").unix() * 1000
|
||||||
|
: -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rangeValue.first = initModelValue;
|
rangeValue.first = initModelValue;
|
||||||
@ -371,6 +373,6 @@ provide("datePicker", {
|
|||||||
rangeValue: rangeValue,
|
rangeValue: rangeValue,
|
||||||
rangeSeparator: props.rangeSeparator,
|
rangeSeparator: props.rangeSeparator,
|
||||||
simple: props.simple,
|
simple: props.simple,
|
||||||
timestamp:props.timestamp
|
timestamp: props.timestamp,
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -23,5 +23,5 @@ export type provideType = {
|
|||||||
};
|
};
|
||||||
rangeSeparator: string;
|
rangeSeparator: string;
|
||||||
simple: boolean;
|
simple: boolean;
|
||||||
timestamp:boolean;
|
timestamp: boolean;
|
||||||
};
|
};
|
||||||
|
@ -4,7 +4,7 @@ const useMove = function (el: HTMLElement, callback: Function) {
|
|||||||
let offsetY: number;
|
let offsetY: number;
|
||||||
if (el != null) {
|
if (el != null) {
|
||||||
el.addEventListener("mousedown", function (event: any) {
|
el.addEventListener("mousedown", function (event: any) {
|
||||||
const path = event.path || (event.composedPath && event.composedPath());
|
const path = event.composedPath();
|
||||||
if (path[0].className === "layui-layer-title") {
|
if (path[0].className === "layui-layer-title") {
|
||||||
if (event.button == 0 && el != null) {
|
if (event.button == 0 && el != null) {
|
||||||
const lexObj: any = getComputedStyle(el);
|
const lexObj: any = getComputedStyle(el);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
const useMove = function (el: HTMLElement, callback: Function) {
|
const useMove = function (el: HTMLElement, callback: Function) {
|
||||||
if (el != null) {
|
if (el != null) {
|
||||||
el.addEventListener("mousedown", function (event: any) {
|
el.addEventListener("mousedown", function (event: any) {
|
||||||
const path = event.path || (event.composedPath && event.composedPath());
|
const path = event.composedPath();
|
||||||
if (path[0].className === "layui-layer-resize") {
|
if (path[0].className === "layui-layer-resize") {
|
||||||
if (event.button == 0 && el != null) {
|
if (event.button == 0 && el != null) {
|
||||||
var x = el.offsetLeft;
|
var x = el.offsetLeft;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user