richtext.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. "use strict";
  2. const common_vendor = require("./common/vendor.js");
  3. const sheep_api_promotion_article = require("./sheep/api/promotion/article.js");
  4. if (!Array) {
  5. const _easycom_mp_html2 = common_vendor.resolveComponent("mp-html");
  6. const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  7. (_easycom_mp_html2 + _easycom_s_layout2)();
  8. }
  9. const _easycom_mp_html = () => "./uni_modules/mp-html/components/mp-html/mp-html.js";
  10. const _easycom_s_layout = () => "./sheep/components/s-layout/s-layout.js";
  11. if (!Math) {
  12. (_easycom_mp_html + _easycom_s_layout)();
  13. }
  14. const _sfc_main = {
  15. __name: "richtext",
  16. props: {
  17. title: {
  18. defautls: "",
  19. type: String
  20. },
  21. type: {
  22. defautls: "",
  23. type: String
  24. }
  25. },
  26. setup(__props) {
  27. const state = common_vendor.reactive({
  28. title: "",
  29. content: ""
  30. });
  31. async function getRichTextContent(id, title) {
  32. const { code, data } = await sheep_api_promotion_article.ArticleApi.getArticle(id, title);
  33. if (code !== 0) {
  34. return;
  35. }
  36. state.content = data.content;
  37. if (state.title !== data.title) {
  38. state.title = data.title;
  39. common_vendor.index.setNavigationBarTitle({
  40. title: state.title
  41. });
  42. }
  43. }
  44. const props = __props;
  45. common_vendor.onLoad((options) => {
  46. if (options.title || props.title) {
  47. state.title = options.title || props.title;
  48. common_vendor.index.setNavigationBarTitle({
  49. title: state.title || props.title
  50. });
  51. }
  52. getRichTextContent(options.id, options.title || props.title);
  53. });
  54. return (_ctx, _cache) => {
  55. return common_vendor.e({
  56. a: state.title && !__props.type
  57. }, state.title && !__props.type ? {
  58. b: common_vendor.p({
  59. content: state.content
  60. }),
  61. c: common_vendor.p({
  62. title: state.title,
  63. bgStyle: {
  64. color: "#FFF"
  65. }
  66. })
  67. } : {
  68. d: common_vendor.p({
  69. content: state.content
  70. })
  71. });
  72. };
  73. }
  74. };
  75. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-bc551482"], ["__file", "D:/zx/mall-front-app/pages/public/richtext.vue"]]);
  76. exports.MiniProgramPage = MiniProgramPage;