init
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,61 @@
|
||||
//加法
|
||||
function add(arg1: number, arg2: number) {
|
||||
var r1, r2, m, c;
|
||||
try {
|
||||
r1 = arg1.toString().split(".")[1].length;
|
||||
} catch (e) {
|
||||
r1 = 0;
|
||||
}
|
||||
try {
|
||||
r2 = arg2.toString().split(".")[1].length;
|
||||
} catch (e) {
|
||||
r2 = 0;
|
||||
}
|
||||
c = Math.abs(r1 - r2);
|
||||
m = Math.pow(10, Math.max(r1, r2));
|
||||
if (c > 0) {
|
||||
var cm = Math.pow(10, c);
|
||||
if (r1 > r2) {
|
||||
arg1 = Number(arg1.toString().replace(".", ""));
|
||||
arg2 = Number(arg2.toString().replace(".", "")) * cm;
|
||||
} else {
|
||||
arg1 = Number(arg1.toString().replace(".", "")) * cm;
|
||||
arg2 = Number(arg2.toString().replace(".", ""));
|
||||
}
|
||||
} else {
|
||||
arg1 = Number(arg1.toString().replace(".", ""));
|
||||
arg2 = Number(arg2.toString().replace(".", ""));
|
||||
}
|
||||
return (arg1 + arg2) / m;
|
||||
}
|
||||
//减法
|
||||
function sub(arg1: number, arg2: number) {
|
||||
var r1, r2, m, c;
|
||||
try {
|
||||
r1 = arg1.toString().split(".")[1].length;
|
||||
} catch (e) {
|
||||
r1 = 0;
|
||||
}
|
||||
try {
|
||||
r2 = arg2.toString().split(".")[1].length;
|
||||
} catch (e) {
|
||||
r2 = 0;
|
||||
}
|
||||
c = Math.abs(r1 - r2);
|
||||
m = Math.pow(10, Math.max(r1, r2));
|
||||
if (c > 0) {
|
||||
var cm = Math.pow(10, c);
|
||||
if (r1 > r2) {
|
||||
arg1 = Number(arg1.toString().replace(".", ""));
|
||||
arg2 = Number(arg2.toString().replace(".", "")) * cm;
|
||||
} else {
|
||||
arg1 = Number(arg1.toString().replace(".", "")) * cm;
|
||||
arg2 = Number(arg2.toString().replace(".", ""));
|
||||
}
|
||||
} else {
|
||||
arg1 = Number(arg1.toString().replace(".", ""));
|
||||
arg2 = Number(arg2.toString().replace(".", ""));
|
||||
}
|
||||
return (arg1 - arg2) / m;
|
||||
}
|
||||
export { add, sub };
|
||||
@@ -0,0 +1,29 @@
|
||||
import type { App, DefineComponent, Ref } from "vue";
|
||||
|
||||
export type StringObject = Record<string, unknown>;
|
||||
|
||||
export type UnknownObject = Record<string | number, unknown>;
|
||||
|
||||
export type UnknownFunction = (...arg: unknown[]) => unknown;
|
||||
|
||||
export type IDefineComponent<Props = UnknownObject> = DefineComponent<Props> & {
|
||||
install: (app: App, options?: InstallOptions) => void;
|
||||
};
|
||||
|
||||
export interface InstallOptions extends StringObject {}
|
||||
|
||||
export type Nullable<T> = T | null;
|
||||
|
||||
export type MaybeRef<T> = Ref<T> | T;
|
||||
|
||||
export type Recordable = Record<string, any>;
|
||||
|
||||
export type Number = number;
|
||||
|
||||
export type String = string;
|
||||
|
||||
export type Boolean = boolean;
|
||||
|
||||
export type NumberOrString = number | string;
|
||||
|
||||
export type BooleanOrString = boolean | string;
|
||||
@@ -0,0 +1,101 @@
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: "LaySlider",
|
||||
};
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import "./index.less";
|
||||
import { Ref, toRef } from "vue";
|
||||
import StandardVue from "./Standard.vue";
|
||||
import StandardRange from "./StandardRange.vue";
|
||||
import Vertical from "./Vertical.vue";
|
||||
import VerticalRange from "./VerticalRange.vue";
|
||||
|
||||
export interface SliderProps {
|
||||
vertical?: boolean;
|
||||
modelValue?: number | Array<number>;
|
||||
min?: number;
|
||||
max?: number;
|
||||
step?: number;
|
||||
disabled?: boolean;
|
||||
range?: boolean;
|
||||
rangeValue?: number[];
|
||||
showDots?: boolean;
|
||||
}
|
||||
|
||||
const emit = defineEmits(["update:modelValue"]);
|
||||
|
||||
const props = withDefaults(defineProps<SliderProps>(), {
|
||||
vertical: false,
|
||||
modelValue: 0,
|
||||
disabled: false,
|
||||
step: 0,
|
||||
min: 0,
|
||||
max: 100,
|
||||
showDots: false,
|
||||
});
|
||||
|
||||
let rangeValues: Ref<number[]> | any = toRef(props, "rangeValue");
|
||||
|
||||
function valHook(val: any) {
|
||||
emit("update:modelValue", val);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div v-if="vertical">
|
||||
<div v-if="range">
|
||||
<!-- 纵向区间 -->
|
||||
<VerticalRange
|
||||
:step="step"
|
||||
@linkValHook="valHook"
|
||||
:disabled="disabled"
|
||||
:rangeValue="rangeValues"
|
||||
:min="min"
|
||||
:max="max"
|
||||
:showDots="showDots"
|
||||
/>
|
||||
</div>
|
||||
<div v-else>
|
||||
<!-- 纵向 -->
|
||||
<Vertical
|
||||
:step="step"
|
||||
@linkValHook="valHook"
|
||||
:disabled="disabled"
|
||||
:val="modelValue"
|
||||
:min="min"
|
||||
:max="max"
|
||||
:showDots="showDots"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div v-if="range">
|
||||
<!-- 横向区间 -->
|
||||
<StandardRange
|
||||
:step="step"
|
||||
@linkValHook="valHook"
|
||||
:disabled="disabled"
|
||||
:rangeValue="rangeValues"
|
||||
:min="min"
|
||||
:max="max"
|
||||
:showDots="showDots"
|
||||
/>
|
||||
</div>
|
||||
<div v-else>
|
||||
<!-- 横向 -->
|
||||
<StandardVue
|
||||
:val="modelValue"
|
||||
@linkValHook="valHook"
|
||||
:disabled="disabled"
|
||||
:step="step"
|
||||
:min="min"
|
||||
:max="max"
|
||||
:showDots="showDots"
|
||||
></StandardVue>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1 @@
|
||||
.layui-dropdown{position:relative;display:inline-block}.layui-dropdown-content{position:absolute;z-index:99999;background-color:#fff;box-sizing:border-box;border:1px solid #e4e7ed;border-radius:2px;box-shadow:0 2px 12px #0000001a}.layui-dropdown-content>.layui-dropdown-menu{border-radius:var(--global-border-radius);margin:5px 0}.layui-dropdown-content .layui-menu{position:relative;background-color:#fff}.layui-dropdown-content .layui-menu li,.layui-dropdown-content .layui-menu-body-title a{padding:5px 15px}.layui-dropdown-content .layui-menu li{position:relative;display:flex;margin:1px 0;line-height:26px;color:#000c;font-size:14px;white-space:nowrap;cursor:pointer}.layui-dropdown-content .layui-menu li:hover{background-color:var(--global-neutral-color-2)}.layui-dropdown-content .layui-menu-body-title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.layui-dropdown-menu-prefix{margin-right:8px}.layui-dropdown-menu-suffix{margin-left:15px}.layui-dropdown-content .layui-menu li.layui-disabled:hover{background-color:inherit}:root{--icon-picker-border-radius: var(--global-border-radius);--icon-picker-checked-color: var(--global-checked-color)}.layui-iconpicker{position:relative;height:38px;line-height:38px;border-width:1px;border-style:solid;border-radius:var(--icon-picker-border-radius);cursor:pointer}.layui-iconpicker .layui-inline{height:36px;line-height:36px;vertical-align:top}.layui-iconpicker-title{padding-left:5px}.layui-iconpicker-main{padding:0 10px}.layui-iconpicker-main .layui-icon{font-size:20px}.layui-iconpicker-main .layui-inline{vertical-align:top}.layui-iconpicker-split .layui-iconpicker-main{padding:0 15px;border-right-width:1px;border-right-style:solid}.layui-iconpicker-suffix{position:relative;width:35px;text-align:center}.layui-iconpicker-suffix .layui-icon{font-size:14px;color:#00000080;transition:all .3s}.layui-iconpicker-down .layui-iconpicker-suffix .layui-icon-down{transform:rotate(180deg)}.layui-iconpicker-search{padding:10px;box-shadow:0 2px 8px #f0f1f2;border-bottom:1px solid whitesmoke}.layui-iconpicker-list{width:321px}.layui-iconpicker-list ul{margin:6px}.layui-iconpicker-list li{vertical-align:top;display:inline-block;width:60px;margin:2.5px;padding:5px;overflow:hidden;border:1px solid #eee;border-radius:2px;cursor:pointer;text-align:center}.layui-iconpicker-list li:hover{background-color:var(--global-neutral-color-1);color:#00000080}.layui-iconpicker-list li.layui-this{border-color:var(--icon-picker-checked-color);color:var(--icon-picker-checked-color)}.layui-iconpicker-list li .layui-icon{font-size:20px}.layui-iconpicker-list li .layui-elip{margin-top:2px;line-height:20px;font-size:12px}.layui-iconpicker-list .layui-none{margin:30px 0 35px}.layui-iconpicker-scroll .layui-iconpicker-list{max-height:200px}.layui-iconpicker-page{position:relative;padding:10px 10px 5px;border-top:1px solid #eee;text-align:right}.layui-iconpicker-page .layui-laypage{margin:0}.layui-iconpicker-page .layui-laypage a,.layui-iconpicker-page .layui-laypage span{padding:0 10px;color:#666}.layui-iconpicker-page .layui-laypage-count{position:absolute;left:10px}.layui-iconpicker-page .layui-laypage-curr .layui-laypage-em{background:0 0}.layui-iconpicker-page .layui-laypage-curr em{color:#666;color:#0009}.layui-iconpicker-page .layui-laypage-first,.layui-iconpicker-page .layui-laypage-last,.layui-iconpicker-page .layui-laypage-spr{display:none}.layui-colorpicker-disabled{opacity:.6}.layui-colorpicker-disabled,.layui-colorpicker-disabled *{cursor:not-allowed!important}
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user