From 7a5a541a4ed2ecd607b9e4545bcd192bcf381f17 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 3 Nov 2020 10:06:19 +0900 Subject: [PATCH] =?UTF-8?q?=E7=9B=B8=E5=AF=BE=E3=83=91=E3=82=B9=E3=81=A7?= =?UTF-8?q?=E3=82=B3=E3=83=94=E3=83=BC=E3=81=95=E3=82=8C=E3=82=8B=E3=81=AE?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/components/page-window.vue | 29 +++++++++++-------- src/client/os.ts | 6 ++-- src/client/pages/messaging/messaging-room.vue | 6 ++-- src/client/ui/default.side.vue | 29 ++++++++++++------- src/client/ui/default.vue | 8 ++--- 5 files changed, 45 insertions(+), 33 deletions(-) diff --git a/src/client/components/page-window.vue b/src/client/components/page-window.vue index 67f54ac15..1cdfb8f00 100644 --- a/src/client/components/page-window.vue +++ b/src/client/components/page-window.vue @@ -28,6 +28,7 @@ import XHeader from '@/ui/_common_/header.vue'; import { popout } from '@/scripts/popout'; import copyToClipboard from '@/scripts/copy-to-clipboard'; import { resolve } from '@/router'; +import { url } from '@/config'; export default defineComponent({ components: { @@ -43,14 +44,14 @@ export default defineComponent({ provide() { return { - navHook: (url) => { - this.navigate(url); + navHook: (path) => { + this.navigate(path); } }; }, props: { - initialUrl: { + initialPath: { type: String, required: true, }, @@ -70,7 +71,7 @@ export default defineComponent({ data() { return { pageInfo: null, - url: this.initialUrl, + path: this.initialPath, component: this.initialComponent, props: this.initialProps, history: [], @@ -79,10 +80,14 @@ export default defineComponent({ }, computed: { + url(): string { + return url + this.path; + }, + contextmenu() { return [{ type: 'label', - text: this.url, + text: this.path, }, { icon: faExpandAlt, text: this.$t('showInPage'), @@ -91,7 +96,7 @@ export default defineComponent({ icon: faColumns, text: this.$t('openInSideView'), action: () => { - this.sideViewHook(this.url); + this.sideViewHook(this.path); this.$refs.window.close(); } } : undefined, { @@ -123,10 +128,10 @@ export default defineComponent({ } }, - navigate(url, record = true) { - if (record) this.history.push(this.url); - this.url = url; - const { component, props } = resolve(url); + navigate(path, record = true) { + if (record) this.history.push(this.path); + this.path = path; + const { component, props } = resolve(path); this.component = component; this.props = props; }, @@ -136,12 +141,12 @@ export default defineComponent({ }, expand() { - this.$router.push(this.url); + this.$router.push(this.path); this.$refs.window.close(); }, popout() { - popout(this.url, this.$el); + popout(this.path, this.$el); this.$refs.window.close(); }, }, diff --git a/src/client/os.ts b/src/client/os.ts index 5f21cc39f..dc0eb7748 100644 --- a/src/client/os.ts +++ b/src/client/os.ts @@ -177,10 +177,10 @@ export function popup(component: Component | typeof import('*.vue'), props: Reco }; } -export function pageWindow(url: string) { - const { component, props } = resolve(url); +export function pageWindow(path: string) { + const { component, props } = resolve(path); popup(defineAsyncComponent(() => import('@/components/page-window.vue')), { - initialUrl: url, + initialPath: path, initialComponent: markRaw(component), initialProps: props, }, {}, 'closed'); diff --git a/src/client/pages/messaging/messaging-room.vue b/src/client/pages/messaging/messaging-room.vue index 4aca8bdab..73c8e2a6d 100644 --- a/src/client/pages/messaging/messaging-room.vue +++ b/src/client/pages/messaging/messaging-room.vue @@ -311,20 +311,20 @@ const Component = defineComponent({ }, menu(ev) { - const url = this.groupId ? `/my/messaging/group/${this.groupId}` : `/my/messaging/${this.userAcct}`; + const path = this.groupId ? `/my/messaging/group/${this.groupId}` : `/my/messaging/${this.userAcct}`; os.modalMenu([this.inWindow ? undefined : { text: this.$t('openInWindow'), icon: faWindowMaximize, action: () => { - os.pageWindow(url); + os.pageWindow(path); this.$router.back(); }, }, this.inWindow ? undefined : { text: this.$t('popout'), icon: faExternalLinkAlt, action: () => { - popout(url); + popout(path); this.$router.back(); }, }], ev.currentTarget || ev.target); diff --git a/src/client/ui/default.side.vue b/src/client/ui/default.side.vue index cff35f6ed..73f6cb92f 100644 --- a/src/client/ui/default.side.vue +++ b/src/client/ui/default.side.vue @@ -19,6 +19,7 @@ import XHeader from './_common_/header.vue'; import * as os from '@/os'; import copyToClipboard from '@/scripts/copy-to-clipboard'; import { resolve } from '@/router'; +import { url } from '@/config'; export default defineComponent({ components: { @@ -27,15 +28,15 @@ export default defineComponent({ provide() { return { - navHook: (url) => { - this.navigate(url); + navHook: (path) => { + this.navigate(path); } }; }, data() { return { - url: null, + path: null, component: null, props: {}, pageInfo: null, @@ -44,6 +45,12 @@ export default defineComponent({ }; }, + computed: { + url(): string { + return url + this.path; + } + }, + methods: { changePage(page) { if (page == null) return; @@ -52,10 +59,10 @@ export default defineComponent({ } }, - navigate(url, record = true) { - if (record && this.url) this.history.push(this.url); - this.url = url; - const { component, props } = resolve(url); + navigate(path, record = true) { + if (record && this.path) this.history.push(this.path); + this.path = path; + const { component, props } = resolve(path); this.component = component; this.props = props; }, @@ -65,7 +72,7 @@ export default defineComponent({ }, close() { - this.url = null; + this.path = null; this.component = null; this.props = {}; }, @@ -73,19 +80,19 @@ export default defineComponent({ onContextmenu(e) { os.contextMenu([{ type: 'label', - text: this.url, + text: this.path, }, { icon: faExpandAlt, text: this.$t('showInPage'), action: () => { - this.$router.push(this.url); + this.$router.push(this.path); this.close(); } }, { icon: faWindowMaximize, text: this.$t('openInWindow'), action: () => { - os.pageWindow(this.url); + os.pageWindow(this.path); this.close(); } }, null, { diff --git a/src/client/ui/default.vue b/src/client/ui/default.vue index 7127d8f12..626e5242c 100644 --- a/src/client/ui/default.vue +++ b/src/client/ui/default.vue @@ -216,21 +216,21 @@ export default defineComponent({ }, onContextmenu(e) { - const url = this.$route.path; + const path = this.$route.path; os.contextMenu([{ type: 'label', - text: url, + text: path, }, { icon: faColumns, text: this.$t('openInSideView'), action: () => { - this.$refs.side.navigate(url); + this.$refs.side.navigate(path); } }, { icon: faWindowMaximize, text: this.$t('openInWindow'), action: () => { - os.pageWindow(url); + os.pageWindow(path); } }], e); },