u-back-top.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. "use strict";
  2. const common_vendor = require("../../../../common/vendor.js");
  3. const _sfc_main = {
  4. name: "u-back-top",
  5. mixins: [common_vendor.index.$u.mpMixin, common_vendor.index.$u.mixin, common_vendor.props$21],
  6. computed: {
  7. backTopStyle() {
  8. const style = {
  9. bottom: common_vendor.index.$u.addUnit(this.bottom),
  10. right: common_vendor.index.$u.addUnit(this.right),
  11. width: "40px",
  12. height: "40px",
  13. position: "fixed",
  14. zIndex: 10
  15. };
  16. return style;
  17. },
  18. show() {
  19. return common_vendor.index.$u.getPx(this.scrollTop) > common_vendor.index.$u.getPx(this.top);
  20. },
  21. contentStyle() {
  22. const style = {};
  23. let radius = 0;
  24. if (this.mode === "circle") {
  25. radius = "100px";
  26. } else {
  27. radius = "4px";
  28. }
  29. style.borderTopLeftRadius = radius;
  30. style.borderTopRightRadius = radius;
  31. style.borderBottomLeftRadius = radius;
  32. style.borderBottomRightRadius = radius;
  33. return common_vendor.index.$u.deepMerge(style, common_vendor.index.$u.addStyle(this.customStyle));
  34. }
  35. },
  36. methods: {
  37. backToTop() {
  38. common_vendor.index.pageScrollTo({
  39. scrollTop: 0,
  40. duration: this.duration
  41. });
  42. this.$emit("click");
  43. }
  44. }
  45. };
  46. if (!Array) {
  47. const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
  48. const _easycom_u_transition2 = common_vendor.resolveComponent("u-transition");
  49. (_easycom_u_icon2 + _easycom_u_transition2)();
  50. }
  51. const _easycom_u_icon = () => "../u-icon/u-icon.js";
  52. const _easycom_u_transition = () => "../u-transition/u-transition.js";
  53. if (!Math) {
  54. (_easycom_u_icon + _easycom_u_transition)();
  55. }
  56. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  57. return common_vendor.e({
  58. a: !_ctx.$slots.default && !_ctx.$slots.$default
  59. }, !_ctx.$slots.default && !_ctx.$slots.$default ? common_vendor.e({
  60. b: common_vendor.p({
  61. name: _ctx.icon,
  62. ["custom-style"]: _ctx.iconStyle
  63. }),
  64. c: _ctx.text
  65. }, _ctx.text ? {
  66. d: common_vendor.t(_ctx.text)
  67. } : {}, {
  68. e: common_vendor.s($options.contentStyle),
  69. f: common_vendor.o((...args) => $options.backToTop && $options.backToTop(...args))
  70. }) : {}, {
  71. g: common_vendor.p({
  72. mode: "fade",
  73. customStyle: $options.backTopStyle,
  74. show: $options.show
  75. })
  76. });
  77. }
  78. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-bf56b0c2"], ["__file", "F:/兴元/开门柜项目/平台端管理系统小程序/node_modules/uview-plus/components/u-back-top/u-back-top.vue"]]);
  79. wx.createComponent(Component);