bugfix
This commit is contained in:
@@ -65,8 +65,16 @@ Component({
|
||||
onBtn(e: WechatMiniprogram.TouchEvent) {
|
||||
const index = Number((e.currentTarget.dataset as any).index) || 0
|
||||
const btn = (this.data.buttons[index] || {}) as any
|
||||
logger.debug(LOG, 'modal 按钮点击, index=', index, 'value=', btn.value)
|
||||
this.triggerEvent('confirm', { index, value: btn.value || '' })
|
||||
const value = btn.value || ''
|
||||
// 按语义分流:主按钮抛 confirm,其余(取消 / 稍后再说 / 再想想…)抛 cancel。
|
||||
// 否则「取消」也会落进页面的确认分支,取消后没有出口(曾出现停在空页)
|
||||
if (btn.type === 'main') {
|
||||
logger.debug(LOG, 'modal 主按钮点击, index=', index, 'value=', value)
|
||||
this.triggerEvent('confirm', { index, value })
|
||||
return
|
||||
}
|
||||
logger.debug(LOG, 'modal 取消按钮点击, index=', index, 'value=', value)
|
||||
this.triggerEvent('cancel', { index, value })
|
||||
},
|
||||
|
||||
onItem(e: WechatMiniprogram.TouchEvent) {
|
||||
|
||||
@@ -64,13 +64,18 @@ Page({
|
||||
this.setData({ confirmVisible: true })
|
||||
},
|
||||
|
||||
// 取消生成:回到场景选择抽屉,避免停在无任何可渲染内容的空页
|
||||
onConfirmCancel() {
|
||||
this.setData({ confirmVisible: false })
|
||||
this.setData({ confirmVisible: false, showSceneSheet: true })
|
||||
},
|
||||
|
||||
onConfirmGenerate(e: WechatMiniprogram.CustomEvent) {
|
||||
this.setData({ confirmVisible: false })
|
||||
if (e.detail.value !== 'ok') return
|
||||
if (e.detail.value !== 'ok') {
|
||||
// 兜底:非「开始生成」按钮同样回到场景抽屉(取消按钮已走 cancel 分支)
|
||||
this.setData({ showSceneSheet: true })
|
||||
return
|
||||
}
|
||||
const pending = (this as any).pendingScene || { sceneType: 1, scene: '' }
|
||||
this.doGenerate(pending.sceneType, pending.scene)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user