custom-layout.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. if (!Array) {
  4. const _easycom_custom_nav_bar2 = common_vendor.resolveComponent("custom-nav-bar");
  5. const _easycom_custom_refresher2 = common_vendor.resolveComponent("custom-refresher");
  6. const _easycom_custom_nomore2 = common_vendor.resolveComponent("custom-nomore");
  7. const _easycom_z_paging2 = common_vendor.resolveComponent("z-paging");
  8. (_easycom_custom_nav_bar2 + _easycom_custom_refresher2 + _easycom_custom_nomore2 + _easycom_z_paging2)();
  9. }
  10. const _easycom_custom_nav_bar = () => "./custom-nav-bar.js";
  11. const _easycom_custom_refresher = () => "./custom-refresher.js";
  12. const _easycom_custom_nomore = () => "./custom-nomore.js";
  13. const _easycom_z_paging = () => "../../uni_modules/z-paging/components/z-paging/z-paging.js";
  14. if (!Math) {
  15. (_easycom_custom_nav_bar + _easycom_custom_refresher + _easycom_custom_nomore + _easycom_z_paging)();
  16. }
  17. const _sfc_main = {
  18. __name: "custom-layout",
  19. props: {
  20. title: {
  21. type: String,
  22. default: ""
  23. },
  24. titleColor: {
  25. type: String,
  26. default: "#000000"
  27. },
  28. modelValue: {
  29. type: Array,
  30. default: []
  31. },
  32. topHeight: {
  33. type: Number,
  34. default: 80
  35. },
  36. refresheronly: {
  37. type: Boolean,
  38. default: false
  39. },
  40. refresherEnabled: {
  41. type: Boolean,
  42. default: true
  43. },
  44. showBottom: {
  45. type: Boolean,
  46. default: false
  47. },
  48. backgroundColor: {
  49. type: String,
  50. default: "linear-gradient(to top right, #CDDC39, #8BC34A, #FFEB3B)"
  51. },
  52. // 返回按钮相关配置
  53. back: {
  54. type: Object,
  55. default: function() {
  56. return {
  57. // 是否显示返回按钮,默认显示
  58. show: true
  59. // 返回按钮的图片地址
  60. // imgUrl: require('../../static/images/ico_back.png')
  61. };
  62. }
  63. },
  64. showPageBottom: {
  65. type: Boolean,
  66. default: false
  67. }
  68. },
  69. emits: ["update:modelValue", "layoutquery", "refresh", "scroll"],
  70. setup(__props, { expose: __expose, emit: __emit }) {
  71. const emit = __emit;
  72. const props = __props;
  73. const tableData = common_vendor.computed({
  74. // 自定义组件内部获取父组件传递的数据
  75. get: () => props.modelValue ? props.modelValue : [],
  76. // 数据发生变化时同步修改父组件中的数据
  77. set: (val) => {
  78. emit("update:modelValue", val);
  79. }
  80. });
  81. const navbar = common_vendor.ref();
  82. function onScroll(event) {
  83. navbar.value.scrollScroll(event.detail.scrollTop);
  84. emit("scroll", event.detail.scrollTop);
  85. }
  86. function onQuery(pageNo, pageSize) {
  87. emit("layoutquery", {
  88. pageNo,
  89. pageSize
  90. });
  91. }
  92. function onRefresh() {
  93. emit("refresh");
  94. }
  95. const paging = common_vendor.ref();
  96. function complete(list) {
  97. paging.value.complete(list);
  98. }
  99. __expose({
  100. complete
  101. });
  102. return (_ctx, _cache) => {
  103. return common_vendor.e({
  104. a: common_vendor.sr(navbar, "1a976688-1,1a976688-0", {
  105. "k": "navbar"
  106. }),
  107. b: common_vendor.p({
  108. ["background-color"]: __props.backgroundColor,
  109. back: __props.back,
  110. backgroundImageShow: true,
  111. topHeight: __props.topHeight,
  112. title: __props.title,
  113. ["title-color"]: __props.titleColor
  114. }),
  115. c: __props.showPageBottom
  116. }, __props.showPageBottom ? {} : {}, {
  117. d: common_vendor.w(({
  118. refresherStatus
  119. }, s0, i0) => {
  120. return {
  121. a: "1a976688-2-" + i0 + ",1a976688-0",
  122. b: common_vendor.p({
  123. status: refresherStatus
  124. }),
  125. c: i0,
  126. d: s0
  127. };
  128. }, {
  129. name: "refresher",
  130. path: "d",
  131. vueId: "1a976688-0"
  132. }),
  133. e: common_vendor.sr(paging, "1a976688-0", {
  134. "k": "paging"
  135. }),
  136. f: common_vendor.o(onRefresh),
  137. g: common_vendor.o(onScroll),
  138. h: common_vendor.o(onQuery),
  139. i: common_vendor.o(($event) => tableData.value = $event),
  140. j: common_vendor.p({
  141. refresherEnabled: __props.refresherEnabled,
  142. refresherOnly: __props.refresheronly,
  143. modelValue: tableData.value
  144. })
  145. });
  146. };
  147. }
  148. };
  149. wx.createComponent(_sfc_main);