(component): 新增 page-header 组件 backIcon 插槽

This commit is contained in:
就眠儀式 2022-11-08 23:15:30 +08:00
parent aaebe4f606
commit ad79521b3e
8 changed files with 40 additions and 25 deletions

View File

@ -100,7 +100,7 @@ watch(
//
const footOnOk = () => {
emits("update:modelValue", Month.value?Month.value:-1);
emits("update:modelValue", Month.value ? Month.value : -1);
if (datePicker.range) {
//
emits("ok");

View File

@ -116,7 +116,7 @@ const scrollTo = () => {
//
const footOnOk = () => {
emits("update:modelValue", Year.value?Year.value:-1);
emits("update:modelValue", Year.value ? Year.value : -1);
if (datePicker.range) {
//
emits("ok");

View File

@ -187,7 +187,7 @@ const endPlaceholder = computed(() => {
});
const dropdownRef = ref(null);
const $emits = defineEmits(["update:modelValue",'change','blur','focus']);
const $emits = defineEmits(["update:modelValue", "change", "blur", "focus"]);
const hms = ref({
hh: 0,
mm: 0,
@ -267,10 +267,10 @@ const getDateValue = () => {
}
if (props.timestamp) {
$emits("update:modelValue", dayjs(dayjsVal).unix() * 1000);
$emits("change",dayjs(dayjsVal).unix() * 1000);
$emits("change", dayjs(dayjsVal).unix() * 1000);
} else {
$emits("update:modelValue", dayjsVal);
$emits("change",dayjsVal);
$emits("change", dayjsVal);
}
setTimeout(() => {
unWatch = false;
@ -281,7 +281,7 @@ const getDateValueByRange = () => {
if (rangeValue.first === "" || rangeValue.last === "") {
dateValue.value = ["", ""];
$emits("update:modelValue", dateValue.value);
$emits("change",dateValue.value);
$emits("change", dateValue.value);
return;
}
let format = "YYYY-MM-DD";
@ -301,7 +301,7 @@ const getDateValueByRange = () => {
dayjs(rangeValue.last).format(format),
];
$emits("update:modelValue", dateValue.value);
$emits("change",dateValue.value);
$emits("change", dateValue.value);
setTimeout(() => {
unWatch = false;
}, 0);

View File

@ -109,7 +109,7 @@ const onBlur = (event: Event) => {
const onNumberBlur = (event: Event) => {
let value = (event.target as HTMLInputElement).value;
if(value === "") {
if (value === "") {
value = props.min ? String(props.min) : "0";
} else {
if (props.max && props.max < Number(value)) value = props.max.toString();

View File

@ -11,7 +11,7 @@ import { LayIcon } from "@layui/icons-vue";
import layButton from "../button/index.vue";
import { ref, watch, withDefaults, computed, Ref } from "vue";
import { InputNumberSize } from "./interface";
import { add, sub } from "./math"
import { add, sub } from "./math";
export interface InputNumberProps {
modelValue?: number;

View File

@ -1,21 +1,34 @@
//加法
function add(arg1: number, arg2: number) {
var r1, r2, m;
try { r1 = arg1.toString().split(".")[1].length } catch (e) { r1 = 0 }
try { r2 = arg2.toString().split(".")[1].length } catch (e) { r2 = 0 }
m = Math.pow(10, Math.max(r1, r2))
return (arg1 * m + arg2 * m) / m
var r1, r2, m;
try {
r1 = arg1.toString().split(".")[1].length;
} catch (e) {
r1 = 0;
}
try {
r2 = arg2.toString().split(".")[1].length;
} catch (e) {
r2 = 0;
}
m = Math.pow(10, Math.max(r1, r2));
return (arg1 * m + arg2 * m) / m;
}
//减法
function sub(arg1: number, arg2: number) {
var r1, r2, m, n;
try { r1 = arg1.toString().split(".")[1].length } catch (e) { r1 = 0 }
try { r2 = arg2.toString().split(".")[1].length } catch (e) { r2 = 0 }
m = Math.pow(10, Math.max(r1, r2));
n = (r1 >= r2) ? r1 : r2;
return ((arg1 * m - arg2 * m) / m).toFixed(n);
var r1, r2, m, n;
try {
r1 = arg1.toString().split(".")[1].length;
} catch (e) {
r1 = 0;
}
try {
r2 = arg2.toString().split(".")[1].length;
} catch (e) {
r2 = 0;
}
m = Math.pow(10, Math.max(r1, r2));
n = r1 >= r2 ? r1 : r2;
return ((arg1 * m - arg2 * m) / m).toFixed(n);
}
export {
add,
sub,
}
export { add, sub };

View File

@ -1,7 +1,7 @@
<template>
<div class="lay-page-header">
<div class="lay-page-header__left" @click="emits('back')">
<i class="layui-icon" :class="[backIcon]"></i>
<slot name="backIcon"><i class="layui-icon" :class="[backIcon]"></i></slot>
<div class="lay-page-header__title">{{ backText }}</div>
</div>
<div class="lay-page-header__content">

View File

@ -16,7 +16,9 @@
<li>
<h3>1.7.6 <span class="layui-badge-rim">2022-11-07</span></h3>
<ul>
<li>[新增] page-header 组件 back-icon 插槽, 自定义返回图标。</li>
<li>[新增] page-header 组件 back-icon 属性, 自定义返回图标。</li>
<li>[修复] input-number 组件 step 设置为小数时精度丢失的问题。</li>
<li>[修复] datePicker 组件 年选择器 清空后再点击确定回显错误。</li>
<li>[修复] select 组件 单选模式 与 多选模式 清空操作样式不统一的问题。</li>
<li>[修复] select 组件 单选模式 与 多选模式 下拉宽度不一致的问题。</li>