index.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. "use strict";
  2. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  3. exports.__esModule = true;
  4. exports.default = void 0;
  5. var _babelHelperVueJsxMergeProps = _interopRequireDefault(require("@vue/babel-helper-vue-jsx-merge-props"));
  6. var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
  7. var _utils = require("../utils");
  8. var _functional = require("../utils/functional");
  9. var _event = require("../utils/dom/event");
  10. // Utils
  11. var _createNamespace = (0, _utils.createNamespace)('overlay'),
  12. createComponent = _createNamespace[0],
  13. bem = _createNamespace[1];
  14. function preventTouchMove(event) {
  15. (0, _event.preventDefault)(event, true);
  16. }
  17. function Overlay(h, props, slots, ctx) {
  18. var style = (0, _extends2.default)({
  19. zIndex: props.zIndex
  20. }, props.customStyle);
  21. if ((0, _utils.isDef)(props.duration)) {
  22. style.animationDuration = props.duration + "s";
  23. }
  24. return h("transition", {
  25. "attrs": {
  26. "name": "van-fade"
  27. }
  28. }, [h("div", (0, _babelHelperVueJsxMergeProps.default)([{
  29. "directives": [{
  30. name: "show",
  31. value: props.show
  32. }],
  33. "style": style,
  34. "class": [bem(), props.className],
  35. "on": {
  36. "touchmove": props.lockScroll ? preventTouchMove : _utils.noop
  37. }
  38. }, (0, _functional.inherit)(ctx, true)]), [slots.default == null ? void 0 : slots.default()])]);
  39. }
  40. Overlay.props = {
  41. show: Boolean,
  42. zIndex: [Number, String],
  43. duration: [Number, String],
  44. className: null,
  45. customStyle: Object,
  46. lockScroll: {
  47. type: Boolean,
  48. default: true
  49. }
  50. };
  51. var _default = createComponent(Overlay);
  52. exports.default = _default;