完善表单校验与公共数据逻辑

Co-Authored-By: Kimi-K3.1-Pro <noreply@moonshot.ai>
This commit is contained in:
lik
2026-10-24 18:49:02 +08:00
committed by trae-solo-agent
co-authored by Kimi-K3.1-Pro
parent d731fc1da3
commit a45a3d7a86
18 changed files with 496 additions and 336 deletions
+16
View File
@@ -0,0 +1,16 @@
// 使用微信原生返回拦截,导航栏返回和手势返回都不会静默丢失未保存内容。
function setUnsavedGuard(enabled) {
if (enabled && wx.canIUse('enableAlertBeforeUnload')) {
wx.enableAlertBeforeUnload({
message: '当前修改尚未保存,确定要离开吗?'
})
return
}
if (!enabled && wx.canIUse('disableAlertBeforeUnload')) {
wx.disableAlertBeforeUnload()
}
}
module.exports = {
setUnsavedGuard
}