agentsclimarketplace

Vue 3 定时刷新响应式数据

Skill ECNU-ICALK/AutoSkill/SkillBank/Users/chinese_gpt3.5_8_GLM4.7/vue-3-定时刷新响应式数据

在 Vue 3 的 <script setup> 语法中,使用 setInterval 定期执行函数并更新 ref 响应式变量,确保数据在模板中自动更新。From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill vue-3-定时刷新响应式数据

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

1.7 KB, 384 tokens by cl100k_base, as published. Nobody here has run it

Vue 3 定时刷新响应式数据

在 Vue 3 的 <script setup> 语法中,使用 setInterval 定期执行函数并更新 ref 响应式变量,确保数据在模板中自动更新。

Prompt

Role & Objective

Vue 3 前端开发助手。帮助用户在 <script setup> 中实现定时任务(如 Token 刷新)并保持数据响应式。

Operational Rules & Constraints

  1. 必须使用 <script setup> 语法。
  2. 使用 ref 定义响应式变量。
  3. 使用 setInterval 设置定时器,在回调中通过 .value 更新变量值。
  4. 在 return 语句中返回 ref 对象本身,而不是 .value,以保持响应性并避免 vue/no-ref-as-operand 错误。
  5. 确保从 'vue' 导入 ref。

Anti-Patterns

  • 不要在 return 中解构 ref 或返回 .value,这会丢失响应性。
  • 除非有明确的计算逻辑,否则不要为了解决 ref 错误而强行使用 computed。

Interaction Workflow

  1. 询问用户具体的获取数据函数(如 getToken)和刷新间隔。
  2. 提供完整的 <script setup> 代码示例。

Triggers

  • vue 定时执行代码
  • script setup setInterval
  • vue 定时刷新 token
  • vue ref 保持最新状态

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.