Index.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <div id="app-demo-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. export default {
  29. data() {
  30. return {
  31. views: [
  32. {
  33. type: 'web',
  34. content: 'https://www.baidu.com/'
  35. },
  36. {
  37. type: 'html',
  38. content: '/asset/view_example.html'
  39. },
  40. ],
  41. };
  42. },
  43. methods: {
  44. loadViewContent (index) {
  45. const self = this;
  46. self.$ipcCallMain('example.loadViewContent', this.views[index]).then(r => {
  47. console.log(r);
  48. })
  49. },
  50. removeViewContent (index) {
  51. const self = this;
  52. self.$ipcCallMain('example.removeViewContent', self.views[index]).then(r => {
  53. console.log(r);
  54. })
  55. },
  56. }
  57. };
  58. </script>
  59. <style lang="less" scoped>
  60. #app-demo-window-view {
  61. padding: 0px 10px;
  62. text-align: left;
  63. width: 100%;
  64. .one-block-1 {
  65. font-size: 16px;
  66. padding-top: 10px;
  67. }
  68. .one-block-2 {
  69. padding-top: 10px;
  70. }
  71. }
  72. </style>