# IM-Vote **Repository Path**: likeding/IM-Vote ## Basic Information - **Project Name**: IM-Vote - **Description**: im的投票功能 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-03-18 - **Last Updated**: 2026-04-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # H5 投票工具 基于 Vue 3 + Vant 4 开发的移动端投票 H5 应用,支持通过 iframe 嵌入到其他项目中使用。 ## 技术栈 - Vue 3 (Composition API) - Vite - Vant 4 - Vue Router 4 - Pinia - SCSS ## 功能特性 - 投票活动列表展示 - 投票详情页(含候选人排名) - 投票功能(单选/多选) - 实时投票结果展示 - 投票成功提示 - 支持 iframe 嵌入 - Token 身份验证(通过 postMessage 或 URL 参数传递) ## 快速开始 ```bash # 安装依赖 npm install # 启动开发服务器 npm run dev # 构建生产版本 npm run build ``` ## Token 传递方式 本项目通过 iframe 嵌入到其他项目中使用,支持以下方式传递 token: ### 1. URL 参数传递 ``` https://your-domain.com/?token=your_token_here ``` ### 2. postMessage 传递 父页面发送: ```javascript iframe.contentWindow.postMessage({ token: 'your_token' }, '*'); ``` 子页面接收: ```javascript window.addEventListener('message', (event) => { if (event.data && event.data.token) { // 获取到 token } }); ``` ### 3. 子页面主动请求 子页面加载后自动向父页面发送请求: ```javascript window.parent.postMessage({ type: 'GET_TOKEN' }, '*'); ``` ## 页面路由 - `/` - 投票列表页 - `/vote/:id` - 投票详情页 - `/vote-success` - 投票成功页 ## 作者 Giovan ## 官网 [https://www.giovan.cn](https://www.giovan.cn/#/)