feat 完善注释

This commit is contained in:
Ironsp
2026-10-01 17:24:57 +08:00
parent 2b59f68fd7
commit 9f4a5c7cda
183 changed files with 485 additions and 3615 deletions

View File

@@ -13,7 +13,6 @@ function normalize(value: DebounceValue): DebounceBinding {
return typeof value === 'function' ? { handler: value } : value
}
/** v-debounce 防抖点击:v-debounce="fn" 或 v-debounce="{ handler: fn, delay: 500 }" */
const debounce: Directive<Element, DebounceValue> = {
mounted(el, binding) {
const { handler, delay = 300 } = normalize(binding.value)

View File

@@ -3,7 +3,6 @@ import lazy from './lazy'
import debounce from './debounce'
import throttle from './throttle'
/** main.ts 调用:统一注册自定义指令 */
export function setupDirectives(app: App): void {
app
.directive('lazy', lazy)

View File

@@ -2,7 +2,6 @@ import type { Directive } from 'vue'
const observerMap = new WeakMap<Element, IntersectionObserver>()
/** v-lazy 图片懒加载:v-lazy="图片地址" */
const lazy: Directive<Element, string> = {
mounted(el, binding) {
if (!(el instanceof HTMLImageElement)) return

View File

@@ -13,7 +13,6 @@ function normalize(value: ThrottleValue): ThrottleBinding {
return typeof value === 'function' ? { handler: value } : value
}
/** v-throttle 节流点击:v-throttle="fn" 或 v-throttle="{ handler: fn, interval: 500 }" */
const throttle: Directive<Element, ThrottleValue> = {
mounted(el, binding) {
const { handler, interval = 500 } = normalize(binding.value)