mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 19:35:50 +00:00
perf: 优化访问链接
This commit is contained in:
parent
d4697cb203
commit
dcf96e2bf5
@ -471,7 +471,7 @@ class IndexController extends InvokeController
|
|||||||
action: "eeuiAppSendMessage",
|
action: "eeuiAppSendMessage",
|
||||||
data: [
|
data: [
|
||||||
{
|
{
|
||||||
action: 'setPageData',
|
action: 'setPageData', // 设置页面数据
|
||||||
data: {
|
data: {
|
||||||
showProgress: true,
|
showProgress: true,
|
||||||
titleFixed: true,
|
titleFixed: true,
|
||||||
@ -479,7 +479,7 @@ class IndexController extends InvokeController
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
action: 'createTarget',
|
action: 'createTarget', // 创建目标(访问新地址)
|
||||||
url: "{$redirectUrl}",
|
url: "{$redirectUrl}",
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
23
electron/electron.js
vendored
23
electron/electron.js
vendored
@ -442,11 +442,16 @@ function createChildWindow(args) {
|
|||||||
// 加载地址
|
// 加载地址
|
||||||
const hash = `${args.hash || args.path}`;
|
const hash = `${args.hash || args.path}`;
|
||||||
if (/^https?:/i.test(hash)) {
|
if (/^https?:/i.test(hash)) {
|
||||||
browser.loadURL(hash).then(_ => { }).catch(_ => { })
|
browser.loadURL(hash)
|
||||||
|
.then(_ => { })
|
||||||
|
.catch(_ => { })
|
||||||
} else if (isPreload) {
|
} else if (isPreload) {
|
||||||
browser.webContents.executeJavaScript(`if(typeof window.__initializeApp === 'function'){window.__initializeApp('${hash}')}else{throw new Error('no function')}`, true).catch(() => {
|
browser
|
||||||
utils.loadUrlOrFile(browser, devloadUrl, hash)
|
.webContents
|
||||||
});
|
.executeJavaScript(`if(typeof window.__initializeApp === 'function'){window.__initializeApp('${hash}')}else{throw new Error('no function')}`, true)
|
||||||
|
.catch(() => {
|
||||||
|
utils.loadUrlOrFile(browser, devloadUrl, hash)
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
utils.loadUrlOrFile(browser, devloadUrl, hash)
|
utils.loadUrlOrFile(browser, devloadUrl, hash)
|
||||||
}
|
}
|
||||||
@ -567,10 +572,6 @@ function createWebTabWindow(args) {
|
|||||||
args = {url: args}
|
args = {url: args}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!allowedUrls.test(args.url)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建父级窗口
|
// 创建父级窗口
|
||||||
if (!webTabWindow) {
|
if (!webTabWindow) {
|
||||||
const titleBarOverlay = {
|
const titleBarOverlay = {
|
||||||
@ -602,6 +603,12 @@ function createWebTabWindow(args) {
|
|||||||
},
|
},
|
||||||
}, userConf.get('webTabWindow', {})))
|
}, userConf.get('webTabWindow', {})))
|
||||||
|
|
||||||
|
const originalClose = webTabWindow.close;
|
||||||
|
webTabWindow.close = function() {
|
||||||
|
webTabClosedByShortcut = true;
|
||||||
|
return originalClose.apply(this, arguments);
|
||||||
|
};
|
||||||
|
|
||||||
webTabWindow.on('resize', () => {
|
webTabWindow.on('resize', () => {
|
||||||
resizeWebTab(0)
|
resizeWebTab(0)
|
||||||
})
|
})
|
||||||
|
|||||||
17
electron/render/tabs/assets/css/style.css
vendored
17
electron/render/tabs/assets/css/style.css
vendored
@ -23,11 +23,17 @@ html, body {
|
|||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.app {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
.nav {
|
.nav {
|
||||||
font-family: var(--tab-font-family);
|
font-family: var(--tab-font-family);
|
||||||
font-feature-settings: 'clig', 'kern';
|
font-feature-settings: 'clig', 'kern';
|
||||||
|
flex: 1;
|
||||||
|
width: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
|
||||||
cursor: default;
|
cursor: default;
|
||||||
background-color: var(--tab-background);
|
background-color: var(--tab-background);
|
||||||
-webkit-app-region: drag;
|
-webkit-app-region: drag;
|
||||||
@ -36,7 +42,7 @@ html, body {
|
|||||||
.nav ul {
|
.nav ul {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 35px;
|
height: 35px;
|
||||||
margin: 5px 46px 0 0;
|
margin-top: 5px;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
overflow-y: hidden;
|
overflow-y: hidden;
|
||||||
@ -96,14 +102,13 @@ html, body {
|
|||||||
|
|
||||||
/* 浏览器打开 */
|
/* 浏览器打开 */
|
||||||
.browser {
|
.browser {
|
||||||
position: absolute;
|
flex-shrink: 0;
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 38px;
|
height: 40px;
|
||||||
padding: 0 14px;
|
padding: 0 14px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
background-color: var(--tab-background);
|
||||||
-webkit-app-region: none;
|
-webkit-app-region: none;
|
||||||
}
|
}
|
||||||
.browser span {
|
.browser span {
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="tabs.length > 0" class="browser" @click="onBrowser">
|
<div v-if="canBrowser" class="browser" @click="onBrowser">
|
||||||
<span></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -119,15 +119,23 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
activeItem() {
|
||||||
|
if (this.tabs.length === 0) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return this.tabs.find(item => item.id === this.activeId)
|
||||||
|
},
|
||||||
pageTitle() {
|
pageTitle() {
|
||||||
const activeItem = this.tabs.find(item => item.id === this.activeId)
|
return this.activeItem ? this.activeItem.title : 'Untitled'
|
||||||
return activeItem ? activeItem.title : 'Untitled'
|
},
|
||||||
|
canBrowser() {
|
||||||
|
return !(this.activeItem && /^file:/.test(this.activeItem.url))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
pageTitle(title) {
|
pageTitle(title) {
|
||||||
document.title = title;
|
document.title = title;
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onSwitch(item) {
|
onSwitch(item) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user