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) {
|
||||
|
||||
Reference in New Issue
Block a user