index.js 1.6 KB

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