Index.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. const self = this;
  47. self.$ipcInvoke(ipcApiRoute.loadViewContent, this.views[index]).then(r => {
  48. console.log(r);
  49. })
  50. },
  51. removeViewContent (index) {
  52. const self = this;
  53. self.$ipcInvoke(ipcApiRoute.removeViewContent, self.views[index]).then(r => {
  54. console.log(r);
  55. })
  56. },
  57. }
  58. };
  59. </script>
  60. <style lang="less" scoped>
  61. #app-base-window-view {
  62. padding: 0px 10px;
  63. text-align: left;
  64. width: 100%;
  65. .one-block-1 {
  66. font-size: 16px;
  67. padding-top: 10px;
  68. }
  69. .one-block-2 {
  70. padding-top: 10px;
  71. }
  72. }
  73. </style>