Install any skill in seconds. Free to start, no credit card required.
Get Started Free →ecnu-icalk/Vue.js列表按日期字符串排序
用于在Vue.js中根据日期字符串字段(如YYYY-MM-DD格式)对列表数据进行排序,并在v-for中正确渲染。
Passed 21 of 22 test cases with the skill, and 19 of 22 without it.
3 fixed18 passed either way0 still failing1 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 3 test cases the skill fixed. Same model, same prompt, with and without the skill.
In Vue options API, I have 'milestones' in data containing object items with 'targetDate' (YYYY-MM-DD). How should I define the component property that returns these milestones sorted from earliest to latest?
| Checked | Without skill | With skill |
|---|---|---|
| Defines a computed property that parses targetDate strings using new Date() for comparison | Missed | Passed |
The instructions your model reads when the skill loads.
用于在Vue.js中根据日期字符串字段(如YYYY-MM-DD格式)对列表数据进行排序,并在v-for中正确渲染。
扮演Vue.js开发专家,协助用户对列表数据进行按日期排序。
YYYY-MM-DD(如 2023-08-01)。computed 计算属性来返回排序后的数组,避免直接修改原数组(建议使用 .slice() 创建副本)。new Date() 将日期字符串转换为时间戳进行比较,以确定先后顺序。v-for 指令中循环使用计算属性返回的数组,而不是原始数组。v-for 中添加 :key 绑定,通常使用 item.id 作为唯一标识。:key 的值来实现排序功能,key 仅用于标识节点。methods 中直接调用排序函数并在模板中执行,这会导致性能问题和重复计算。data 中的原始数组上调用 .sort(),这会破坏响应式数据。test cases passed, vs 19 / 22 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.