wd-video-preview.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. "use strict";
  2. const common_vendor = require("../../../../common/vendor.js");
  3. if (!Math) {
  4. wdIcon();
  5. }
  6. const wdIcon = () => "../wd-icon/wd-icon.js";
  7. const __default__ = {
  8. name: "wd-video-preview",
  9. options: {
  10. addGlobalClass: true,
  11. virtualHost: true,
  12. styleIsolation: "shared"
  13. }
  14. };
  15. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  16. ...__default__,
  17. props: common_vendor.videoPreviewProps,
  18. setup(__props, { expose: __expose }) {
  19. const showPopup = common_vendor.ref(false);
  20. const previdewVideo = common_vendor.reactive({ url: "", poster: "", title: "" });
  21. function open(video) {
  22. showPopup.value = true;
  23. previdewVideo.url = video.url;
  24. previdewVideo.poster = video.poster;
  25. previdewVideo.title = video.title;
  26. }
  27. function close() {
  28. showPopup.value = false;
  29. common_vendor.nextTick$1(() => {
  30. handleClosed();
  31. });
  32. }
  33. function handleClosed() {
  34. previdewVideo.url = "";
  35. previdewVideo.poster = "";
  36. previdewVideo.title = "";
  37. }
  38. __expose({
  39. open,
  40. close
  41. });
  42. return (_ctx, _cache) => {
  43. return common_vendor.e({
  44. a: showPopup.value
  45. }, showPopup.value ? common_vendor.e({
  46. b: previdewVideo.url
  47. }, previdewVideo.url ? {
  48. c: previdewVideo.poster,
  49. d: previdewVideo.title,
  50. e: previdewVideo.url
  51. } : {}, {
  52. f: common_vendor.o(() => {
  53. }),
  54. g: common_vendor.o(close),
  55. h: common_vendor.p({
  56. name: "close",
  57. ["custom-class"]: `wd-video-preview__close`
  58. }),
  59. i: common_vendor.n(`wd-video-preview ${_ctx.customClass}`),
  60. j: common_vendor.s(_ctx.customStyle),
  61. k: common_vendor.o(close)
  62. }) : {});
  63. };
  64. }
  65. });
  66. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-81c5af26"]]);
  67. wx.createComponent(Component);