当前位置: 首页 > ai >正文

Cursor下利用Stagewise实现 “所见即改” 的前端开发体验~

工欲善其事,必先利其器!发现好工具一定要第一时间和大家分享!

Stagewise 是一款专为前端开发者设计的 AI 辅助工具,旨在通过 可视化交互精准上下文传递,提升前端开发效率。它允许开发者直接在浏览器中选择 UI 元素,并将相关信息(如 DOM 结构、样式、截图等)发送给 AI 编程助手(如 Cursor、VsCode、Trae、Windsurf),实现 “所见即改” 的开发体验。


操作步骤:

  1. 在IDE插件市场中 搜索安装 Stagewise 插件!
    在这里插入图片描述

2.按下快捷键

  • Mac快捷键【command + Shift + P】 Win【ctrl + Shift + P】

  • 输入setup,选中stagewise,自动安装命令会发送到右侧聊天窗口,执行即可。
    在这里插入图片描述


  1. 🧩 Install the extension
    Install the extension from the extension store of your code editor:
  • Cursor: cursor:extension/stagewise.stagewise-vscode-extension VS
  • Code: vscode:extension/stagewise.stagewise-vscode-extension Trae:
  • trae:extension/stagewise.stagewise-vscode-extension Windsurf:
  • windsurf:extension/stagewise.stagewise-vscode-extension
  1. 👨🏽‍💻 Install and inject the toolbar (the extension will guide you)
  • In Cursor, Press CMD + Shift + P
  • Enter setupToolbar
  • Execute the command and the toolbar will init automatically 🦄

3.执行完成后,会自动在你的项目里引入Stagewise,再次启动项目,就会在右下角看到一个图标了。

在这里插入图片描述

此时鼠标移动到元素上方就可以点击选择元素。

在这里插入图片描述


核心功能

  1. 可视化元素选择

    • 在浏览器中点击任意 UI 元素(按钮、表单、卡片等),自动捕获其 DOM 路径、样式、截图及元数据(如 classNameid、组件名等)。
    • 支持多元素选择,便于批量调整关联组件(如表单组)。
  2. AI 代码生成与修改

    • 一键将选中的元素信息发送至 AI 编程助手(如 Cursor、GitHub Copilot),生成或调整代码,无需手动描述元素位置。
    • 支持实时反馈,修改后自动刷新页面预览效果。
  3. 多框架支持

    • 兼容主流前端框架(React、Vue、Next.js、SvelteKit 等),提供专用适配器,无需额外配置。
  4. 安全与轻量化

    • 仅在开发模式生效,不影响生产环境性能。
    • 数据传输加密,支持本地部署(通过 MCP 服务器)。
  5. 插件系统

    • 允许开发者扩展功能,如集成设计系统、业务逻辑插件等。

典型使用场景

  • UI 微调:快速修改按钮颜色、间距等样式,无需手动查找 CSS 类名。
  • 低代码开发:在混合 UI 与逻辑的场景中,精准调整组件行为。
  • 团队协作:选中问题元素并添加注释,AI 直接生成修改建议,减少沟通成本。

安装与使用

  1. 安装 VS Code 扩展
    • 在 VS Code 市场搜索并安装 Stagewise 扩展。
  2. 注入浏览器工具栏
    • 通过命令面板(CMD + Shift + P)执行 setupToolbar 初始化。
  3. 选择元素并发送至 AI
    • 在浏览器中点击目标元素,填写需求(如“增大字体”),AI 生成代码后自动应用。

技术架构

  • 双向通信:基于 WebSocket 连接浏览器与编辑器,数据包包含 DOM 结构、序列化状态及视觉快照。
  • 沙箱安全:仅限开发环境使用,敏感数据(如密码输入框)自动过滤。

未来发展

  • 计划支持 批量修改Figma 插件集成,进一步打通设计与开发流程。
  • 探索 跨编辑器通用适配层,兼容更多 AI 编程工具。

Stagewise 通过 “浏览器即界面” 的交互模式,显著减少了前端开发中的手动操作,尤其适合频繁调整 UI 或使用 AI 助手的开发者。


I’ll help you implement the stagewise toolbar into your Vue.js project. Let me first examine the project structure and then implement the required changes.

Read file: package.json
Great! I can see this is a Vue.js project using npm as the package manager, and the stagewise packages are already installed. Now let me check the current App.vue file to see how to integrate the toolbar.

Read file: src/App.vue
Perfect! I can see that the stagewise toolbar is already integrated into the App.vue file. The implementation looks correct:

  1. ✅ The @stagewise/toolbar-vue and @stagewise-plugins/vue packages are installed
  2. ✅ The StagewiseToolbar component is imported and used in the template
  3. ✅ The VuePlugin is imported and passed to the config
  4. ✅ The toolbar is positioned in the template

Let me also check the extensions.json file to confirm the stagewise extension is recommended:

Read file: extensions.json
Excellent! The stagewise toolbar is already properly implemented in your Vue.js project. Here’s what’s currently set up:

✅ Current Implementation Status

Package Installation:

  • @stagewise/toolbar-vue and @stagewise-plugins/vue are already installed

Integration:

  • The StagewiseToolbar component is properly imported and used in App.vue
  • The VuePlugin is correctly configured in the toolbar
  • The toolbar is positioned in the template

Extensions:

  • The stagewise VSCode extension is already in the recommended extensions list

🎯 Expected Behavior

The stagewise toolbar should:

  • ✅ Appear only in development mode (handled by the @stagewise/toolbar-vue package)
  • ✅ Not be included in production builds
  • ✅ Load once on initial browser opening
  • ✅ Only execute in the browser (not SSR)

🚀 Next Steps

  1. Start your development server:

    npm run dev
    
  2. Look for the toolbar: It should appear in the bottom right corner of your web app

  3. If the toolbar doesn’t appear: Contact the stagewise team via Discord at https://discord.gg/gkdGsDYaKA

The implementation is already complete and follows all the requirements. The stagewise toolbar should be working in your Vue.js project!


http://www.xdnf.cn/news/16360.html

相关文章:

  • Linux kill正在执行的后台任务 kill进程组
  • Cline与Cursor深度实战指南:AI编程助手的革命性应用
  • github上传本地项目过程记录
  • 【Datawhale AI夏令营】科大讯飞AI大赛(大模型技术)/夏令营:让AI理解列车排期表
  • 【计算机网络架构】网状型架构简介
  • 栈----4.每日温度
  • 226. 翻转二叉树
  • C语言(长期更新)第6讲:函数
  • (LeetCode 每日一题) 2210. 统计数组中峰和谷的数量 (数组)
  • 【RAG技术权威指南】从原理到企业级应用实践
  • Spring Boot音乐服务器项目-查询音乐模块
  • 【自动化运维神器Ansible】Ansible常用模块之archive模块详解
  • QT---概览
  • Spring AI 学习笔记
  • Datawhale 科大讯飞AI大赛(模型蒸馏)
  • 电科金仓 KingbaseES 深度解码:技术突破・行业实践・沙龙邀约 -- 融合数据库的变革之力
  • i节点学习
  • 7月27日星期日今日早报简报微语报早读
  • 从0开始学linux韦东山教程Linux驱动入门实验班(6)
  • Flink2.0学习笔记:Stream API 常用转换算子
  • Java面试实战:电商高并发与分布式事务处理
  • QT开发---网络编程下
  • JVM工具
  • Item16:成对使用new和delete时要采取相同形式
  • Milvus 实战全流程
  • 【重学数据结构】堆 Heap - 最小堆最大堆
  • Qt GUI缓存实现
  • SpringIoCDI
  • Adobe Animate中文版 v2024.24.0.10.14
  • python---类型转换