style: format code for all

This commit is contained in:
LZHD
2021-07-06 01:01:42 +08:00
committed by 踏学吾痕
parent e1200f2dbe
commit 77a1a47110
114 changed files with 7068 additions and 1068 deletions

View File

@@ -4,7 +4,7 @@ import reBreadCrumb from "./src/index.vue";
export const ReBreadCrumb = Object.assign(reBreadCrumb, {
install(app: App) {
app.component(reBreadCrumb.name, reBreadCrumb);
},
}
});
export default ReBreadCrumb;

View File

@@ -5,11 +5,10 @@
<span
v-if="item.redirect === 'noRedirect' || index == levelList.length - 1"
class="no-redirect"
>{{ $t(item.meta.title) }}</span>
>{{ $t(item.meta.title) }}</span
>
<a v-else @click.prevent="handleLink(item)">
{{
$t(item.meta.title)
}}
{{ $t(item.meta.title) }}
</a>
</el-breadcrumb-item>
</transition-group>
@@ -17,7 +16,6 @@
</template>
<script lang="ts">
import { pathToRegexp } from "path-to-regexp";
import { ref, defineComponent, watch, Ref } from "vue";
import { useRoute, useRouter, RouteLocationMatched } from "vue-router";
@@ -28,7 +26,7 @@ export default defineComponent({
const route = useRoute();
const router = useRouter();
const isDashboard = (route: RouteLocationMatched): Boolean | string => {
const isDashboard = (route: RouteLocationMatched): boolean | string => {
const name = route && (route.name as string);
if (!name) {
return false;
@@ -41,10 +39,10 @@ export default defineComponent({
const first = matched[0];
if (!isDashboard(first)) {
matched = [
({
{
path: "/welcome",
meta: { title: "message.hshome" }
} as unknown) as RouteLocationMatched
} as unknown as RouteLocationMatched
].concat(matched);
}
levelList.value = matched.filter(
@@ -73,7 +71,7 @@ export default defineComponent({
});
</script>
<style lang="scss" scoped >
<style lang="scss" scoped>
.app-breadcrumb.el-breadcrumb {
display: inline-block;
font-size: 14px;

View File

@@ -4,7 +4,7 @@ import reCountTo from "./src";
export const ReCountTo = Object.assign(reCountTo, {
install(app: App) {
app.component(reCountTo.name, reCountTo);
},
}
});
export default ReCountTo;

View File

@@ -4,7 +4,7 @@ import {
computed,
watch,
onMounted,
unref,
unref
} from "vue";
import { countToProps } from "./props";
import { isNumber } from "/@/utils/is";
@@ -37,7 +37,7 @@ export default defineComponent({
remaining: null,
rAF: null,
color: null,
fontSize: "16px",
fontSize: "16px"
});
const getCountDown = computed(() => {
@@ -61,6 +61,7 @@ export default defineComponent({
state.rAF = requestAnimationFrame(count);
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
function pauseResume() {
if (state.paused) {
resume();
@@ -82,6 +83,7 @@ export default defineComponent({
requestAnimationFrame(count);
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
function reset() {
state.startTime = null;
cancelAnimationFrame(state.rAF);
@@ -166,12 +168,11 @@ export default defineComponent({
<span
style={{
color: props.color,
fontSize: props.fontSize,
}}
>
fontSize: props.fontSize
}}>
{state.displayValue}
</span>
</>
);
},
}
});

View File

@@ -11,7 +11,7 @@ export const countToProps = {
default: 0,
validator(value: number) {
return value >= 0;
},
}
},
color: propTypes.string.def(),
fontSize: propTypes.string.def(),
@@ -26,6 +26,6 @@ export const countToProps = {
>,
default(t: number, b: number, c: number, d: number) {
return (c * (-Math.pow(2, (-10 * t) / d) + 1) * 1024) / 1023 + b;
},
},
}
}
};

View File

@@ -4,7 +4,7 @@ import reCropper from "./src";
export const ReCropper = Object.assign(reCropper, {
install(app: App) {
app.component(reCropper.name, reCropper);
},
}
});
export default ReCropper;

View File

@@ -7,7 +7,7 @@ import {
ref,
unref,
computed,
PropType,
PropType
} from "vue";
import { templateRef } from "@vueuse/core";
import { useAttrs } from "/@/utils/useAttrs";
@@ -37,7 +37,7 @@ const defaultOptions: Cropper.Options = {
modal: true,
guides: true,
movable: true,
rotatable: true,
rotatable: true
};
export default defineComponent({
@@ -45,31 +45,35 @@ export default defineComponent({
props: {
src: {
type: String,
required: true,
required: true
},
alt: {
type: String,
type: String
},
width: {
type: [String, Number],
default: "",
default: ""
},
height: {
type: [String, Number],
default: "360px",
default: "360px"
},
crossorigin: {
type: String || Object,
default: undefined,
default: undefined
},
imageStyle: {
type: Object as PropType<CSSProperties>,
default: {},
default() {
return {};
}
},
options: {
type: Object as PropType<Options>,
default: {},
},
default() {
return {};
}
}
},
setup(props) {
const cropper: any = ref<Nullable<Cropper>>(null);
@@ -77,26 +81,22 @@ export default defineComponent({
const isReady = ref(false);
const getImageStyle = computed(
(): CSSProperties => {
return {
height: props.height,
width: props.width,
maxWidth: "100%",
...props.imageStyle,
};
}
);
const getImageStyle = computed((): CSSProperties => {
return {
height: props.height,
width: props.width,
maxWidth: "100%",
...props.imageStyle
};
});
const getWrapperStyle = computed(
(): CSSProperties => {
const { height, width } = props;
return {
width: `${width}`.replace(/px/, "") + "px",
height: `${height}`.replace(/px/, "") + "px",
};
}
);
const getWrapperStyle = computed((): CSSProperties => {
const { height, width } = props;
return {
width: `${width}`.replace(/px/, "") + "px",
height: `${height}`.replace(/px/, "") + "px"
};
});
function init() {
const imgEl = unref(imgElRef);
@@ -108,7 +108,7 @@ export default defineComponent({
ready: () => {
isReady.value = true;
},
...props.options,
...props.options
});
}
@@ -123,7 +123,7 @@ export default defineComponent({
imgElRef,
cropper,
getWrapperStyle,
getImageStyle,
getImageStyle
};
},
@@ -132,8 +132,7 @@ export default defineComponent({
<>
<div
class={useAttrs({ excludeListeners: true, excludeKeys: ["class"] })}
style={this.getWrapperStyle}
>
style={this.getWrapperStyle}>
<img
ref="imgElRef"
src={this.props.src}
@@ -144,5 +143,5 @@ export default defineComponent({
</div>
</>
);
},
}
});

View File

@@ -4,7 +4,7 @@ import reFlop from "./src/index.vue";
export const ReFlop = Object.assign(reFlop, {
install(app: App) {
app.component(reFlop.name, reFlop);
},
}
});
export default ReFlop;

View File

@@ -13,14 +13,15 @@ export default defineComponent({
backText: propTypes.number.def(1),
// flipping duration, please be consistent with the CSS animation-duration value.
// 翻牌动画时间与CSS中设置的animation-duration保持一致
duration: propTypes.number.def(600),
duration: propTypes.number.def(600)
},
setup(props) {
// eslint-disable-next-line vue/no-setup-props-destructure
const { frontText, backText, duration } = props;
let isFlipping = ref(false);
let flipType = ref("down");
let frontTextFromData = ref(frontText);
let backTextFromData = ref(backText);
const isFlipping = ref(false);
const flipType = ref("down");
const frontTextFromData = ref(frontText);
const backTextFromData = ref(backText);
const textClass = (number: number) => {
return "number" + number;
@@ -72,24 +73,19 @@ export default defineComponent({
flipDown,
flipUp,
setFront,
setBack,
setBack
};
},
render() {
const main = `m-flipper ${this.flipType} ${this.isFlipping ? "go" : ""}`;
const front = `digital front ${this.textClass(this.frontTextFromData)}`;
const back = `digital back ${this.textClass(this.backTextFromData)}`;
return (
<>
<div
class={`m-flipper ${this.flipType} ${this.isFlipping ? "go" : ""}`}
>
<div
class={`digital front ${this.textClass(this.frontTextFromData)}`}
></div>
<div
class={`digital back ${this.textClass(this.backTextFromData)}`}
></div>
</div>
</>
<div class={main}>
<div class={front} />
<div class={back} />
</div>
);
},
}
});

View File

@@ -11,8 +11,14 @@
</div>
</template>
<script lang='ts'>
import { ref, onBeforeMount, getCurrentInstance, nextTick } from "vue";
<script lang="ts">
import {
ref,
onBeforeMount,
getCurrentInstance,
nextTick,
onUnmounted
} from "vue";
import flippers from "./Filpper";
export default {
name: "Flop",
@@ -110,6 +116,13 @@ export default {
});
});
onUnmounted(() => {
if (timer.value) {
clearInterval(timer.value);
timer.value = null;
}
});
return {
timer,
flipObjs,

View File

@@ -6,17 +6,17 @@ import dataDialog from "./src/DataDialog.vue";
export const Control = Object.assign(control, {
install(app: App) {
app.component(control.name, control);
},
}
});
export const NodePanel = Object.assign(nodePanel, {
install(app: App) {
app.component(nodePanel.name, nodePanel);
},
}
});
export const DataDialog = Object.assign(dataDialog, {
install(app: App) {
app.component(dataDialog.name, dataDialog);
},
}
});

View File

@@ -3,18 +3,20 @@
<!-- 功能按钮 -->
<ul>
<li
v-for="(item,key) in titleLists"
v-for="(item, key) in titleLists"
:key="key"
:title="item.text"
:style="{background: focusIndex === key ? '#ccc' : ''}"
:style="{ background: focusIndex === key ? '#ccc' : '' }"
@mouseenter.prevent="onEnter(key)"
@mouseleave.prevent="focusIndex = -1"
>
<button
:ref="'controlButton' + key"
:disabled="item.disabled"
:style="{cursor: item.disabled === false ? 'pointer' : 'not-allowed'}"
@click="onControl(item,key)"
:style="{
cursor: item.disabled === false ? 'pointer' : 'not-allowed'
}"
@click="onControl(item, key)"
>
<span :class="'iconfont ' + item.icon"></span>
<p>{{ item.text }}</p>
@@ -24,14 +26,14 @@
</div>
</template>
<script lang='ts'>
import { defineComponent, ref, unref, onMounted, onUnmounted } from "vue";
<script lang="ts">
import { defineComponent, ref, unref, onMounted } from "vue";
import { templateRef } from "@vueuse/core";
export default defineComponent({
name: "Control",
props: {
lf: <ElRef>Object,
lf: null,
catTurboData: Boolean
},
emits: ["catData"],
@@ -107,12 +109,10 @@ export default defineComponent({
onMounted(() => {
props.lf.on("history:change", ({ data: { undoAble, redoAble } }) => {
unref(titleLists)[3].disabled = unref(
controlButton3
).disabled = !undoAble;
unref(titleLists)[4].disabled = unref(
controlButton4
).disabled = !redoAble;
unref(titleLists)[3].disabled = unref(controlButton3).disabled =
!undoAble;
unref(titleLists)[4].disabled = unref(controlButton4).disabled =
!redoAble;
});
});
@@ -126,14 +126,13 @@ export default defineComponent({
});
</script>
<style scoped>
@import "./assets/iconfont/iconfont.css";
.control-container {
position: absolute;
right: 20px;
background: hsla(0, 0%, 100%, 0.8);
box-shadow: 0 1px 4px rgb(0 0 0 / 30%);
box-shadow: 0 1px 4px rgb(0 0 0);
}
.iconfont {
font-size: 25px;
@@ -157,4 +156,4 @@ export default defineComponent({
background-color: transparent;
outline: none;
}
</style>
</style>

View File

@@ -1,8 +1,13 @@
<template>
<vue-json-pretty :path="'res'" :deep="3" :showLength="true" :data="graphData"></vue-json-pretty>
<vue-json-pretty
:path="'res'"
:deep="3"
:showLength="true"
:data="graphData"
></vue-json-pretty>
</template>
<script lang='ts'>
<script lang="ts">
import VueJsonPretty from "vue-json-pretty";
import "vue-json-pretty/lib/styles.css";
import { defineComponent } from "vue";
@@ -15,4 +20,4 @@ export default defineComponent({
VueJsonPretty
}
});
</script>
</script>

View File

@@ -8,14 +8,17 @@
@mousedown="nodeDragNode(item)"
>
<div class="node-item-icon" :class="item.class">
<div v-if="item.type === 'user' || item.type === 'time'" class="shape"></div>
<div
v-if="item.type === 'user' || item.type === 'time'"
class="shape"
></div>
</div>
<span class="node-label">{{item.text}}</span>
<span class="node-label">{{ item.text }}</span>
</div>
</div>
</template>
<script lang='ts'>
<script lang="ts">
import { defineComponent, ref, unref } from "vue";
export default defineComponent({
name: "NodePanel",
@@ -52,7 +55,6 @@ export default defineComponent({
});
</script>
<style scoped>
.node-panel {
position: absolute;

View File

@@ -1,34 +1,33 @@
const TurboType = {
SEQUENCE_FLOW: 1,
START_EVENT: 2,
END_EVENT: 3,
USER_TASK: 4,
SERVICE_TASK: 5,
EXCLUSIVE_GATEWAY: 6,
}
EXCLUSIVE_GATEWAY: 6
};
function getTurboType(type) {
switch (type) {
case 'bpmn:sequenceFlow':
return TurboType.SEQUENCE_FLOW
case 'bpmn:startEvent':
return TurboType.START_EVENT
case 'bpmn:endEvent':
return TurboType.END_EVENT
case 'bpmn:userTask':
return TurboType.USER_TASK
case 'bpmn:serviceTask':
return TurboType.SERVICE_TASK
case 'bpmn:exclusiveGateway':
return TurboType.EXCLUSIVE_GATEWAY
case "bpmn:sequenceFlow":
return TurboType.SEQUENCE_FLOW;
case "bpmn:startEvent":
return TurboType.START_EVENT;
case "bpmn:endEvent":
return TurboType.END_EVENT;
case "bpmn:userTask":
return TurboType.USER_TASK;
case "bpmn:serviceTask":
return TurboType.SERVICE_TASK;
case "bpmn:exclusiveGateway":
return TurboType.EXCLUSIVE_GATEWAY;
default:
return type
return type;
}
}
function convertNodeToTurboElement(node) {
const { id, type, x, y, text = '', properties } = node
const { id, type, x, y, text = "", properties } = node;
return {
incoming: [],
outgoing: [],
@@ -36,14 +35,14 @@ function convertNodeToTurboElement(node) {
type: getTurboType(node.type),
properties: {
...properties,
name: text && text.value || '',
name: (text && text.value) || "",
x: x,
y: y,
text,
logicFlowType: type,
logicFlowType: type
},
key: id,
}
key: id
};
}
function convertEdgeToTurboElement(edge) {
@@ -55,8 +54,9 @@ function convertEdgeToTurboElement(edge) {
startPoint,
endPoint,
pointsList,
text = '',
properties } = edge
text = "",
properties
} = edge;
return {
incoming: [sourceNodeId],
outgoing: [targetNodeId],
@@ -64,48 +64,41 @@ function convertEdgeToTurboElement(edge) {
dockers: [],
properties: {
...properties,
name: text && text.value || '',
name: (text && text.value) || "",
text,
startPoint,
endPoint,
pointsList,
logicFlowType: type,
logicFlowType: type
},
key: id,
}
key: id
};
}
export function toTurboData(data) {
const nodeMap = new Map()
const nodeMap = new Map();
const turboData = {
flowElementList: [],
}
data.nodes.forEach((node) => {
const flowElement = convertNodeToTurboElement(node)
turboData.flowElementList.push(flowElement)
nodeMap.set(node.id, flowElement)
})
data.edges.forEach((edge) => {
const flowElement = convertEdgeToTurboElement(edge)
const sourceElement = nodeMap.get(edge.sourceNodeId)
sourceElement.outgoing.push(flowElement.key)
const targetElement = nodeMap.get(edge.targetNodeId)
targetElement.incoming.push(flowElement.key)
turboData.flowElementList.push(flowElement)
})
return turboData
flowElementList: []
};
data.nodes.forEach(node => {
const flowElement = convertNodeToTurboElement(node);
turboData.flowElementList.push(flowElement);
nodeMap.set(node.id, flowElement);
});
data.edges.forEach(edge => {
const flowElement = convertEdgeToTurboElement(edge);
const sourceElement = nodeMap.get(edge.sourceNodeId);
sourceElement.outgoing.push(flowElement.key);
const targetElement = nodeMap.get(edge.targetNodeId);
targetElement.incoming.push(flowElement.key);
turboData.flowElementList.push(flowElement);
});
return turboData;
}
function convertFlowElementToEdge(element) {
const { incoming, outgoing, properties, key } = element
const {
text,
startPoint,
endPoint,
pointsList,
logicFlowType
} = properties
const { incoming, outgoing, properties, key } = element;
const { text, startPoint, endPoint, pointsList, logicFlowType } = properties;
const edge = {
id: key,
type: logicFlowType,
@@ -116,19 +109,25 @@ function convertFlowElementToEdge(element) {
endPoint,
pointsList,
properties: {}
}
const excludeProperties = ['startPoint', 'endPoint', 'pointsList', 'text', 'logicFlowType']
};
const excludeProperties = [
"startPoint",
"endPoint",
"pointsList",
"text",
"logicFlowType"
];
Object.keys(element.properties).forEach(property => {
if (excludeProperties.indexOf(property) === -1) {
edge.properties[property] = element.properties[property]
edge.properties[property] = element.properties[property];
}
})
return edge
});
return edge;
}
function convertFlowElementToNode(element) {
const { properties, key } = element
const { x, y, text, logicFlowType } = properties
const { properties, key } = element;
const { x, y, text, logicFlowType } = properties;
const node = {
id: key,
type: logicFlowType,
@@ -136,31 +135,32 @@ function convertFlowElementToNode(element) {
y,
text,
properties: {}
}
const excludeProperties = ['x', 'y', 'text', 'logicFlowType']
};
const excludeProperties = ["x", "y", "text", "logicFlowType"];
Object.keys(element.properties).forEach(property => {
if (excludeProperties.indexOf(property) === -1) {
node.properties[property] = element.properties[property]
node.properties[property] = element.properties[property];
}
})
return node
});
return node;
}
export function toLogicflowData(data) {
const lfData = {
nodes: [],
edges: [],
}
const list = data.flowElementList
list && list.length > 0 && list.forEach(element => {
if (element.type === TurboType.SEQUENCE_FLOW) {
const edge = convertFlowElementToEdge(element)
lfData.edges.push(edge)
} else {
const node = convertFlowElementToNode(element)
lfData.nodes.push(node)
}
})
return lfData
}
edges: []
};
const list = data.flowElementList;
list &&
list.length > 0 &&
list.forEach(element => {
if (element.type === TurboType.SEQUENCE_FLOW) {
const edge = convertFlowElementToEdge(element);
lfData.edges.push(edge);
} else {
const node = convertFlowElementToNode(element);
lfData.nodes.push(node);
}
});
return lfData;
}

File diff suppressed because one or more lines are too long

View File

@@ -1,55 +1,55 @@
export const nodeList = [
{
text: '开始',
type: 'start',
class: 'node-start'
text: "开始",
type: "start",
class: "node-start"
},
{
text: '矩形',
type: 'rect',
class: 'node-rect'
text: "矩形",
type: "rect",
class: "node-rect"
},
{
type: 'user',
text: '用户',
class: 'node-user'
type: "user",
text: "用户",
class: "node-user"
},
{
type: 'push',
text: '推送',
class: 'node-push'
type: "push",
text: "推送",
class: "node-push"
},
{
type: 'download',
text: '位置',
class: 'node-download'
type: "download",
text: "位置",
class: "node-download"
},
{
type: 'end',
text: '结束',
class: 'node-end'
},
]
type: "end",
text: "结束",
class: "node-end"
}
];
export const BpmnNode = [
{
type: 'bpmn:startEvent',
text: '开始',
class: 'bpmn-start'
type: "bpmn:startEvent",
text: "开始",
class: "bpmn-start"
},
{
type: 'bpmn:endEvent',
text: '结束',
class: 'bpmn-end'
type: "bpmn:endEvent",
text: "结束",
class: "bpmn-end"
},
{
type: 'bpmn:exclusiveGateway',
text: '网关',
class: 'bpmn-exclusiveGateway'
type: "bpmn:exclusiveGateway",
text: "网关",
class: "bpmn-exclusiveGateway"
},
{
type: 'bpmn:userTask',
text: '用户',
class: 'bpmn-user'
},
]
type: "bpmn:userTask",
text: "用户",
class: "bpmn-user"
}
];

View File

@@ -4,7 +4,7 @@ import reHamBurger from "./src/index.vue";
export const ReHamBurger = Object.assign(reHamBurger, {
install(app: App) {
app.component(reHamBurger.name, reHamBurger);
},
}
});
export default ReHamBurger;

View File

@@ -16,23 +16,23 @@
</template>
<script>
import { defineComponent } from "vue"
import { defineComponent } from "vue";
export default defineComponent({
name: "HamBurger",
props: {
isActive: {
type: Boolean,
default: false,
},
default: false
}
},
emits: ["toggleClick"],
setup(props, ctx) {
const toggleClick = () => {
ctx.emit("toggleClick")
}
ctx.emit("toggleClick");
};
return { toggleClick }
},
return { toggleClick };
}
});
</script>

View File

@@ -1,10 +1,10 @@
<template>
<div class="info">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" class="rule-form">
<el-form :model="model" :rules="rules" ref="ruleForm" class="rule-form">
<el-form-item prop="userName">
<el-input
clearable
v-model="ruleForm.userName"
v-model="model.userName"
placeholder="请输入用户名"
prefix-icon="el-icon-user"
></el-input>
@@ -14,7 +14,7 @@
clearable
type="password"
show-password
v-model="ruleForm.passWord"
v-model="model.passWord"
placeholder="请输入密码"
prefix-icon="el-icon-lock"
></el-input>
@@ -23,22 +23,31 @@
<el-input
maxlength="2"
onkeyup="this.value=this.value.replace(/[^\d.]/g,'');"
v-model.number="ruleForm.verify"
v-model.number="model.verify"
placeholder="请输入验证码"
></el-input>
<span class="verify" title="刷新" v-html="ruleForm.svg" @click.prevent="refreshVerify"></span>
<span
class="verify"
title="刷新"
v-html="model.svg"
@click.prevent="refreshVerify"
></span>
</el-form-item>
<el-form-item>
<el-button type="primary" @click.prevent="onBehavior">{{ tipsFalse }}</el-button>
<el-button type="primary" @click.prevent="onBehavior">{{
tipsFalse
}}</el-button>
<el-button @click="resetForm">重置</el-button>
<span class="tips" @click="changPage">{{ tips }}</span>
</el-form-item>
<span title="测试用户 直接登录" class="secret" @click="noSecret">免密登录</span>
<span title="测试用户 直接登录" class="secret" @click="noSecret"
>免密登录</span
>
</el-form>
</div>
</template>
<script lang='ts'>
<script lang="ts">
import {
ref,
defineComponent,
@@ -46,7 +55,8 @@ import {
onBeforeMount,
getCurrentInstance,
watch,
nextTick
nextTick,
toRef
} from "vue";
import { storageSession } from "/@/utils/storage";
@@ -59,7 +69,7 @@ export interface ContextProps {
dynamicText?: string;
}
import { useRouter, useRoute, Router } from "vue-router";
import { useRouter, useRoute } from "vue-router";
import { initRouter } from "/@/router";
@@ -75,6 +85,7 @@ export default defineComponent({
setup(props, ctx) {
let vm: any;
const model = toRef(props, "ruleForm");
let tips = ref("注册");
let tipsFalse = ref("登录");
@@ -83,7 +94,7 @@ export default defineComponent({
watch(
route,
async ({ path }, prevRoute: unknown): Promise<void> => {
async ({ path }): Promise<void> => {
await nextTick();
path.includes("register")
? (tips.value = "登录") && (tipsFalse.value = "注册")
@@ -106,7 +117,7 @@ export default defineComponent({
// 点击登录或注册
const onBehavior = (evt: Object): void => {
vm.refs.ruleForm.validate((valid: Boolean) => {
vm.refs.ruleForm.validate((valid: boolean) => {
if (valid) {
ctx.emit("onBehavior", evt);
} else {
@@ -135,7 +146,7 @@ export default defineComponent({
username: "admin",
accessToken: "eyJhbGciOiJIUzUxMiJ9.test"
});
initRouter("admin").then((router: Router) => {});
initRouter("admin").then(() => {});
router.push("/");
};
@@ -144,6 +155,7 @@ export default defineComponent({
});
return {
model,
rules,
tips,
tipsFalse,

View File

@@ -1,20 +1,20 @@
import { App } from "vue"
import amap from "./src/Amap.vue"
import baiduMap from "./src/BaiduMap.vue"
import { App } from "vue";
import amap from "./src/Amap.vue";
import baiduMap from "./src/BaiduMap.vue";
export const Amap = Object.assign(amap, {
install(app: App) {
app.component(amap.name, amap)
app.component(amap.name, amap);
}
})
});
export const BaiduMap = Object.assign(baiduMap, {
install(app: App) {
app.component(baiduMap.name, baiduMap)
app.component(baiduMap.name, baiduMap);
}
})
});
export default {
Amap,
BaiduMap
}
};

View File

@@ -1,20 +1,14 @@
<template>
<div>
</div>
<div></div>
</template>
<script lang='ts'>
<script lang="ts">
export default {
name: "BaiduMap",
setup(){
return{
}
},
}
setup() {
return {};
}
};
</script>
<style scoped>
</style>
<style scoped></style>

View File

@@ -4,7 +4,7 @@ import reSeamlessScroll from "./src/index.vue";
export const ReSeamlessScroll = Object.assign(reSeamlessScroll, {
install(app: App) {
app.component(reSeamlessScroll.name, reSeamlessScroll);
},
}
});
export default ReSeamlessScroll;

View File

@@ -1,13 +1,23 @@
<template>
<div :ref="'wrap' + classOption['key']">
<div :style="leftSwitch" v-if="navigation" :class="leftSwitchClass" @click="leftSwitchClick">
<div
:style="leftSwitch"
v-if="navigation"
:class="leftSwitchClass"
@click="leftSwitchClick"
>
<slot name="left-switch"></slot>
</div>
<div :style="rightSwitch" v-if="navigation" :class="rightSwitchClass" @click="rightSwitchClick">
<div
:style="rightSwitch"
v-if="navigation"
:class="rightSwitchClass"
@click="rightSwitchClick"
>
<slot name="right-switch"></slot>
</div>
<div
:ref="'realBox'+ classOption['key']"
:ref="'realBox' + classOption['key']"
:style="pos"
@mouseenter="enter"
@mouseleave="leave"
@@ -16,7 +26,7 @@
@touchend="touchEnd"
@mousewheel="wheel"
>
<div :ref="'slotList'+ classOption['key']" :style="float">
<div :ref="'slotList' + classOption['key']" :style="float">
<slot></slot>
</div>
<div v-html="copyHtml" :style="float"></div>
@@ -24,15 +34,8 @@
</div>
</template>
<script lang='ts'>
import {
defineComponent,
computed,
ref,
unref,
watchEffect,
nextTick
} from "vue";
<script lang="ts">
import { defineComponent, computed, ref, unref, nextTick } from "vue";
import {
tryOnMounted,
tryOnUnmounted,
@@ -85,7 +88,8 @@ export default defineComponent({
let isHover = false;
let ease = "ease-in";
let { data, classOption } = props;
// eslint-disable-next-line vue/no-setup-props-destructure
let { classOption } = props;
if (classOption["key"] === undefined) {
classOption["key"] = 0;
@@ -165,8 +169,9 @@ export default defineComponent({
let rightSwitch = computed(() => {
return {
position: "absolute",
margin: `${unref(height) / 2}px 0 0 ${unref(width) +
unref(options).switchOffset}px`,
margin: `${unref(height) / 2}px 0 0 ${
unref(width) + unref(options).switchOffset
}px`,
transform: "translateY(-50%)"
};
});
@@ -372,7 +377,7 @@ export default defineComponent({
if (isHover) return;
//进入move立即先清除动画 防止频繁touchMove导致多动画同时进行
// scrollCancle();
reqFrame = requestAnimationFrame(function() {
reqFrame = requestAnimationFrame(function () {
//实际高度
const h = unref(realBoxHeight) / 2;
//宽度
@@ -408,7 +413,7 @@ export default defineComponent({
xPos.value += step.value;
}
if (singleWaitTime) clearTimeout(singleWaitTime);
if (!!unref(realSingleStopHeight)) {
if (unref(realSingleStopHeight)) {
//是否启动了单行暂停配置
if (
Math.abs(unref(yPos)) % unref(realSingleStopHeight) <
@@ -421,7 +426,7 @@ export default defineComponent({
} else {
scrollMove();
}
} else if (!!unref(realSingleStopWidth)) {
} else if (unref(realSingleStopWidth)) {
if (
Math.abs(unref(xPos)) % unref(realSingleStopWidth) <
unref(step)
@@ -577,4 +582,4 @@ export default defineComponent({
};
}
});
</script>
</script>

View File

@@ -3,16 +3,18 @@
*/
export const animationFrame = () => {
window.cancelAnimationFrame = (function () {
return window.cancelAnimationFrame ||
return (
window.cancelAnimationFrame ||
window.webkitCancelAnimationFrame ||
window.mozCancelAnimationFrame ||
window.oCancelAnimationFrame ||
window.msCancelAnimationFrame ||
function (id) {
return window.clearTimeout(id)
return window.clearTimeout(id);
}
})()
window.requestAnimationFrame = function () {
);
})();
window.requestAnimationFrame = (function () {
return (
window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
@@ -20,25 +22,26 @@ export const animationFrame = () => {
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function (callback) {
return window.setTimeout(callback, 1000 / 60)
return window.setTimeout(callback, 1000 / 60);
}
)
}()
}
);
})();
};
/**
* @desc 判断数组是否相等
* @param {arr1,arr2}
* @return {Boolean}
* @param arr1
* @param arr2
*/
export const arrayEqual = (arr1: Array<any>, arr2: Array<any>) => {
if (arr1 === arr2) return true
if (arr1.length !== arr2.length) return false
if (arr1 === arr2) return true;
if (arr1.length !== arr2.length) return false;
for (let i = 0; i < arr1.length; ++i) {
if (arr1[i] !== arr2[i]) return false
if (arr1[i] !== arr2[i]) return false;
}
return true
}
return true;
};
/**
* @desc 深浅合并拷贝
@@ -47,62 +50,68 @@ export function copyObj() {
if (!Array.isArray) {
// @ts-expect-error
Array.isArray = function (arg) {
return Object.prototype.toString.call(arg) === '[object Array]'
}
return Object.prototype.toString.call(arg) === "[object Array]";
};
}
let name, options, src, copy, copyIsArray, clone,
let name,
options,
src,
copy,
copyIsArray,
clone,
i = 1,
// eslint-disable-next-line prefer-rest-params
target = arguments[0] || {}, // 使用||运算符排除隐式强制类型转换为false的数据类型
deep = false,
len = arguments.length
if (typeof target === 'boolean') {
deep = target
target = arguments[1] || {}
i++
// eslint-disable-next-line prefer-const
len = arguments.length;
if (typeof target === "boolean") {
deep = target;
// eslint-disable-next-line prefer-rest-params
target = arguments[1] || {};
i++;
}
if (typeof target !== 'object' && typeof target !== 'function') {
target = {}
if (typeof target !== "object" && typeof target !== "function") {
target = {};
}
// 如果arguments.length === 1 或typeof arguments[0] === 'boolean',且存在arguments[1]则直接返回target对象
if (i === len) {
return target
return target;
}
for (; i < len; i++) {
//所以如果源对象中数据类型为Undefined或Null那么就会跳过本次循环接着循环下一个源对象
// eslint-disable-next-line prefer-rest-params
if ((options = arguments[i]) != null) {
// 如果遇到源对象的数据类型为Boolean, Number for in循环会被跳过不执行for in循环// src用于判断target对象是否存在name属性
for (name in options) {
// src用于判断target对象是否存在name属性
src = target[name]
src = target[name];
// 需要复制的属性当前源对象的name属性
copy = options[name]
copy = options[name];
// 判断copy是否是数组
copyIsArray = Array.isArray(copy)
copyIsArray = Array.isArray(copy);
// 如果是深复制且copy是一个对象或数组则需要递归直到copy成为一个基本数据类型为止
if (deep && copy && (typeof copy === 'object' || copyIsArray)) {
if (deep && copy && (typeof copy === "object" || copyIsArray)) {
if (copyIsArray) {
copyIsArray = false
copyIsArray = false;
// 如果目标对象存在name属性且是一个数组
// 则使用目标对象的name属性否则重新创建一个数组用于复制
clone = src && Array.isArray(src) ? src : []
clone = src && Array.isArray(src) ? src : [];
} else {
// 如果目标对象存在name属性且是一个对象则使用目标对象的name属性否则重新创建一个对象用于复制
clone = src && typeof src === 'object' ? src : {}
clone = src && typeof src === "object" ? src : {};
}
// 深复制所以递归调用copyObject函数
// 返回值为target对象即clone对象
// copy是一个源对象
// @ts-expect-error
target[name] = copyObj(deep, clone, copy)
target[name] = copyObj(deep, clone, copy);
} else if (copy !== undefined) {
// 浅复制直接复制到target对象上
target[name] = copy
target[name] = copy;
}
}
}
}
return target
return target;
}

View File

@@ -4,7 +4,7 @@ import reSelector from "./src";
export const ReSelector = Object.assign(reSelector, {
install(app: App) {
app.component(reSelector.name, reSelector);
},
}
});
export default ReSelector;

View File

@@ -4,17 +4,17 @@ import {
nextTick,
onBeforeMount,
getCurrentInstance,
unref,
unref
} from "vue";
import { addClass, removeClass, toggleClass } from "/@/utils/operate";
import "./index.css";
let stayClass = "stay"; //鼠标点击
let activeClass = "hs-on"; //鼠标移动上去
let voidClass = "hs-off"; //鼠标移开
let inRange = "hs-range"; //当前选中的两个元素之间的背景
let bothLeftSides = "both-left-sides";
let bothRightSides = "both-right-sides";
const stayClass = "stay"; //鼠标点击
const activeClass = "hs-on"; //鼠标移动上去
const voidClass = "hs-off"; //鼠标移开
const inRange = "hs-range"; //当前选中的两个元素之间的背景
const bothLeftSides = "both-left-sides";
const bothRightSides = "both-right-sides";
let selectedDirection = "right"; //默认从左往右,索引变大
let overList = [];
@@ -26,37 +26,42 @@ export default defineComponent({
props: {
HsKey: {
type: Number || String,
default: 0,
default: 0
},
disabled: {
type: Boolean,
default: false,
default: false
},
value: {
type: Number,
default: 0,
default: 0
},
max: {
type: Array,
default: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
default() {
return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
}
},
// 回显数据的索引长度必须是2
echo: {
type: Array,
default: [],
},
default() {
return [];
}
}
},
emits: ["selectedVal"],
setup(props, { emit }) {
let vm: any;
let currentValue = props.value;
// eslint-disable-next-line vue/no-setup-props-destructure
const currentValue = props.value;
let rateDisabled = computed(() => {
const rateDisabled = computed(() => {
return props.disabled;
});
let classes = computed(() => {
let result = [];
const classes = computed(() => {
const result = [];
let i = 0;
let threshold = currentValue;
if (currentValue !== Math.floor(currentValue)) {
@@ -72,7 +77,7 @@ export default defineComponent({
});
// 鼠标移入
const setCurrentValue = (index) => {
const setCurrentValue = index => {
if (props.disabled) return;
// 当选中一个元素后,开始添加背景色
if (selectedList.length === 1) {
@@ -118,7 +123,7 @@ export default defineComponent({
};
// 鼠标离开
const resetCurrentValue = (index) => {
const resetCurrentValue = index => {
if (props.disabled) return;
// 移除先检查是否选中 选中则返回false 不移除
const currentHsDom = document.querySelector("." + voidClass + index);
@@ -130,7 +135,7 @@ export default defineComponent({
// 当选中一个元素后,开始移除背景色
if (selectedList.length === 1) {
let firstIndex = overList[0].index;
const firstIndex = overList[0].index;
if (index >= firstIndex) {
for (let i = 0; i <= index; i++) {
removeClass(
@@ -153,7 +158,7 @@ export default defineComponent({
// 鼠标点击
const selectValue = (index, item) => {
if (props.disabled) return;
let len = selectedList.length;
const len = selectedList.length;
if (len < 2) {
selectedList.push({ item, index });
@@ -188,19 +193,19 @@ export default defineComponent({
emit("selectedVal", {
left: selectedList[0].item,
right: selectedList[1].item,
whole: selectedList,
whole: selectedList
});
} else {
emit("selectedVal", {
left: selectedList[1].item,
right: selectedList[0].item,
whole: selectedList,
whole: selectedList
});
}
}
} else {
nextTick(() => {
selectedList.forEach((v) => {
selectedList.forEach(v => {
removeClass(
document.querySelector("." + voidClass + v.index),
activeClass,
@@ -217,7 +222,7 @@ export default defineComponent({
selectedList = [];
overList = [];
for (let i = 0; i <= props.max.length; i++) {
let currentDom = document.querySelector(".hs-select__item" + i);
const currentDom = document.querySelector(".hs-select__item" + i);
if (currentDom) {
removeClass(currentDom, inRange);
}
@@ -235,7 +240,7 @@ export default defineComponent({
};
// 回显数据
const echoView = (item) => {
const echoView = item => {
if (item.length === 0) return;
if (item.length > 2 || item.length === 1) {
@@ -291,14 +296,12 @@ export default defineComponent({
onClick={() => selectValue(key, item)}
style={{
cursor: unref(rateDisabled) ? "auto" : "pointer",
textAlign: "center",
textAlign: "center"
}}
key={key}
>
key={key}>
<div
ref={`hsdiv${props.HsKey}${key}`}
class={`hs-item ${[unref(classes)[key] + key]}`}
>
class={`hs-item ${[unref(classes)[key] + key]}`}>
<span>{item}</span>
</div>
</td>
@@ -309,5 +312,5 @@ export default defineComponent({
</table>
</>
);
},
}
});

View File

@@ -14,25 +14,25 @@ export default defineComponent({
props: {
splitSet: {
type: Object as PropType<ContextProps>,
require: true,
},
require: true
}
},
emits: ["resize"],
setup(props, ctx) {
let active = ref(false);
let hasMoved = ref(false);
let percent = ref(props.splitSet?.defaultPercent);
let type = props.splitSet?.split === "vertical" ? "width" : "height";
let resizeType = props.splitSet?.split === "vertical" ? "left" : "top";
const active = ref(false);
const hasMoved = ref(false);
const percent = ref(props.splitSet?.defaultPercent);
const type = props.splitSet?.split === "vertical" ? "width" : "height";
const resizeType = props.splitSet?.split === "vertical" ? "left" : "top";
let leftClass = ref([
const leftClass = ref([
"splitter-pane splitter-paneL",
props.splitSet?.split,
props.splitSet?.split
]);
let rightClass = ref([
const rightClass = ref([
"splitter-pane splitter-paneR",
props.splitSet?.split,
props.splitSet?.split
]);
const userSelect = computed(() => {
@@ -111,29 +111,25 @@ export default defineComponent({
class="vue-splitter-container clearfix"
style={(unref(cursor), unref(userSelect))}
onMouseup={() => onMouseUp()}
onMousemove={() => onMouseMove(event)}
>
onMousemove={() => onMouseMove(event)}>
<div
class={unref(leftClass)}
style={{ [unref(type)]: unref(percent) + "%" }}
>
style={{ [unref(type)]: unref(percent) + "%" }}>
{ctx.slots.paneL()}
</div>
<resizer
style={`${unref([resizeType])}:${unref(percent)}%`}
split={props.splitSet?.split}
onMousedown={() => onMouseDown()}
onClick={() => onClick()}
></resizer>
onClick={() => onClick()}></resizer>
<div
class={unref(rightClass)}
style={{ [unref(type)]: 100 - unref(percent) + "%" }}
>
style={{ [unref(type)]: 100 - unref(percent) + "%" }}>
{ctx.slots.paneR()}
</div>
<div v-show={unref(active)} class="vue-splitter-container-mask"></div>
</div>
</>
);
},
}
});

View File

@@ -6,18 +6,18 @@ export default defineComponent({
props: {
split: {
type: String,
required: true,
required: true
},
className: {
type: String,
default: "",
},
default: ""
}
},
setup(props) {
let classes = computed(() => {
const classes = computed(() => {
return ["splitter-pane-resizer", props.split, props.className].join(" ");
});
return () => <div class={unref(classes)}></div>;
},
}
});