1
1
import { ref } from 'vue'
2
2
import { defineStore } from 'pinia'
3
- import { WindowSetSize , WindowSetTitle } from "../../wailsjs/runtime/runtime" ; // 根据实际文件路径进行修改
3
+ import * as systemFc from "../../wailsjs/runtime/runtime" ; // 根据实际文件路径进行修改
4
4
import { BindWindowEvent } from '@/win/event'
5
5
6
6
export const __load_data = defineStore ( 'window_data' , {
@@ -11,12 +11,12 @@ export const __load_data = defineStore('window_data', {
11
11
return data
12
12
} ,
13
13
actions : {
14
- init ( ) {
14
+ async init ( ) {
15
15
16
16
BindWindowEvent ( this , this . comps )
17
17
try {
18
18
if ( this . comps . Win . hasOwnProperty ( "event_created" ) ) {
19
- this . WinCreated ( )
19
+ await this . WinCreated ( )
20
20
}
21
21
} catch ( e ) {
22
22
console . log ( "WinCreated To be defined" )
@@ -31,18 +31,25 @@ export const __load_data = defineStore('window_data', {
31
31
if ( dthis . comps . Win . height . includes ( 'v' ) || dthis . comps . Win . height . includes ( '%' ) ) {
32
32
return ;
33
33
}
34
- WindowSetSize ( parseInt ( dthis . comps . Win . width ) , parseInt ( dthis . comps . Win . height ) )
34
+ systemFc . WindowSetSize ( parseInt ( dthis . comps . Win . width ) , parseInt ( dthis . comps . Win . height ) )
35
35
//Recalculate the width and height of the client area
36
36
setTimeout ( function ( ) {
37
37
var WidthFix = parseInt ( dthis . comps . Win . width ) - window . innerWidth
38
38
var HeightFix = parseInt ( dthis . comps . Win . height ) - window . innerHeight
39
- WindowSetSize ( parseInt ( dthis . comps . Win . width ) + WidthFix , parseInt ( dthis . comps . Win . height ) + HeightFix )
39
+ systemFc . WindowSetSize ( parseInt ( dthis . comps . Win . width ) + WidthFix , parseInt ( dthis . comps . Win . height ) + HeightFix )
40
40
document . body . style . overflow = 'auto'
41
41
} , 1 )
42
- WindowSetTitle ( dthis . comps . Win . text )
42
+ systemFc . WindowSetTitle ( dthis . comps . Win . text )
43
+ //Move to the center of the screen
44
+ systemFc . WindowCenter ( )
45
+ //Give the interface 200 milliseconds to load
46
+ setTimeout ( function ( ) {
47
+ systemFc . WindowShow ( )
48
+ } , 200 )
43
49
} catch ( e ) {
44
50
console . error ( "Error initializing win size" , e )
45
51
}
52
+
46
53
} ,
47
54
handleAllEvents ( el , e , item , callFuncName ) {
48
55
try {
0 commit comments