u-transition.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. "use strict";
  2. const common_vendor = require("../../../../common/vendor.js");
  3. const _sfc_main = {
  4. name: "u-transition",
  5. data() {
  6. return {
  7. inited: false,
  8. // 是否显示/隐藏组件
  9. viewStyle: {},
  10. // 组件内部的样式
  11. status: "",
  12. // 记录组件动画的状态
  13. transitionEnded: false,
  14. // 组件是否结束的标记
  15. display: false,
  16. // 组件是否展示
  17. classes: ""
  18. // 应用的类名
  19. };
  20. },
  21. emits: ["click", "beforeEnter", "enter", "afterEnter", "beforeLeave", "leave", "afterLeave"],
  22. computed: {
  23. mergeStyle() {
  24. const { viewStyle, customStyle } = this;
  25. return {
  26. transitionDuration: `${this.duration}ms`,
  27. // display: `${this.display ? '' : 'none'}`,
  28. transitionTimingFunction: this.timingFunction,
  29. // 避免自定义样式影响到动画属性,所以写在viewStyle前面
  30. ...common_vendor.index.$u.addStyle(customStyle),
  31. ...viewStyle
  32. };
  33. }
  34. },
  35. // 将mixin挂在到组件中,uni.$u.mixin实际上为一个vue格式对象
  36. mixins: [common_vendor.mpMixin, common_vendor.mixin, common_vendor.transition, common_vendor.props$16],
  37. watch: {
  38. show: {
  39. handler(newVal) {
  40. newVal ? this.vueEnter() : this.vueLeave();
  41. },
  42. // 表示同时监听初始化时的props的show的意思
  43. immediate: true
  44. }
  45. }
  46. };
  47. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  48. return common_vendor.e({
  49. a: $data.inited
  50. }, $data.inited ? {
  51. b: common_vendor.o((...args) => _ctx.clickHandler && _ctx.clickHandler(...args)),
  52. c: common_vendor.n($data.classes),
  53. d: common_vendor.s($options.mergeStyle),
  54. e: common_vendor.o((...args) => _ctx.noop && _ctx.noop(...args))
  55. } : {});
  56. }
  57. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-0573594d"], ["__file", "D:/project/赋强公证/notarization_applet/node_modules/uview-plus/components/u-transition/u-transition.vue"]]);
  58. wx.createComponent(Component);