Skip to content

AtRuler

沈孟平
最后更新于 2025-11-18 14:57:11

一把熬夜写完的尺子, 迭代了许久,希望他有用~

代码演示

基础示例

允许调整选区

固定宽度和步长

自定义样式

刻度吸附

API

AtRuler Props

名称类型默认值说明版本
value array[0, 0]选中区域的值,数组第一个元素为起始值,第二个元素为结束值
maxnumber必填项标尺最大值
heightnumber56标尺高度
min-gapnumber20标尺最小间隔,动态计算的时候才有用
stepnumber | 'auto''auto'步长
label-gapnumber5刻度标签隔几个显示
precisionnumber0label 显示精度
paddingnumber32标尺左右内边距
selection-area-clsstringundefined选中区域样式
selection-trigger-clsstringundefined选中区域触发器样式
selection-trigger-widthnumber3选中区域触发器宽度,自定义触发器或者刻度宽度不是默认时必传
tooltip-propsOmit<TooltipProps, 'show'>undefined选中区域 NaiveUI Tooltip Props 属性
cursor-clsstringundefined指针样式
cursor-text-clsstringundefined指针文本样式
marker-clsstring''刻度样式
marker-active-clsstring'bg-blue-500!'刻度选中样式
label-clsstringundefinedlabel 样式
adsorptionbooleanfalse刻度吸附
allow-adjust-selectionbooleanfalse允许调整现有选区

AtRuler Slots

名称参数说明版本
selection-tooltip()选中区域的 tooltip 内容
selection-trigger()选中区域的触发器

changelog

2451f - feat(components): AtRuler support allowAdjustSelection prop on 2024/8/9
84c2a - feat(components): AtRuler 支持刻度标签隔几个显示,自定义选中区域触发器宽度 on 2024/8/9
00b5b - feat(components): AtRuler 支持刻度吸附 on 2024/8/8
ca3ab - feat(components): add AtRuler on 2024/8/8

贡献者

Last updated: