index.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import { use } from '../utils';
  2. import { PopupMixin } from '../mixins/popup';
  3. var _use = use('popup'),
  4. sfc = _use[0],
  5. bem = _use[1];
  6. export default sfc({
  7. mixins: [PopupMixin],
  8. props: {
  9. position: String,
  10. transition: String,
  11. overlay: {
  12. type: Boolean,
  13. "default": true
  14. },
  15. closeOnClickOverlay: {
  16. type: Boolean,
  17. "default": true
  18. }
  19. },
  20. render: function render(h) {
  21. var _this = this,
  22. _bem;
  23. if (!this.shouldRender) {
  24. return;
  25. }
  26. var position = this.position;
  27. var emit = function emit(event) {
  28. return function () {
  29. return _this.$emit(event);
  30. };
  31. };
  32. var transitionName = this.transition || (position ? "van-popup-slide-" + position : 'van-fade');
  33. return h("transition", {
  34. "attrs": {
  35. "name": transitionName
  36. },
  37. "on": {
  38. "afterEnter": emit('opened'),
  39. "afterLeave": emit('closed')
  40. }
  41. }, [h("div", {
  42. "directives": [{
  43. name: "show",
  44. value: this.value
  45. }],
  46. "class": bem((_bem = {}, _bem[position] = position, _bem))
  47. }, [this.slots()])]);
  48. }
  49. });