Index.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <div id="app-base-window-view">
  3. <div class="one-block-1">
  4. <span>
  5. 1. 嵌入web内容
  6. </span>
  7. </div>
  8. <div class="one-block-2">
  9. <a-space>
  10. <a-button @click="loadViewContent(0)">加载百度页面</a-button>
  11. <a-button @click="removeViewContent(0)">移除百度页面</a-button>
  12. </a-space>
  13. </div>
  14. <div class="one-block-1">
  15. <span>
  16. 2. 嵌入html内容
  17. </span>
  18. </div>
  19. <div class="one-block-2">
  20. <a-space>
  21. <a-button @click="loadViewContent(1)">加载html页面</a-button>
  22. <a-button @click="removeViewContent(1)">移除html页面</a-button>
  23. </a-space>
  24. </div>
  25. </div>
  26. </template>
  27. <script>
  28. import { ipcApiRoute } from '@/api/main'
  29. export default {
  30. data() {
  31. return {
  32. views: [
  33. {
  34. type: 'web',
  35. content: 'https://www.baidu.com/'
  36. },
  37. {
  38. type: 'html',
  39. content: '/public/html/view_example.html'
  40. },
  41. ],
  42. };
  43. },
  44. methods: {
  45. loadViewContent (index) {
  46. this.$ipc.invoke(ipcApiRoute.loadViewContent, this.views[index]).then(r => {
  47. console.log(r);
  48. })
  49. },
  50. removeViewContent (index) {
  51. this.$ipc.invoke(ipcApiRoute.removeViewContent, self.views[index]).then(r => {
  52. console.log(r);
  53. })
  54. },
  55. }
  56. };
  57. </script>
  58. <style lang="less" scoped>
  59. #app-base-window-view {
  60. padding: 0px 10px;
  61. text-align: left;
  62. width: 100%;
  63. .one-block-1 {
  64. font-size: 16px;
  65. padding-top: 10px;
  66. }
  67. .one-block-2 {
  68. padding-top: 10px;
  69. }
  70. }
  71. </style>