Skip to content

Commit 1c11cb5

Browse files
committed
update
1 parent d70dc74 commit 1c11cb5

File tree

2 files changed

+36
-15
lines changed

2 files changed

+36
-15
lines changed

gui/src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ tauri-build = { version = "2.0.0-beta", features = [] }
1717
# tauri = { version = "2.0.0-beta", features = ["devtools"] }
1818
[dependencies]
1919
fix-path-env = { git = "https://github.com/tauri-apps/fix-path-env-rs" }
20-
tauri = { version = "=2.0.0-beta.22", features = ["macos-proxy"] }
20+
tauri = { version = "=2.0.0-beta.22", features = ["macos-proxy", "unstable"] }
2121
tauri-utils = "=2.0.0-beta.17"
2222
tauri-plugin-shell = "=2.0.0-beta.5"
2323
serde = { version = "1", features = ["derive"] }

gui/src/layout/Apps.vue

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { useStore } from 'vuex';
44
import { useRouter } from 'vue-router';
55
import AppService from '@/service/AppService';
66
import { WebviewWindow } from '@tauri-apps/api/webviewWindow'
7-
7+
import { Webview } from '@tauri-apps/api/webview'
8+
import { getCurrent } from '@tauri-apps/api/window'
89
const router = useRouter();
910
const store = useStore();
1011
const appService = new AppService();
@@ -23,6 +24,9 @@ const pages = computed(()=>{
2324
return _pages>0?new Array(_pages):[];
2425
});
2526
const appPageSize = 8;
27+
const platform = computed(() => {
28+
return store.getters['account/platform']
29+
});
2630
const 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

Comments
 (0)