// component/protocolConfirmationView.ts Component({ /** * 组件的属性列表 */ properties: { }, /** * 组件的初始数据 */ data: { show: false, canSubmit: false, content: '', func: () => { } }, /** * 组件的方法列表 */ methods: { open(options: { content: string, callback: () => void }) { if (options.content) { this.setData({ show: true, func: options.callback, content: options.content }) } else { options.callback(); } }, onScrollToLower() { this.setData({ canSubmit: true }) }, confirm() { if (this.data.canSubmit) { this.data.func && this.data.func() this.setData({ show: false }) } } } })