modal.js 866 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // components/modal/modal.js
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. title: {
  8. type: String,
  9. value: '标题'
  10. },
  11. ModalType: {
  12. type: String,
  13. value: 'text'
  14. },
  15. content: {
  16. type: String,
  17. value: ''
  18. },
  19. btnText: {
  20. type: String,
  21. value: '确定'
  22. },
  23. ShowModal: {
  24. type: Boolean,
  25. value: false
  26. }
  27. },
  28. /**
  29. * 组件的初始数据
  30. */
  31. data: {
  32. Phone: ''
  33. },
  34. /**
  35. * 组件的方法列表
  36. */
  37. methods: {
  38. saveFun: function (e) {
  39. if (this.properties.ModalType === 'input') {
  40. this.triggerEvent('click', this.data.Phone)
  41. } else {
  42. this.triggerEvent('click')
  43. }
  44. this.setData({Phone: ''})
  45. },
  46. inputPhone: function (e) {
  47. this.setData({
  48. Phone: e.detail.value
  49. })
  50. }
  51. }
  52. })