- API 路由统一: 移除 /api/h5/,统一 /api/pms/ 入口 - 二进制改名: api-server -> pms-api(与服务名一致) - nginx: 合并 /api/ + /pms/api/ 为 /api/pms/ - 新增 docs/API.md 接口文档 - 后端: CabinetDetail 增加 rssi/pow_fail/address/soc 等字段 - Redis 管道批量读取仓体实时数据(SOC/电压/电流/功率) - DB: 所有 TIMESTAMP 列改为 DATETIME(修复类型不匹配) - 用户管理: 新增创建时间/修改时间列,状态改用 Switch - 角色管理/用户管理: 操作按钮改为图标 - PC 设备详情: 基本信息补全 RSSI/ICCID/电源/地址 - PC 卡片: 通道统计改用 Lucide 图标,颜色统一 - PC 二维码: canvas 渲染,含编号文字,支持右键下载 - H5: 按 uni-app 规范修正导航(navigateTo 替代 reLaunch) - H5: 详情页加返回导航条 - H5: 扫码支持摄像头(jsQR)+ ?id= 参数 - H5: 底部 tabBar 在所有页面常显 - H5: 首页统计改为 6 项(设备/通道/空闲/充电/充满/故障) - H5: 下拉刷新 / 上拉加载 - 产品首页: 添加业务联系 - 文档: 清理过时文件,补充缺失规范章节
2.8 KiB
2.8 KiB
title, impact, impactDescription, type, tags
| title | impact | impactDescription | type | tags | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| v-model Does Not Update During IME Composition | MEDIUM | v-model won't capture intermediate input for Chinese, Japanese, Korean and other IME languages | capability |
|
v-model Does Not Update During IME Composition
Impact: MEDIUM - When users type in languages that require an Input Method Editor (Chinese, Japanese, Korean, etc.), v-model won't update until the composition is complete. This breaks real-time validation, character counters, and live search features for international users.
IME (Input Method Editor) allows users to compose complex characters by typing multiple keystrokes. During this composition phase, v-model deliberately waits until the user confirms their selection before updating. This is usually desired, but can break features that need every keystroke.
Task Checklist
- Test forms with IME input if your app serves CJK (Chinese, Japanese, Korean) users
- For real-time features (live search, character counters), use manual event binding instead of v-model
- Consider both behaviors when designing - sometimes waiting for composition completion IS correct
- Document expected behavior for international users
Problem - v-model waits for composition:
<script setup>
import { ref } from 'vue'
const searchQuery = ref('')
const charCount = ref(0)
</script>
<template>
<!-- PROBLEM: During IME composition, searchQuery won't update -->
<!-- Chinese user types "ni hao" -> sees no results until they press space/enter -->
<input v-model="searchQuery" placeholder="Live search...">
<p>{{ searchQuery.length }} characters</p>
<!-- Character counter stays at 0 during IME input -->
</template>
Solution - Manual event binding for real-time updates:
<script setup>
import { ref } from 'vue'
const searchQuery = ref('')
// This captures EVERY input event, including during IME composition
function handleInput(event) {
searchQuery.value = event.target.value
}
</script>
<template>
<!-- CORRECT: Manual binding captures all input, including IME composition -->
<input
:value="searchQuery"
@input="handleInput"
placeholder="Live search..."
>
<p>{{ searchQuery.length }} characters</p>
</template>
<!-- Shorter inline version -->
<input
:value="searchQuery"
@input="event => searchQuery = event.target.value"
>
When v-model behavior IS correct:
<!-- For form submission, waiting for composition IS usually better -->
<!-- User expects to confirm their character selection before it's "official" -->
<input v-model="formName" placeholder="Enter your name">
<!-- The final composed characters will be submitted, not intermediate states -->