diff --git a/eslint.config.js b/eslint.config.js
index 6584b56..eab63c0 100644
--- a/eslint.config.js
+++ b/eslint.config.js
@@ -7,6 +7,7 @@ module.exports = antfu(
'no-console': 'off',
'node/prefer-global/process': 'off',
'vue/custom-event-name-casing': 'off',
+ 'vue/component-name-in-template-casing': 'off',
},
},
unocss.configs.flat,
diff --git a/src/components/EllipsisText/index.ts b/src/components/EllipsisText/index.ts
new file mode 100644
index 0000000..f340b87
--- /dev/null
+++ b/src/components/EllipsisText/index.ts
@@ -0,0 +1,4 @@
+import ellipsisText from './src/EllipsisText.vue'
+import { withInstall } from '@/utils'
+
+export const EllipsisText = withInstall(ellipsisText)
diff --git a/src/components/EllipsisText/src/EllipsisText.vue b/src/components/EllipsisText/src/EllipsisText.vue
new file mode 100644
index 0000000..d97f7b0
--- /dev/null
+++ b/src/components/EllipsisText/src/EllipsisText.vue
@@ -0,0 +1,136 @@
+
+
+
+
+
+
+
+
+
+ false"
+ >
+
+
+
+ false"
+ >
+
+
+
+
+
diff --git a/src/components/EllipsisText/src/Tooltip.vue b/src/components/EllipsisText/src/Tooltip.vue
new file mode 100644
index 0000000..76d82c8
--- /dev/null
+++ b/src/components/EllipsisText/src/Tooltip.vue
@@ -0,0 +1,161 @@
+
+
+
+
+
+
+
diff --git a/src/components/EllipsisText/src/_utils.ts b/src/components/EllipsisText/src/_utils.ts
new file mode 100644
index 0000000..2fe9209
--- /dev/null
+++ b/src/components/EllipsisText/src/_utils.ts
@@ -0,0 +1,41 @@
+// cancelAnimationFrame
+export const cancelAnimationFrame = window.cancelAnimationFrame
+// 使用 requestAnimationFrame 模拟 setTimeout 和 setInterval
+export function rafTimeout(fn: Function, delay = 0, interval = false): object {
+ const requestAnimationFrame
+ = typeof window !== 'undefined' ? window.requestAnimationFrame : () => {}
+ let start: any = null
+ const raf = {
+ // 引用类型保存,方便获取 requestAnimationFrame()方法返回的 ID.
+ id: requestAnimationFrame(timeElapse),
+ }
+ function timeElapse(timestamp: number) {
+ /*
+ timestamp参数:与performance.now()的返回值相同,它表示requestAnimationFrame() 开始去执行回调函数的时刻
+ */
+ if (!start)
+ start = timestamp
+
+ const elapsed = timestamp - start
+ if (elapsed >= delay) {
+ fn() // 执行目标函数func
+ if (interval) {
+ // 使用间歇调用
+ start = null
+ raf.id = requestAnimationFrame(timeElapse)
+ }
+ }
+ else {
+ raf.id = requestAnimationFrame(timeElapse)
+ }
+ }
+
+ return raf
+}
+// 用于取消 rafTimeout 函数
+export function cancelRaf(raf: { id: number }): void {
+ const cancelAnimationFrame
+ = typeof window !== 'undefined' ? window.cancelAnimationFrame : () => {}
+ if (raf && raf.id)
+ cancelAnimationFrame(raf.id)
+}