
skyline-scroll-api
Skyline 滚动控制 API 技能。涵盖 ScrollViewContext(程序化下拉刷新、下拉二级、滚动定位)、DraggableSheetContext(半屏面板程序化滚动)、worklet.scrollViewContext(UI 线程直接控制滚动)。适用于程序化触发刷新/二级、控制 DraggableSheet 位置、在 worklet 中操作滚动。触发关键词:ScrollViewContext、DraggableSheetContext、scrollTo、triggerRefresh、triggerTwoLevel、下拉刷新API、下拉二级API、滚动API、worklet scrollViewContext。
- Installs
- 916
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/wechat-miniprogram/skyline-skills --skill skyline-scroll-api- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads skyline-scroll-api automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Skyline 滚动控制 API
适用场景
- 程序化触发 scroll-view 下拉刷新或关闭刷新
- 程序化触发/关闭下拉二级("二楼"页面)
- 通过 ScrollViewContext 控制滚动位置和行为
- 控制 DraggableSheet 半屏面板滚动到指定位置
- 在 worklet 函数中(UI 线程)直接控制 scroll-view 滚动
核心概念
三大 API 族群
| API 族群 | 获取方式 | 线程 | 最低基础库 |
|---|---|---|---|
| ScrollViewContext | NodesRef.node() + enhanced 属性 | 逻辑线程 | 2.14.4 |
| DraggableSheetContext | NodesRef.node() | 逻辑线程 | 3.2.0 |
| worklet.scrollViewContext | NodesRef.ref() + SharedValue | UI 线程 | 3.3.0 |
获取实例
// ScrollViewContext(需开启 enhanced)
wx.createSelectorQuery().select('#scrollview').node()
.exec(res => { const ctx = res[0].node })
// DraggableSheetContext
wx.createSelectorQuery().select('.sheet').node()
.exec(res => { const ctx = res[0].node })
// worklet.scrollViewContext(通过 ref)
this.scrollRef = wx.worklet.shared()
this.createSelectorQuery().select('.scrollable')
.ref(res => { this.scrollRef.value = res.ref }).exec()
文档索引
根据需求快速定位(路径相对于 references/):
| 我想要... | 查阅文档 |
|---|---|
| 查看 ScrollViewContext 全部方法和属性 | api/scroll-view-context.md |
| 了解 DraggableSheetContext.scrollTo 参数 | api/draggable-sheet-context.md |
| 在 worklet 中控制滚动 | api/worklet-scroll-context.md |
| 查看完整代码模式(刷新、二级、Sheet 控制) | patterns.md |
强制规则
MUST(必须遵守)
-
scroll-view 必须开启
enhanced属性才能获取 ScrollViewContext:<!-- ❌ 错误:未开启 enhanced,node() 返回的不是 ScrollViewContext --> <scroll-view type="list" scroll-y> <!-- ✅ 正确 --> <scroll-view type="list" scroll-y enhanced> -
DraggableSheetContext.scrollTo 中 size 和 pixels 同时传入时,仅 size 生效:
// ❌ 错误:同时传入 size 和 pixels,pixels 被忽略 sheetContext.scrollTo({ size: 0.7, pixels: 200 }) // ✅ 正确:二选一 sheetContext.scrollTo({ size: 0.7 }) // 相对位置 sheetContext.scrollTo({ pixels: 200 }) // 绝对位置 -
worklet.scrollViewContext 必须通过
NodesRef.ref获取引用并存入 SharedValue:// ❌ 错误:使用 node() 而非 ref() this.createSelectorQuery().select('.scroll').node() .exec(res => { /* 这是 ScrollViewContext,不是 worklet 引用 */ }) // ✅ 正确:使用 ref() + shared() this.scrollRef = wx.worklet.shared() this.createSelectorQuery().select('.scroll') .ref(res => { this.scrollRef.value = res.ref }).exec() -
调用 worklet.scrollViewContext.scrollTo 的函数必须声明
'worklet'指令:// ❌ 错误:缺少 worklet 指令 onTap() { scrollViewContext.scrollTo(this.scrollRef.value, { top: 200 }) } // ✅ 正确 onTap() { 'worklet' scrollViewContext.scrollTo(this.scrollRef.value, { top: 200 }) }
NEVER(禁止行为)
- NEVER 在逻辑线程中调用
worklet.scrollViewContext.scrollTo——该 API 仅在 UI 线程(worklet 函数内)可用 - NEVER 在小程序插件中使用
worklet.scrollViewContext.scrollTo——该 API 不支持小程序插件
Quick Reference
ScrollViewContext 方法速查
| 方法 | 说明 | 最低基础库 |
|---|---|---|
scrollTo({ top, left, velocity, duration, animated }) | 滚动至指定位置 | 2.14.4 |
scrollIntoView(selector, options?) | 滚动至指定元素 | 2.14.4 |
triggerRefresh({ duration?, easingFunction? }) | 触发下拉刷新 | 3.0.0 |
closeRefresh() | 关闭下拉刷新 | 3.0.0 |
triggerTwoLevel({ duration?, easingFunction? }) | 触发下拉二级 | 3.0.0 |
closeTwoLevel({ duration?, easingFunction? }) | 关闭下拉二级 | 3.0.0 |
ScrollViewContext 属性速查
| 属性 | 类型 | 说明 |
|---|---|---|
| scrollEnabled | boolean | 滚动开关 |
| bounces | boolean | 边界弹性(仅 iOS) |
| showScrollbar | boolean | 显示滚动条 |
| pagingEnabled | boolean | 分页滑动 |
| fastDeceleration | boolean | 快速减速(仅 iOS) |
| decelerationDisabled | boolean | 取消滚动惯性(仅 iOS) |
场景决策表
| 场景 | 推荐 API |
|---|---|
| 程序化触发下拉刷新 | ScrollViewContext.triggerRefresh() |
| 数据加载完成后关闭刷新 | ScrollViewContext.closeRefresh() |
| 打开/关闭下拉二级 | triggerTwoLevel() / closeTwoLevel() |
| 滚动到指定偏移量 | ScrollViewContext.scrollTo({ top }) |
| 滚动到指定元素 | ScrollViewContext.scrollIntoView(selector) |
| 控制 DraggableSheet 位置 | DraggableSheetContext.scrollTo({ size }) |
| UI 线程中控制滚动(配合手势) | worklet.scrollViewContext.scrollTo() |
程序化刷新最小示例
// 获取 ScrollViewContext
wx.createSelectorQuery().select('#sv').node().exec(res => {
const ctx = res[0].node
ctx.triggerRefresh({ duration: 300 })
// 数据加载完成后
setTimeout(() => ctx.closeRefresh(), 2000)
})
相关技能
| 场景 | 推荐技能 | 说明 |
|---|---|---|
| scroll-view 组件属性和事件 | skyline-components | scroll-view/draggable-sheet 组件详解 |
| Worklet 动画系统 | skyline-worklet | SharedValue、timing/spring、worklet 基础 |
| 页面转场路由 | skyline-route | 自定义路由、预设路由 |
| Skyline 概览与迁移 | skyline-overview | 渲染引擎概览、兼容性 |
References 目录结构
references/
├── api/
│ ├── draggable-sheet-context.md
│ ├── scroll-view-context.md
│ └── worklet-scroll-context.md
└── patterns.md
FAQ
What does the skyline-scroll-api skill do?
Skyline 滚动控制 API 技能。涵盖 ScrollViewContext(程序化下拉刷新、下拉二级、滚动定位)、DraggableSheetContext(半屏面板程序化滚动)、worklet.scrollViewContext(UI 线程直接控制滚动)。适用于程序化触发刷新/二级、控制 DraggableSheet 位置、在 worklet 中操作滚动。触发关键词:ScrollViewContext、DraggableSheetContext、scrollTo、triggerRefresh、triggerTwoLevel、下拉刷新API、下拉二级API、滚动API、worklet scrollViewContext。
How do I install skyline-scroll-api?
Run npx skills add https://github.com/wechat-miniprogram/skyline-skills --skill skyline-scroll-api in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/skyline-scroll-api/ (personal) or .claude/skills/skyline-scroll-api/ (project).
Which AI agents can use skyline-scroll-api?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is skyline-scroll-api safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains skyline-scroll-api?
It is published by wechat-miniprogram in wechat-miniprogram/skyline-skills. It has 916 recorded installs.
More from wechat-miniprogram/skyline-skills
skyline-components
wechat-miniprogram/skyline-skills
Skyline 组件开发技能。涵盖 scroll-view 及其增强模式(列表/嵌套滚动)、swiper 高级特性、表单组件、图片/文本组件、半屏可拖拽组件、共享元素动画等。适用于需要开发滚动列表、轮播、表单输入、页面过渡动画等场景。
skyline-overview
wechat-miniprogram/skyline-skills
Skyline 渲染引擎概览与迁移技能。了解 Skyline 架构、性能优势、功能特性、迁移指南和最佳实践时使用此技能。适用于初次接触 Skyline、评估迁移成本、或需要了解整体框架的场景。
skyline-worklet
wechat-miniprogram/skyline-skills
Skyline Worklet 动画系统技能。使用 worklet 函数、共享变量(SharedValue)、动画类型(timing/spring/decay)、Easing 缓动函数、组合动画和线程通信(runOnUI/runOnJS)开发高性能交互动画时使用此技能。适用于拖拽、手势跟随、弹簧回弹等需要 UI 线程直接响应的动画场景。触发关键词:worklet、worklet 动画、SharedValue、共享变量、timing、spring、decay、Easing、runOnUI、runOnJS、applyAnimatedStyle、交互动画、手势动画、UI 线程动画。
skyline-route
wechat-miniprogram/skyline-skills
Skyline 自定义路由与页面转场技能。涵盖自定义路由动画(routeBuilder)、预设路由(7 种 wx:// 类型)、页面返回手势、容器转场动画(open-container)、Router API。适用于实现半屏弹窗、页面缩放、底部弹出、卡片展开等转场效果。触发关键词:自定义路由、custom-route、routeBuilder、navigateTo、页面转场、半屏、预设路由、返回手势、open-container。
skyline-config
wechat-miniprogram/skyline-skills
Skyline 小程序 JSON 配置规范技能。涵盖 app.json 全局配置(renderer、rendererOptions、componentFramework)、页面 json 配置(navigationStyle、disableScroll)、project.config.json 项目配置。适用于创建新 Skyline 项目、迁移 WebView 项目、配置混合渲染。触发关键词:app.json、页面配置、renderer、rendererOptions、skyline配置、navigationStyle、disableScroll、componentFramework、glass-easel、project.config.json。
skyline-wxss
wechat-miniprogram/skyline-skills
Skyline WXSS 样式支持技能。提供 Skyline 支持的 CSS 属性、值和限制信息。触发关键词:WXSS、CSS 支持、样式兼容性、属性支持、不支持的属性、display grid、position sticky、overflow、filter、渐变、gradient、linear-gradient、radial-gradient、conic-gradient、border-style、white-space、font-weight、text-decoration、text-overflow、aspect-ratio、will-change、calc、env、mask、mask-image、background-image、transition、animation、transform、font-feature-settings。
Popular backend & apis skills
find-skills
vercel-labs/skills
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
entra-app-registration
microsoft/azure-skills
Guides Microsoft Entra ID app registration, OAuth 2.0 authentication, and MSAL integration. USE FOR: create app registration, register Azure AD app, configure OAuth, set up authentication, add API permissions, generate service principal, MSAL example, console app auth, Entra ID setup, Azure AD authentication. DO NOT USE FOR: Key Vault secrets (use azure-keyvault-expiration-audit), general Azure resource security guidance.
google-agents-cli-adk-code
google/agents-cli
This skill should be used when the user wants to "write agent code", "build an agent with ADK", "add a tool", "create a callback", "define an agent", "use state management" — in a project that needs ADK (Agent Development Kit) API patterns and code examples. It provides a quick reference for agent types, tool definitions, orchestration patterns, callbacks, state management, the graph Workflow API, and reference recipes to study. Do NOT use for scaffolding (use google-agents-cli-scaffold) or deployment (use google-agents-cli-deploy).
embedded-captions
heygen-com/hyperframes
Add captions or subtitles to an existing single-subject talking-head video without editing the footage. Use for plain verbatim captions, cinematic captions embedded behind the subject, VFX captions, “炸/特效/酷炫字幕,” or a named identity from the 35-style catalog. Route by visual identity, not by backend engine. The quiet anchor rail is the default; embed every word only when the user explicitly wants a fully cinematic treatment. The workflow runs locally end to end, including transcription and subject matting; split multi-shot footage before applying it.
entra-agent-id
microsoft/azure-skills
Provision Microsoft Entra Agent Identity Blueprints, BlueprintPrincipals, and per-instance Agent Identities via Microsoft Graph, and configure OAuth 2.0 token exchange (fmipath, OBO, cross-tenant) including the Microsoft Entra SDK for AgentID sidecar. USE FOR: Agent Identity Blueprint, BlueprintPrincipal, agent OAuth, fmipath token exchange, agent OBO, Workload Identity Federation for agents, polyglot agent auth, Microsoft.Identity.Web.AgentIdentities. DO NOT USE FOR: standard Entra app registration (use entra-app-registration), Microsoft Foundry agent authoring (use microsoft-foundry).
neon
neondatabase/agent-skills
Overview of Neon, a complete set of cloud backend primitives around Lakebase Postgres: Auth, Object Storage, Functions, the AI Gateway, and Realtime. Start here to choose Neon for undecided login, files, APIs, and LLM calls, set up the CLI or MCP server, and follow the branch-first workflow. Use when building an app or backend on Neon, or when "Neon" or "Lakebase Postgres" is mentioned. Child skill neon-postgres wins for an existing DATABASEURL, SQL, schema, inspect, or search. Child skill neon-auth wins for login, users, sessions, identity routing, and Managed Better Auth setup. Child skill neon-realtime wins for live queries in reactive apps and agents. Also use for object storage, S3, buckets, serverless functions, function triggers, cron, AI gateway, LLM calls, realtime, logs, Loki, Grafana, observability, postgres, database, backend, Claimable Neon, neon.new, or a no-signup database.