articleDetail.js 723 B

12345678910111213141516171819202122232425262728293031323334353637
  1. export default {
  2. data() {
  3. return {
  4. articleId: '',
  5. articleInfo: {},
  6. imageList: [],
  7. }
  8. },
  9. computed: {
  10. html() {
  11. const html = this.articleInfo.articleContent
  12. if (html) {
  13. return html.replace(/href=/gi, '')
  14. }
  15. return ''
  16. },
  17. },
  18. mounted() {
  19. this.initData()
  20. },
  21. methods: {
  22. initData() {
  23. this.articleId = parseInt(this.$route.query.articleId)
  24. this.fetchArticleDetail()
  25. },
  26. async fetchArticleDetail() {
  27. try {
  28. const res = await this.$http.api.getArticleDetail({
  29. articleId: this.articleId,
  30. })
  31. this.articleInfo = res.data
  32. } catch (error) {
  33. console.log(error)
  34. }
  35. },
  36. },
  37. }