article.vue 931 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <template>
  2. <!-- 此文件路径禁止移动 -->
  3. <view>
  4. <view class="container ">
  5. <view class="u-skeleton" v-if="!articleData">
  6. <u-empty text="文章暂无内容" mode="list"></u-empty>
  7. </view>
  8. <!-- <h3>{{routers.title}}</h3> -->
  9. <u-parse v-else :html="articleData"></u-parse>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. import { getArticleDetail } from "@/api/article.js";
  15. export default {
  16. data() {
  17. return {
  18. loading: true,
  19. routers: "",
  20. articleData: "",
  21. };
  22. },
  23. onLoad(val) {
  24. this.routers = val;
  25. getArticleDetail(val.id).then((res) => {
  26. if (res.data.result) {
  27. this.articleData = res.data.result.content;
  28. }
  29. uni.setNavigationBarTitle({
  30. title: val.title,
  31. });
  32. });
  33. },
  34. };
  35. </script>
  36. <style lang="scss" scoped>
  37. page {
  38. background: #fff;
  39. }
  40. .container {
  41. padding: 32rpx;
  42. > p {
  43. margin: 20rpx;
  44. }
  45. }
  46. </style>