Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 | 1x | // 生成本地临时 ID,用于尚未保存到后端的子表新增行。
// 使用负数以区别于后端生成的雪花 ID(恒为正),保存时后端会替换为真实 ID。
let sequence = 0
/**
* 生成会话内唯一的临时 ID(负数字符串)。
* @returns {string} 形如 "-1"、"-2" 的临时 ID。
*/
export function createTempId() {
sequence += 1
return String(-sequence)
}
|