zxl-common-utils
A Vue 3 utility library with common tools, components and helpers
5,145
| Install | |
|---|---|
npm install zxl-common-utils |
|
| Latest Version: | 0.0.28 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | Aug 19, 2026 |
| Links: | npm |
Maintainer: zhuxianliang
zxl-common-utils
一个基于 Vue 3 和 TypeScript 的通用工具库,封装常用方法、组件与工具。
安装
npm install zxl-common-utils
使用组件
滚动组件有两种:
domAutoScroll dom滚动
<script setup lang="ts">
import { ref, computed } from 'vue';
import { domAutoScroll } from 'zxl-common-utils';
const props = defineProps<{
data: Array<{ id: number; name: string }>;
}>();
const scrollAreaRef = ref<HTMLElement | null>(null);
const bindCloneOverlayEvents = (cloneContainer: HTMLElement, index: number) => {
const curssEl = cloneContainer.querySelector('.curss');
cloneContainer.addEventListener('mouseenter', () => {
curssEl?.classList.add('curss-h');
});
cloneContainer.addEventListener('mouseleave', () => {
curssEl?.classList.remove('curss-h');
});
};
</script>
<template>
<domAutoScroll
:enabled="true"
:item-count="data.length"
:scroll-config="{mode: 'step', speed: 0.5, stepInterval: 1000, stepDuration: 500}"
:on-clone-created="bindCloneOverlayEvents"
>
<div v-for="item in props.data" :key="item.id" class="item">
{{ item.name }}
</div>
</domAutoScroll>
</template>
echartsAutoScroll echarts滚动
<script setup lang="ts">
import { ref } from 'vue';
import { echartsAutoScroll } from 'zxl-common-utils';
const chartRef = ref<HTMLElement | null>(null);
const bindCloneOverlayEvents = (cloneContainer: HTMLElement) => {
事件逻辑按照自己的来,
};
const getOptions = () => {
return {
grid: ...,
legend: {show: false},
tooltip: ..,
xAxis: ...,
yAxis: ...,
series: ...,
} as echarts.EChartsOption;
};
</script>
<template>
<echartsAutoScroll
:chartRef="chartRef"
:enabled="true"
:itemCount="5"
:getOptions="getOptions"
:scrollConfig="{ speed: 0.5, stepInterval: 1000, stepDuration: 500 }"
@onCloneCreated="bindCloneOverlayEvents"
>
<div ref="chartRef" class="echarts-render"></div>
</echartsAutoScroll>
</template>
Related Packages
@chiballc/utils
TypeScript utilities, browser worker messaging, and the Kibao Nuxt module for Op...
10,723
0
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 0.0.28 | ^3.5.24 | MIT | |
| 0.0.27 | ^3.5.24 | MIT | |
| 0.0.26 | ^3.5.24 | MIT | |
| 0.0.25 | ^3.5.24 | MIT | |
| 0.0.24 | ^3.5.24 | MIT | |
| 0.0.23 | ^3.5.24 | MIT | |
| 0.0.22 | ^3.5.24 | MIT | |
| 0.0.21 | ^3.5.24 | MIT | |
| 0.0.20 | ^3.5.24 | MIT | |
| 0.0.19 | ^3.5.24 | MIT | |
| 0.0.18 | ^3.5.24 | MIT | |
| 0.0.17 | ^3.5.24 | MIT | |
| 0.0.16 | ^3.5.24 | MIT | |
| 0.0.15 | ^3.5.24 | MIT | |
| 0.0.14 | ^3.5.24 | MIT | |
| 0.0.13 | ^3.5.24 | MIT | |
| 0.0.12 | ^3.5.24 | MIT | |
| 0.0.11 | ^3.5.24 | MIT | |
| 0.0.10 | ^3.5.24 | MIT | |
| 0.0.9 | ^3.5.24 | MIT | |
| 0.0.8 | ^3.5.24 | MIT | |
| 0.0.7 | ^3.5.24 | MIT | |
| 0.0.6 | ^3.5.24 | MIT | |
| 0.0.5 | ^3.5.24 | MIT | |
| 0.0.4 | ^3.5.24 | MIT | |
| 0.0.3 | ^3.5.24 | MIT | |
| 0.0.2 | ^3.5.24 | MIT | |
| 0.0.1 | ^3.5.24 | MIT |