惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tailwind CSS Blog
C
CERT Recently Published Vulnerability Notes
P
Proofpoint News Feed
Vercel News
Vercel News
博客园 - 三生石上(FineUI控件)
IT之家
IT之家
Help Net Security
Help Net Security
月光博客
月光博客
N
News and Events Feed by Topic
Cloudbric
Cloudbric
博客园 - 司徒正美
L
LangChain Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Tenable Blog
The Register - Security
The Register - Security
The Hacker News
The Hacker News
I
InfoQ
The Last Watchdog
The Last Watchdog
MyScale Blog
MyScale Blog
Schneier on Security
Schneier on Security
WordPress大学
WordPress大学
小众软件
小众软件
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
宝玉的分享
宝玉的分享
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
K
Kaspersky official blog
L
LINUX DO - 热门话题
N
News | PayPal Newsroom
F
Fortinet All Blogs
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
Security @ Cisco Blogs
Recorded Future
Recorded Future
大猫的无限游戏
大猫的无限游戏
H
Help Net Security
Google Online Security Blog
Google Online Security Blog
S
Schneier on Security
C
Cisco Blogs
N
News and Events Feed by Topic
V2EX - 技术
V2EX - 技术
Latest news
Latest news
PCI Perspectives
PCI Perspectives
T
The Blog of Author Tim Ferriss
P
Palo Alto Networks Blog
T
Tor Project blog
Project Zero
Project Zero
云风的 BLOG
云风的 BLOG
Webroot Blog
Webroot Blog
Attack and Defense Labs
Attack and Defense Labs
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org

博客园 - AI健康

Git & GitHub 协作操作手册(三人团队) Copilot: 如何把kiro的spec转到leanSpec来 小龙虾作者peterSteinberger同时推进多少个项目?-来自copilot-edge chatGpt- 图片文件的群识别工程可落地 chatGpt-pc端监控获取微信群中照片 sonnet4.6: 如何在windows/android上使用无障碍功能保存微信群图片 openclaw-zero-token worked, respect and thanks the author and contributors openclaw-zero-token仓库支持的免费模型如下: 各AI平台 Web 使用政策-from sonnet4.5 openclaw-zero-token在wsl启用备忘 trae's tools include: figma, editor,etc. and its shortcut is c-a-/ opencode答复:Atlas vs Sisyphus 的关系 Windows 下 AI IDE/CLI 规则加载实测:硬链接能解决什么,不能解决什么 github-copilot源码调研kimi-cli:没有显示它支持全局规则文件 三大GUI AI 编程助手快捷键全解析:Antigravity、Trae 与 Kiro 对比指南 mouseless(少鼠) 技术调研 调研 骨传导麦克风 具体在图书馆等安静场合,微小声音模式下语音输入-结论是暂时不可行 opencode server,web两命令, --mDNS 参数的使用场景 跟 ChatGPT 对话:运行wsl+open code资源消耗-没验证 AI coding大模型+工具的组合实际效用对比
静态为主轻交互微信小程序开发环境推荐-chatgpt推荐
AI健康 · 2025-12-30 · via 博客园 - AI健康
为什么「不用担心」不用微信工具写代码?

因为:微信构建不依赖编辑器;编译结果 = 文件内容;

微信工具只关心:目录结构;json 合法性;API 调用

唯一不可替代价值是:运行小程序  真机调试 模拟审核环境 调用微信私有 API


这里我直接给你一套「可以长期用、不返工」的静态微信小程序日历标准模板,是按专业工程实践设计的,并且刻意对 Trae(GLM-4.7)+ Antigravity(Agent 化)友好

你可以把它当成 “母版工程”,以后所有静态类小程序都能从这里起步。


🎯 设计目标(先对齐)

本模板明确满足:

  • 纯静态(无云函数 / 无后端)
  • 只读日历 / 轻交互
  • 微信开发者工具 = 最终运行与调试
  • 主力开发:Trae + Antigravity
  • 不依赖跨端框架(避免过度复杂)
  • npm / miniprogram_npm 友好
  • 后期可演进为组件库

🧱 一、目录结构(核心)

wx-calendar/
├── miniprogram/                 # 微信真正关心的根
│   ├── app.js
│   ├── app.json
│   ├── app.wxss
│   │
│   ├── pages/
│   │   └── calendar/
│   │       ├── index.wxml
│   │       ├── index.wxss
│   │       ├── index.js
│   │       └── index.json
│   │
│   ├── components/
│   │   └── calendar/
│   │       ├── calendar.wxml
│   │       ├── calendar.wxss
│   │       ├── calendar.js
│   │       └── calendar.json
│   │
│   ├── utils/
│   │   ├── date.js
│   │   └── calendar.js
│   │
│   └── styles/
│       ├── variables.wxss
│       └── reset.wxss
│
├── scripts/                     # 非微信工具使用
│   └── lint.js
│
├── .vscode/
│   └── settings.json
│
├── project.config.json          # 微信开发者工具配置
├── package.json
├── README.md
└── .gitignore

关键点

  • miniprogram/ 是微信世界
  • 其余目录完全不被微信关心
  • Trae / Antigravity 在项目根目录工作最舒服

📄 二、关键文件模板(直接可用)

1️⃣ app.json

{
  "pages": [
    "pages/calendar/index"
  ],
  "window": {
    "navigationBarTitleText": "日历",
    "navigationBarBackgroundColor": "#ffffff"
  },
  "style": "v2",
  "sitemapLocation": "sitemap.json"
}

✔ 保持最简
✔ 不提前引入复杂配置


2️⃣ pages/calendar/index.wxml

<view class="page">
  <calendar
    year="{{year}}"
    month="{{month}}"
    days="{{days}}"
    current="{{today}}"
    bind:change="onMonthChange"
  />
</view>

重要设计决策
页面只做:

  • 数据准备
  • 事件转发

👉 视觉 + 网格逻辑全部放到组件


3️⃣ components/calendar/calendar.wxml

<view class="calendar">
  <view class="header">
    <text bindtap="prevMonth">‹</text>
    <text class="title">{{year}}-{{month}}</text>
    <text bindtap="nextMonth">›</text>
  </view>

  <view class="week">
    <text wx:for="{{weeks}}" wx:key="*this">{{item}}</text>
  </view>

  <view class="grid">
    <view
      wx:for="{{days}}"
      wx:key="date"
      class="cell {{item.isToday ? 'today' : ''}} {{item.isCurrentMonth ? '' : 'dim'}}"
    >
      {{item.day}}
    </view>
  </view>
</view>

这段非常适合 Trae / GLM-4.7 优化
你可以反复让模型:

  • 优化布局
  • 改交互
  • 改可读性

4️⃣ components/calendar/calendar.js

Component({
  properties: {
    year: Number,
    month: Number,
    days: Array,
    current: String
  },

  data: {
    weeks: ['一', '二', '三', '四', '五', '六', '日']
  },

  methods: {
    prevMonth() {
      this.triggerEvent('change', { offset: -1 })
    },
    nextMonth() {
      this.triggerEvent('change', { offset: 1 })
    }
  }
})

✔ 组件无状态
✔ 所有计算放 utils
✔ 非常适合 Agent 拆分


5️⃣ utils/calendar.js

export function buildMonth(year, month) {
  // 纯函数,AI 非常擅长优化
}

黄金原则
👉 所有复杂逻辑必须是「纯函数」
👉 Antigravity 非常适合对这里做 agent 校验


🧠 三、Trae(GLM-4.7)最佳使用方式(非常关键)

推荐 Prompt 模板(你可以直接存)

你是一个微信小程序工程师。
请只生成:
- WXML / WXSS / JS
- 不使用云函数
- 不使用后端
- 不引入第三方库

目标:静态日历组件
要求:
- 月视图
- 今日高亮
- 月份切换
- 使用 rpx
- 代码可直接放入 miniprogram 目录

为什么 GLM-4.7 适合?

  • 中文理解极强
  • 对“业务型组件”结构感很好
  • 不会乱引外部库

🤖 四、Antigravity(Agent 化)的正确姿势

推荐 Agent 拆分

Agent 职责
UI Agent 优化 WXML / WXSS
Logic Agent 校验日期计算正确性
Refactor Agent 提取 utils / 简化逻辑
Review Agent 检查是否符合微信规范

示例任务

验证 calendar.js 中日期生成逻辑:
- 2 月闰年
- 月初星期
- 月末补齐

👉 Antigravity 在 “验证 + 推演” 上非常强
👉 不要让它直接改微信配置文件


🧪 五、微信开发者工具的“正确使用方式”

你只在这 4 种情况打开它:

  1. 页面渲染是否正确
  2. 真机触控 / 字体 / rpx 表现
  3. 构建是否报错
  4. 审核前自检

禁止行为

  • 在里面重构代码
  • 在里面改 JSON 结构
  • 在里面写逻辑

✅ 六、这套模板的长期价值

  • ✔ 可直接升级成 组件库
  • ✔ 可接入 npm(miniprogram_npm)
  • ✔ 可演进成动态日历
  • ✔ 对 AI 非常“友好”
  • ✔ 审核风险极低

最后一句工程级建议

你现在的工具选择(Trae + Antigravity)是对的

只要你:

  • 把逻辑拆干净
  • 把微信工具当运行器

👉 小程序开发体验会接近 Web + AI IDE 的上限


其他包括 AI 工具建议、微信开发工具中的调试和性能:
https://chatgpt.com/share/69533f40-3114-8004-a8ed-95a277e6f6b2