iframeRoute.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <el-page-header>
  3. <template #breadcrumb>
  4. <el-breadcrumb separator="/">
  5. <el-breadcrumb-item :to="{ path: '/' }">
  6. 首页
  7. </el-breadcrumb-item>
  8. <el-breadcrumb-item :to="{ path: `/details/${params.title}` }">{{ params.title }}</el-breadcrumb-item>
  9. <el-breadcrumb-item>{{ params.id }}</el-breadcrumb-item>
  10. </el-breadcrumb>
  11. </template>
  12. <div class="iframDiv">
  13. <iframe :src="iframeSrc" frameborder="0"></iframe>
  14. </div>
  15. </el-page-header>
  16. </template>
  17. <script setup>
  18. import { ref, onMounted } from 'vue';
  19. import { useRoute } from 'vue-router'; //1.先在需要跳转的页面引入useRouter
  20. import main from './main.vue';
  21. const { query, params } = useRoute()
  22. const iframeList = [
  23. {
  24. label: "情绪识别",
  25. src: "//ai-demos.cocorobo.cn/labs/emotion-recognition/"
  26. },{
  27. label: "物体识别",
  28. src: "//ai-demos.cocorobo.cn/object-detection/index.html"
  29. },{
  30. label: "语音识别",
  31. src: "//ai-demos.cocorobo.cn/labs/speech-recognition/"
  32. },{
  33. label: "图形化",
  34. src: "//pi.cocorobo.cn/?lang=zh-hans"
  35. },{
  36. label: "Python",
  37. src: "//pi.cocorobo.cn/python/?lang=zh-hans"
  38. },{
  39. label: "课程管理",
  40. src: "//ai-demos.cocorobo.cn/labs/emotion-recognition/"
  41. },{
  42. label: "课程中心",
  43. src: "//ai-demos.cocorobo.cn/labs/emotion-recognition/"
  44. },{
  45. label: "学生评价",
  46. src: "//ai-demos.cocorobo.cn/labs/emotion-recognition/"
  47. },
  48. ]
  49. const iframeSrc = ref('')
  50. onMounted(()=>{
  51. iframeSrc.value = iframeList.find(x=>x.label == params.id).src
  52. })
  53. </script>
  54. <style lang="scss">
  55. .el-page-header {
  56. padding: 20px 10%;
  57. background: #F0F2F5;
  58. height: calc(100% - 60px);
  59. .el-page-header__header {
  60. display: none;
  61. }
  62. .el-page-header__main {
  63. width: 100%;
  64. height: calc(100% - 30px);
  65. .iframDiv {
  66. width: 100%;
  67. height: 100%;
  68. iframe {
  69. width: 100%;
  70. height: 100%;
  71. }
  72. }
  73. }
  74. }
  75. </style>