MCPcopy Create free account
hub / github.com/Xu22Web/tech-study-js / Tip

Function Tip

tech-study.js:4538–4567  ·  view source on GitHub ↗
({ text, count, show, delayShow, countShow, callback, })

Source from the content-addressed store, hash-verified

4536 return;
4537}
4538function Tip({ text, count, show, delayShow, countShow, callback, }) {
4539 return createElementNode('div', undefined, {
4540 class: watchRef([show, delayShow], () => `egg_tip${show.value ? (delayShow.value ? ' active delay' : ' active') : ''}`),
4541 }, [
4542 createElementNode('span', undefined, {
4543 class: 'egg_text',
4544 }, createTextNode(text)),
4545 watchEffectRef(() => countShow.value
4546 ? createElementNode('span', undefined, {
4547 class: 'egg_countdown',
4548 }, createTextNode(watchEffectRef(() => `${count.value}s`)))
4549 : undefined),
4550 ], {
4551 onMounted() {
4552 // 倒计时
4553 const countDown = async () => {
4554 // 倒计时回调
4555 await callback(count.value);
4556 // 倒计时结束
4557 if (!count.value) {
4558 show.value = false;
4559 return;
4560 }
4561 count.value--;
4562 setTimeout(countDown, 1000);
4563 };
4564 countDown();
4565 },
4566 });
4567}
4568/**
4569 * @description 分隔符
4570 * @returns

Callers 1

createTipFunction · 0.70

Calls 4

createElementNodeFunction · 0.70
watchRefFunction · 0.70
createTextNodeFunction · 0.70
watchEffectRefFunction · 0.70

Tested by

no test coverage detected