u-index-item.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. "use strict";
  2. const common_vendor = require("../../../../common/vendor.js");
  3. const _sfc_main = {
  4. name: "u-index-item",
  5. mixins: [common_vendor.mpMixin, common_vendor.mixin, common_vendor.props$4],
  6. data() {
  7. return {
  8. // 本组件到滚动条顶部的距离
  9. top: 0,
  10. height: 0,
  11. id: ""
  12. };
  13. },
  14. created() {
  15. this.anchor = {};
  16. },
  17. mounted() {
  18. this.init();
  19. },
  20. methods: {
  21. init() {
  22. this.getParentData("u-index-list");
  23. if (!this.parent) {
  24. return common_vendor.index.$u.error("u-index-item必须要搭配u-index-list组件使用");
  25. }
  26. common_vendor.index.$u.sleep().then(() => {
  27. this.getIndexItemRect().then((size) => {
  28. this.top = Math.ceil(size.top);
  29. this.height = Math.ceil(size.height);
  30. });
  31. });
  32. },
  33. getIndexItemRect() {
  34. return new Promise((resolve) => {
  35. this.$uGetRect(".u-index-item").then((size) => {
  36. resolve(size);
  37. });
  38. });
  39. }
  40. }
  41. };
  42. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  43. return {
  44. a: `u-index-item-${$data.id}`,
  45. b: common_vendor.n(`u-index-item-${$data.id}`)
  46. };
  47. }
  48. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-0d40bf6c"], ["__file", "D:/project/赋强公证/notarization_applet/node_modules/uview-plus/components/u-index-item/u-index-item.vue"]]);
  49. wx.createComponent(Component);