index.js 657 B

123456789101112131415161718192021222324252627282930
  1. import ad from '../index/ad'
  2. ad({
  3. data: {
  4. visible: true,
  5. },
  6. onClose(e) {
  7. console.log('onClose', e)
  8. },
  9. onChange(e) {
  10. console.log('onChange', e)
  11. if (!e.detail.value) {
  12. wx.showModal({
  13. title: 'Sure to delete?',
  14. success: (res) => {
  15. if (res.confirm) {
  16. this.setData({
  17. visible: e.detail.value,
  18. })
  19. }
  20. },
  21. })
  22. }
  23. },
  24. onToggle() {
  25. this.setData({
  26. visible: !this.data.visible,
  27. })
  28. },
  29. })