Index.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <div id="app-base-window">
  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="createWindow(0)">打开哔哩哔哩</a-button>
  11. </a-space>
  12. </div>
  13. <div class="one-block-1">
  14. <span>
  15. 2. 新窗口中加载html内容
  16. </span>
  17. </div>
  18. <div class="one-block-2">
  19. <a-space>
  20. <a-button @click="createWindow(1)">打开html页面</a-button>
  21. </a-space>
  22. </div>
  23. </div>
  24. </template>
  25. <script>
  26. import { ipcApiRoute } from '@/api/main'
  27. export default {
  28. data() {
  29. return {
  30. views: [
  31. {
  32. type: 'web',
  33. content: 'https://www.bilibili.com/'
  34. },
  35. {
  36. type: 'html',
  37. content: '/public/html/view_example.html'
  38. },
  39. ],
  40. };
  41. },
  42. methods: {
  43. createWindow (index) {
  44. this.$ipcCall(ipcApiRoute.createWindow, this.views[index]).then(r => {
  45. console.log(r);
  46. })
  47. },
  48. }
  49. };
  50. </script>
  51. <style lang="less" scoped>
  52. #app-base-window {
  53. padding: 0px 10px;
  54. text-align: left;
  55. width: 100%;
  56. .one-block-1 {
  57. font-size: 16px;
  58. padding-top: 10px;
  59. }
  60. .one-block-2 {
  61. padding-top: 10px;
  62. }
  63. }
  64. </style>