Page.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <div class="app-page">
  3. <h2 @click="click">
  4. 页面{{ pageId }}
  5. </h2>
  6. <p>你在 <strong class="text-strong">{{ pageTime }}</strong> 秒前打开本页面</p>
  7. <h3>页签操作</h3>
  8. <p>
  9. <a
  10. class="demo-btn"
  11. @click="$routerTab.refresh()"
  12. >刷新当前页面</a>
  13. <a
  14. class="demo-btn"
  15. @click="$routerTab.close()"
  16. >关闭当前页面</a>
  17. </p>
  18. <p>
  19. <router-link
  20. class="demo-btn"
  21. :to="'../page/'+ nextId"
  22. >
  23. 打开“页面{{ nextId }}”
  24. </router-link>
  25. </p>
  26. <p v-if="prevId > 0">
  27. <router-link
  28. class="demo-btn"
  29. :to="'../page/'+ prevId"
  30. >
  31. 打开“页面{{ prevId }}”
  32. </router-link>
  33. <router-link
  34. class="demo-btn"
  35. :to="'../page/'+ prevId"
  36. @click.native="$routerTab.refresh('../page/'+ prevId)"
  37. >
  38. 全新打开“页面{{ prevId }}”
  39. </router-link>
  40. </p>
  41. <p>
  42. <a
  43. class="demo-btn"
  44. @click="$router.push('../tab-dynamic')"
  45. >打开“动态更新页签”</a>
  46. <a
  47. class="demo-btn"
  48. @click="$routerTab.close('../tab-dynamic')"
  49. >关闭“动态更新页签”</a>
  50. </p>
  51. <h4>iframe 页签</h4>
  52. <p>
  53. <a
  54. class="demo-btn"
  55. @click="$routerTab.openIframeTab('https://www.baidu.com', '百度')"
  56. >打开“百度”</a>
  57. <a
  58. class="demo-btn"
  59. @click="$routerTab.refreshIframeTab('https://www.baidu.com')"
  60. >刷新“百度”</a>
  61. <a
  62. class="demo-btn"
  63. @click="$routerTab.closeIframeTab('https://www.baidu.com')"
  64. >关闭“百度”</a>
  65. </p>
  66. <p>
  67. <a
  68. class="demo-btn"
  69. @click="$routerTab.openIframeTab('https://map.baidu.com/', '百度地图', 'rt-icon-web')"
  70. >打开“百度地图”</a>
  71. <a
  72. class="demo-btn"
  73. @click="$routerTab.refreshIframeTab('https://map.baidu.com/')"
  74. >刷新“百度地图”</a>
  75. <a
  76. class="demo-btn"
  77. @click="$routerTab.closeIframeTab('https://map.baidu.com/')"
  78. >关闭“百度地图”</a>
  79. </p>
  80. <div>
  81. <input type="text">
  82. </div>
  83. <h3>路由信息</h3>
  84. <page-route-info />
  85. </div>
  86. </template>
  87. <script>
  88. import pageTimer from '../mixins/pageTimer'
  89. import PageRouteInfo from '../components/PageRouteInfo'
  90. export default {
  91. name: 'Page',
  92. components: { PageRouteInfo },
  93. mixins: [ pageTimer ],
  94. data () {
  95. let id = this.$route.params.id
  96. return {
  97. pageId: id,
  98. nextId: +id + 1,
  99. prevId: +id - 1,
  100. routeTab: {
  101. title: '页面' + id
  102. }
  103. }
  104. },
  105. methods: {
  106. click () {
  107. console.log(`页面${this.pageId}`)
  108. }
  109. }
  110. }
  111. </script>