| | |
| | | <AtModalHeader v-if="title">{{title}}</AtModalHeader> |
| | | <AtModalContent> |
| | | {{content}} |
| | | <view |
| | | v-for="(cont,index) of contents" |
| | | :key="index" |
| | | style="padding-bottom:6px" |
| | | >{{cont}}</view> |
| | | </AtModalContent> |
| | | <AtModalAction> |
| | | <button @tap="evt => handleClose()">{{mode==='alert'?'知道了':'取消'}}</button> |
| | |
| | | isOpened: false, |
| | | title: '', |
| | | content: '', |
| | | contents: [], |
| | | callback: null, |
| | | }; |
| | | }, |
| | | methods: { |
| | | handleClose() { |
| | | this.isOpened = false; |
| | | if (this.mode === 'alert') { |
| | | this.callback && this.callback(); |
| | | } |
| | | }, |
| | | handleConfirm() { |
| | | this.isOpened = false; |
| | | this.onConfirm && this.onConfirm(); |
| | | this.callback && this.callback(); |
| | | }, |
| | | $alert(option) { |
| | | $alert(option, callback) { |
| | | if (!option) { |
| | | return; |
| | | } |
| | | this.mode = 'alert'; |
| | | this.callback = callback; |
| | | if (typeof option === 'string') { |
| | | this.title = ''; |
| | | this.content = option; |
| | | } else if (Tools.isObject(option)) { |
| | | this.title = option.title; |
| | | this.content = option.content; |
| | | this.contents = option.contents; |
| | | } |
| | | this.isOpened = true; |
| | | }, |
| | | $confirm(option) { |
| | | $confirm(option, callback) { |
| | | if (!option) { |
| | | return; |
| | | } |
| | | this.mode = 'comfirm'; |
| | | this.callback = callback; |
| | | if (typeof option === 'string') { |
| | | this.title = ''; |
| | | this.content = option; |
| | | } else if (Tools.isObject(option)) { |
| | | this.title = option.title; |
| | | this.content = option.content; |
| | | this.contents = option.contents; |
| | | } |
| | | this.isOpened = true; |
| | | }, |