Skip to content

补充 mpx2web skill - #2545

Open
wangxiaokou wants to merge 22 commits into
masterfrom
feat-mpx2web-skill
Open

wangxiaokou wants to merge 22 commits into
masterfrom
feat-mpx2web-skill

Conversation

@wangxiaokou

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread .agents/skills/mpx2web/SKILL.md Outdated

| 知识库 | 说明 |
| --- | --- |
| [条件编译](./references/conditional-compile.md) | 模板、脚本、样式、JSON 等不同部分的条件编译语法,遇到无法跨端等效实现需分平台处理时读取 |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改skill需要考虑和mpx2rn skill(未来可能抽离出一个mpx base skill)混合使用,mpx2rn skill中已有的基础部分不需要再额外描述,重点描述web特有的差异和最佳实践

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要添加ssr reference

Comment thread .agents/skills/mpx2web/SKILL.md Outdated
11. 连续触摸手势与 `tap` 共存时,按 [Web 模板能力参考](./references/web-template-reference.md) 使用与当前手势绑定的一次性误触标记;禁止用固定时间窗吞掉之后的合法点击。
12. 用 `transform: scale()` 兼容小字号时,按 [Web 样式实践](./references/web-style-practice.md) 同时校正变换原点和布局占位;不能只让视觉字号变小。
13. WebView 消息安全按 [WebView Bridge 参考](./references/webview-bridge-reference.md) 核对。优先使用内建 `bindmessage`;若 Web 与小程序消息协议不同,用 `bindmessage@web` / `bindmessage@wx` 分开处理,或在同一处理器内写真实平台分支。Web 处理器在领券、跳转等副作用前严格拒绝缺失或不等于当前值的业务主键;不要写成“字段存在时才比较”。不得反向要求既有小程序协议新增 Web-only 的 origin/source/业务字段。只有额外监听全局 `message` 时才同时校验完整可信 origin 与当前 iframe `contentWindow`。
14. 存在 WXS 事件绑定时,先运行 `node <skill-root>/scripts/validate-wxs-web-events.js <file.mpx>` 检查小程序与 Web 事件是否成对。

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这为啥需要专门的校验脚本?


---

## 第三方 H5 SDK

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这到底是干嘛的?小众场景的话干掉吧


---

## Web 运行配置

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你专门搞一个Web config reference吧

Web 下不要依赖以下小程序语义:

- `onLaunch`:不要依赖冷启动/热启动区别,也不要依赖真实 `scene`、`shareTicket` 等宿主参数。
- App `onShow` / `onHide`:不要把它们当作小程序前后台事件,也不要依赖完整进入参数。

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为啥不依赖?


---

## 与微信小程序的全局能力差异

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这堆信息准确么?为啥不能依赖小程序语义?

Comment on lines +185 to +195
## Web 运行时配置入口

配置键及默认行为统一由 [Web JSON 配置参考](./web-json-reference.md#web-运行配置) 维护,本文件不重复列举。应用脚本需要读取或设置**运行时**配置时使用 `mpx.config.webConfig`;它不是 `mpx.config.js` 的导出对象,构建期 `webConfig` 仍位于 `pluginOptions.mpx.plugin`。

---

## Web 状态管理与 SSR

Web 端推荐使用 `@mpxjs/pinia` 承载新状态域。普通 CSR 可创建全局 Pinia 实例;SSR 必须为每次请求创建独立状态实例,避免请求间状态污染。

SSR 数据预取、`onAppInit`、`serverPrefetch`、`onSSRAppCreated` 与状态注水统一见 [SSR 专项参考](./ssr-reference.md)。

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你这些有专门的章节都没有必要写


---

## 选择器与基础标签转换

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

就说不支持标签选择器就行了


---

## 注水缓存与请求竞态

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这说的是啥。。。


---

## 同构请求层边界

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这又是在说啥??


---

## 数据预取与状态注水

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这需要写个简单示例

@@ -0,0 +1,182 @@
# Mpx2Web SSR 专项参考

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我都不知道你这篇文档的内容是从哪来的???
你要是不知道怎么写就让AI参考mpx文档https://mpxjs.cn/guide/advance/ssr.html改一下就好了。。。。


---

## Vue 生态组件

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你这个才是需要展开讲的。。。

- Web 不支持 `bubbles`、`composed`、`capturePhase` 传播选项,不依赖它们实现跨层通知。
- 需要跨层通知时,在 Web 侧显式监听并转发,或使用项目已有通信方案;保留原有数据,避免与微信传播链重复通知。接收关系不明确时不能只删除传播参数或用空回调代替。

### `$forceUpdate` 与 setup `forceUpdate`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这有啥需要适配的么?


---

## 小字号兼容

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为啥需要


---

## CSS 变量

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为啥需要


---

## 内建滚动组件与 transform

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为啥需要


---

## 浏览器页面滚动

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为啥需要


---

## Web 内建组件

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这有啥意义?


---

## Web 模板编译限制

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这又有啥意义?


---

## Web 原生标签

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这又是干嘛


---

## Web 组件降级

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有啥意义?

@@ -0,0 +1,171 @@
# Mpx2Web WebView Bridge 参考

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不需要这个,这个本身是输出web没啥关系。。。。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants