{"remainingRequest":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\artfess-module\\src\\views\\MdView.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\artfess-module\\src\\views\\MdView.vue","mtime":1675232038856},{"path":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["//\n//\n//\n//\n//\n\r\nimport utils from \"@/utils.js\";\r\n\r\nexport default {\r\n  name: \"MdView\",\r\n  props: {\r\n    content: String,\r\n    url: String,\r\n  },\r\n  data: function () {\r\n    return {\r\n      fileContent: null,\r\n    };\r\n  },\r\n  created: function () {\r\n    // 优先使用slot内容\r\n    if (this.$slots && Object.keys(this.$slots).length > 0) {\r\n      const slot = this.$slots.default\r\n        ? this.$slots.default\r\n        : this.$slots[Object.keys(this.$slots)[0]];\r\n      if (slot && slot.length > 0 && slot[0].text) {\r\n        // 因为md内容可能被格式化以后，每一行的开头有多个空格导致显示的格式错误，逐行去掉这些空格。\r\n        this.fileContent = utils.trimEachLine(slot[0].text);\r\n      }\r\n    } else if (this.content) {\r\n      // 其次，使用content属性\r\n      this.fileContent = this.content;\r\n    } else if (this.url) {\r\n      // 再次，通过url属性来加载内容\r\n      this.getContent();\r\n    } else {\r\n      this.fileContent = \"没有内容可以显示.\";\r\n    }\r\n  },\r\n  methods: {\r\n    getContent() {\r\n      this.fileContent = \"正在加载...\";\r\n      this.$http.get(this.url).then(\r\n        (response) => {\r\n          this.fileContent = response.body;\r\n        },\r\n        () => {\r\n          this.fileContent = \"内容加载失败.\";\r\n        }\r\n      );\r\n    },\r\n  },\r\n};\r\n",null]}