From e04b2a36193569ada9d7cc65cb2114f8aee80fc1 Mon Sep 17 00:00:00 2001 From: XiaoXinPro 14 IAH5R <568170040@qq.com> Date: Tue, 18 Apr 2023 18:04:58 +0800 Subject: [PATCH 1/2] test --- src/test/test.vue | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/test/test.vue diff --git a/src/test/test.vue b/src/test/test.vue new file mode 100644 index 0000000..a70e3cf --- /dev/null +++ b/src/test/test.vue @@ -0,0 +1,17 @@ + + + + + From 602cb0fa0cf8f8b00f26be3f232c1503669e0b7c Mon Sep 17 00:00:00 2001 From: XiaoXinPro 14 IAH5R <568170040@qq.com> Date: Tue, 18 Apr 2023 18:06:10 +0800 Subject: [PATCH 2/2] upload --- src/utils/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/utils/index.js b/src/utils/index.js index 6fc1250..fcc3d4b 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -152,3 +152,18 @@ export function getDistances(lat1, lng1, lat2, lng2) { return objData } +/** +* @description:文本打字机 +* @param {*} data (text,target,duration) +*/ +export function typeWriter(text, target, duration) { + let i = 0; + let timer = setInterval(() => { + target += text[i]; + if (i + 1 == text.length) { + clearInterval(timer); + } else { + i++; + } + }, duration || 100); +}