index.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import baseComponent from '../helpers/baseComponent'
  2. import classNames from '../helpers/libs/classNames'
  3. baseComponent({
  4. properties: {
  5. prefixCls: {
  6. type: String,
  7. value: 'wux-landscape',
  8. },
  9. visible: {
  10. type: Boolean,
  11. value: false,
  12. },
  13. mask: {
  14. type: Boolean,
  15. value: true,
  16. observer(newVal) {
  17. this.setData({ showMask: newVal })
  18. },
  19. },
  20. maskClosable: {
  21. type: Boolean,
  22. value: false,
  23. },
  24. closable: {
  25. type: Boolean,
  26. value: true,
  27. },
  28. },
  29. data: {
  30. showMask: true,
  31. },
  32. computed: {
  33. classes: ['prefixCls, showMask', function(prefixCls, showMask) {
  34. const wrap = classNames(prefixCls, {
  35. [`${prefixCls}--has-mask`]: showMask,
  36. })
  37. const popup = `${prefixCls}__popup`
  38. const popupBody = `${prefixCls}__popup-body`
  39. const popupClose = `${prefixCls}__popup-close`
  40. const inner = `${prefixCls}__inner`
  41. const close = `${prefixCls}__close`
  42. const x = `${prefixCls}__close-x`
  43. return {
  44. wrap,
  45. popup,
  46. popupBody,
  47. popupClose,
  48. inner,
  49. close,
  50. x,
  51. }
  52. }],
  53. },
  54. methods: {
  55. onClose() {
  56. this.triggerEvent('close', { visible: !this.data.visible })
  57. },
  58. },
  59. attached() {},
  60. })