Index.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <div id="AppDetail" :class="{ app: true, block: type === 1 }">
  3. <div class="sk" v-if="loda">
  4. <van-skeleton title :row="15" />
  5. </div>
  6. <component
  7. v-if="id"
  8. :is="detailData.videoFlag"
  9. :item="detailData"
  10. :id="id"
  11. ></component>
  12. </div>
  13. </template>
  14. <script>
  15. import A from "@/components/Detail/news.vue";
  16. import V from "@/components/Detail/video.vue";
  17. import U from "@/components/Detail/audio.vue";
  18. import { Skeleton as vanSkeleton } from "vant";
  19. import "vant/lib/skeleton/style";
  20. import { currentUrlToParams, setToken } from "@/utils/common.js";
  21. import { articleDetail } from "@/api/article/article.js";
  22. export default {
  23. name: "app",
  24. data: function() {
  25. return {
  26. loda: true,
  27. detailData: {},
  28. id: undefined,
  29. type: undefined
  30. };
  31. },
  32. methods: {},
  33. mounted() {
  34. this.$pageParams = currentUrlToParams();
  35. this.type = this.$pageParams.pattern - 0;
  36. this.$pageParams.token && setToken(this.$pageParams.token);
  37. window.Progress = function() {
  38. return this.progress + "";
  39. };
  40. articleDetail(this.$pageParams.id, true).then(res => {
  41. this.detailData = res || {};
  42. this.loda = false;
  43. this.id = this.$pageParams.id;
  44. });
  45. },
  46. beforeDestroy: function() {},
  47. components: { A, V, U, vanSkeleton }
  48. };
  49. </script>
  50. <style lang="scss">
  51. html,
  52. body {
  53. height: auto !important;
  54. overflow: auto !important;
  55. }
  56. #AppDetail {
  57. .sk {
  58. padding: 2em 0;
  59. }
  60. }
  61. </style>