Notify.mjs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { defineComponent, mergeProps as _mergeProps, createVNode as _createVNode } from "vue";
  2. import { pick, extend, numericProp, unknownProp, makeStringProp, createNamespace } from "../utils/index.mjs";
  3. import { Popup } from "../popup/index.mjs";
  4. import { popupSharedProps } from "../popup/shared.mjs";
  5. const [name, bem] = createNamespace("notify");
  6. const popupInheritProps = ["lockScroll", "position", "show", "teleport", "zIndex"];
  7. const notifyProps = extend({}, popupSharedProps, {
  8. type: makeStringProp("danger"),
  9. color: String,
  10. message: numericProp,
  11. position: makeStringProp("top"),
  12. className: unknownProp,
  13. background: String,
  14. lockScroll: Boolean
  15. });
  16. var stdin_default = defineComponent({
  17. name,
  18. props: notifyProps,
  19. emits: ["update:show"],
  20. setup(props, {
  21. emit,
  22. slots
  23. }) {
  24. const updateShow = (show) => emit("update:show", show);
  25. return () => _createVNode(Popup, _mergeProps({
  26. "class": [bem([props.type]), props.className],
  27. "style": {
  28. color: props.color,
  29. background: props.background
  30. },
  31. "overlay": false,
  32. "duration": 0.2,
  33. "onUpdate:show": updateShow
  34. }, pick(props, popupInheritProps)), {
  35. default: () => [slots.default ? slots.default() : props.message]
  36. });
  37. }
  38. });
  39. export {
  40. stdin_default as default,
  41. notifyProps
  42. };