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