congzc пре 2 година
родитељ
комит
304fb8c8e9
2 измењених фајлова са 32 додато и 0 уклоњено
  1. +17
    -0
      src/test/test.vue
  2. +15
    -0
      src/utils/index.js

+ 17
- 0
src/test/test.vue Прегледај датотеку

@@ -0,0 +1,17 @@
<template>
<div></div>
</template>

<script>
export default {
data() {
return {};
},

methods: {},

mounted() {},
};
</script>

<style lang="scss" scoped></style>

+ 15
- 0
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);
}

Loading…
Откажи
Сачувај