@@ -4,7 +4,8 @@ import { useStore } from 'vuex';
44import { useRouter } from ' vue-router' ;
55import AppService from ' @/service/AppService' ;
66import { WebviewWindow } from ' @tauri-apps/api/webviewWindow'
7-
7+ import { Webview } from ' @tauri-apps/api/webview'
8+ import { getCurrent } from ' @tauri-apps/api/window'
89const router = useRouter ();
910const store = useStore ();
1011const appService = new AppService ();
@@ -23,6 +24,9 @@ const pages = computed(()=>{
2324 return _pages> 0 ? new Array (_pages): [];
2425});
2526const appPageSize = 8 ;
27+ const platform = computed (() => {
28+ return store .getters [' account/platform' ]
29+ });
2630const openWebview = (app )=> {
2731 store .commit (' webview/setTarget' , {
2832 icon: app .icon ,
@@ -43,17 +47,34 @@ const openWebview = (app)=>{
4347 options .url = " http://" + (app? .port ? .listen ? .ip || ' 127.0.0.1' )+ ' :' + app? .port ? .listen ? .port ;;
4448 delete options .proxyUrl ;
4549 }
46- const webview = new WebviewWindow (` ${ app .name } -webview` , options);
47- webview .once (' tauri://created' , function (d ) {
48- console .log (' tauri://created' )
49- console .log (d)
50- // webview successfully created
51- });
52- webview .once (' tauri://error' , function (e ) {
53- console .log (' tauri://error' )
54- console .log (e)
55- // an error happened creating the webview
56- });
50+ if (platform .value == ' android' ){
51+ options .x = 0 ;
52+ options .y = 0 ;
53+ options .height = 800 ;
54+ const webview = new Webview (getCurrent (),` ${ app .name } -webview` , options);
55+ webview .once (' tauri://created' , function (d ) {
56+ console .log (' tauri://created' )
57+ console .log (d)
58+ // webview successfully created
59+ });
60+ webview .once (' tauri://error' , function (e ) {
61+ console .log (' tauri://error' )
62+ console .log (e)
63+ // an error happened creating the webview
64+ });
65+ } else {
66+ const webview = new WebviewWindow (` ${ app .name } -webview` , options);
67+ webview .once (' tauri://created' , function (d ) {
68+ console .log (' tauri://created' )
69+ console .log (d)
70+ // webview successfully created
71+ });
72+ webview .once (' tauri://error' , function (e ) {
73+ console .log (' tauri://error' )
74+ console .log (e)
75+ // an error happened creating the webview
76+ });
77+ }
5778 }catch (e){
5879 console .log (e)
5980 }
@@ -93,9 +114,9 @@ const appPage = computed(()=>(page)=>{
93114 < template #item= " slotProps" >
94115 < div class = " pt-1" style= " min-height: 220px;" >
95116 < div class = " grid text-center" >
96- < div @click= " openWebview(app)" class = " col-3 py-4 relative" v- for = " (app) in appPage(slotProps.index)" >
117+ < div @click= " openWebview(app)" class = " col-3 py-4 relative text-center " v- for = " (app) in appPage(slotProps.index)" >
97118 < i @click .stop = " removeApp(app)" v- show= " manage" class = " pi pi-times bg-primary-500 absolute pointer text-white-alpha-60 " style= " width:16px;height: 16px;line-height: 16px;;border-radius: 50%; right: 16px;top: 12px;" / >
98- < img : src= " app.icon" class = " pointer" width= " 40" height= " 40" style= " border-radius: 4px; overflow: hidden;" / >
119+ < img : src= " app.icon" class = " pointer" width= " 40" height= " 40" style= " border-radius: 4px; overflow: hidden;margin: auto; " / >
99120 < div class = " mt-1" >
100121 < b class = " text-white opacity-90" > {{app .name }}< / b>
101122 < / div>
0 commit comments