index.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <div style="height: 100vh;padding-bottom: 50px">
  3. <router-view class="basePage" v-if="douyin || kuaishou" :key="routerKey" />
  4. <van-tabbar v-model="active" @change="onChange">
  5. <van-tabbar-item v-if="douyin">抖音</van-tabbar-item>
  6. <van-tabbar-item v-if="kuaishou">快手</van-tabbar-item>
  7. </van-tabbar>
  8. </div>
  9. </template>
  10. <script>
  11. import { Tabbar as vanTabbar, TabbarItem as vanTabbarItem } from "vant";
  12. import "vant/lib/tabbar/style";
  13. import "vant/lib/tabbar-item/style";
  14. export default {
  15. name: "App",
  16. components: {
  17. vanTabbar,
  18. vanTabbarItem,
  19. },
  20. data() {
  21. return {
  22. routerData: {},
  23. tablist: [],
  24. active: 0,
  25. douyin: false,
  26. kuaishou: false,
  27. };
  28. },
  29. computed: {
  30. routerKey() {
  31. let date = new Date();
  32. return this.routerData.path + date.getTime();
  33. },
  34. },
  35. mounted() {
  36. let q = this.$route.query || {};
  37. q.douyin === "true" ? (this.douyin = true) : (this.douyin = false);
  38. q.kuaishou === "true" ? (this.kuaishou = true) : (this.kuaishou = false);
  39. if (!this.douyin && !this.kuaishou) return;
  40. this.douyin && this.tablist.push("douyin");
  41. this.kuaishou && this.tablist.push("kuaishou");
  42. let path = "";
  43. if (q.douyin === "true") path = "/live/douyin";
  44. else if (q.kuaishou === "true") path = "/live/kuaishou";
  45. if (path == "/live/kuaishou")
  46. this.$router.push({
  47. path,
  48. query: {
  49. id: q.id,
  50. title: q.title,
  51. platform:
  52. q.douyin === "true"
  53. ? "douyin"
  54. : q.kuaishou === "true"
  55. ? "kuaishou"
  56. : "",
  57. kuaishou: q.kuaishou,
  58. douyin: q.douyin,
  59. },
  60. });
  61. },
  62. created() {},
  63. methods: {
  64. onChange(res) {
  65. let q = this.$route.query;
  66. this.$router.push({
  67. path: "/live/"+ this.tablist[res || 0],
  68. query: {
  69. id: q.id,
  70. title: q.title,
  71. platform: this.tablist[res || 0],
  72. kuaishou: q.kuaishou,
  73. douyin: q.douyin,
  74. },
  75. });
  76. },
  77. },
  78. };
  79. </script>
  80. <style lang="sass" scoped></style>