protocolConfirmationView.ts 723 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // component/protocolConfirmationView.ts
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. },
  8. /**
  9. * 组件的初始数据
  10. */
  11. data: {
  12. show: false,
  13. canSubmit: false,
  14. content: '',
  15. func: () => { }
  16. },
  17. /**
  18. * 组件的方法列表
  19. */
  20. methods: {
  21. open(options: { content: string, callback: () => void }) {
  22. if (options.content) {
  23. this.setData({
  24. show: true,
  25. func: options.callback,
  26. content: options.content
  27. })
  28. } else {
  29. options.callback();
  30. }
  31. },
  32. onScrollToLower() {
  33. this.setData({
  34. canSubmit: true
  35. })
  36. },
  37. confirm() {
  38. if (this.data.canSubmit) {
  39. this.data.func && this.data.func()
  40. this.setData({
  41. show: false
  42. })
  43. }
  44. }
  45. }
  46. })