2020-10-25 01:21:41 +09:00
|
|
|
<template>
|
2021-11-19 19:36:12 +09:00
|
|
|
<div v-if="component" class="qvzfzxam _narrow_">
|
2020-10-25 01:21:41 +09:00
|
|
|
<div class="container">
|
|
|
|
<header class="header" @contextmenu.prevent.stop="onContextmenu">
|
2021-11-19 19:36:12 +09:00
|
|
|
<button v-if="history.length > 0" class="_button" @click="back()"><i class="fas fa-chevron-left"></i></button>
|
|
|
|
<button v-else class="_button" style="pointer-events: none;"><!-- マージンのバランスを取るためのダミー --></button>
|
2021-10-08 22:03:06 +09:00
|
|
|
<span class="title">{{ pageInfo.title }}</span>
|
2021-04-20 23:22:59 +09:00
|
|
|
<button class="_button" @click="close()"><i class="fas fa-times"></i></button>
|
2020-10-25 01:21:41 +09:00
|
|
|
</header>
|
2021-10-09 12:33:08 +09:00
|
|
|
<MkHeader class="pageHeader" :info="pageInfo"/>
|
2020-10-25 01:21:41 +09:00
|
|
|
<component :is="component" v-bind="props" :ref="changePage"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { defineComponent } from 'vue';
|
2021-11-12 02:02:25 +09:00
|
|
|
import * as os from '@/os';
|
|
|
|
import copyToClipboard from '@/scripts/copy-to-clipboard';
|
|
|
|
import { resolve } from '@/router';
|
|
|
|
import { url } from '@/config';
|
|
|
|
import * as symbols from '@/symbols';
|
2020-10-25 01:21:41 +09:00
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
provide() {
|
|
|
|
return {
|
2020-11-03 10:06:19 +09:00
|
|
|
navHook: (path) => {
|
|
|
|
this.navigate(path);
|
2020-10-25 01:21:41 +09:00
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2020-11-03 10:06:19 +09:00
|
|
|
path: null,
|
2020-10-25 01:21:41 +09:00
|
|
|
component: null,
|
|
|
|
props: {},
|
|
|
|
pageInfo: null,
|
|
|
|
history: [],
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2020-11-03 10:06:19 +09:00
|
|
|
computed: {
|
|
|
|
url(): string {
|
|
|
|
return url + this.path;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-10-25 01:21:41 +09:00
|
|
|
methods: {
|
|
|
|
changePage(page) {
|
|
|
|
if (page == null) return;
|
2021-04-10 12:54:12 +09:00
|
|
|
if (page[symbols.PAGE_INFO]) {
|
|
|
|
this.pageInfo = page[symbols.PAGE_INFO];
|
2020-10-25 01:21:41 +09:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-11-03 10:06:19 +09:00
|
|
|
navigate(path, record = true) {
|
|
|
|
if (record && this.path) this.history.push(this.path);
|
|
|
|
this.path = path;
|
|
|
|
const { component, props } = resolve(path);
|
2020-10-25 01:21:41 +09:00
|
|
|
this.component = component;
|
|
|
|
this.props = props;
|
|
|
|
},
|
|
|
|
|
|
|
|
back() {
|
|
|
|
this.navigate(this.history.pop(), false);
|
|
|
|
},
|
|
|
|
|
|
|
|
close() {
|
2020-11-03 10:06:19 +09:00
|
|
|
this.path = null;
|
2020-10-25 01:21:41 +09:00
|
|
|
this.component = null;
|
|
|
|
this.props = {};
|
|
|
|
},
|
|
|
|
|
2022-01-18 21:35:57 +09:00
|
|
|
onContextmenu(ev: MouseEvent) {
|
2020-10-25 01:21:41 +09:00
|
|
|
os.contextMenu([{
|
|
|
|
type: 'label',
|
2020-11-03 10:06:19 +09:00
|
|
|
text: this.path,
|
2020-10-25 01:21:41 +09:00
|
|
|
}, {
|
2021-04-20 23:22:59 +09:00
|
|
|
icon: 'fas fa-expand-alt',
|
2020-12-26 10:47:36 +09:00
|
|
|
text: this.$ts.showInPage,
|
2020-10-25 01:21:41 +09:00
|
|
|
action: () => {
|
2020-11-03 10:06:19 +09:00
|
|
|
this.$router.push(this.path);
|
2020-10-25 01:21:41 +09:00
|
|
|
this.close();
|
|
|
|
}
|
|
|
|
}, {
|
2021-04-20 23:22:59 +09:00
|
|
|
icon: 'fas fa-window-maximize',
|
2020-12-26 10:47:36 +09:00
|
|
|
text: this.$ts.openInWindow,
|
2020-10-25 01:21:41 +09:00
|
|
|
action: () => {
|
2020-11-03 10:06:19 +09:00
|
|
|
os.pageWindow(this.path);
|
2020-10-25 01:21:41 +09:00
|
|
|
this.close();
|
|
|
|
}
|
|
|
|
}, null, {
|
2021-04-20 23:22:59 +09:00
|
|
|
icon: 'fas fa-external-link-alt',
|
2020-12-26 10:47:36 +09:00
|
|
|
text: this.$ts.openInNewTab,
|
2020-10-25 01:21:41 +09:00
|
|
|
action: () => {
|
|
|
|
window.open(this.url, '_blank');
|
|
|
|
this.close();
|
|
|
|
}
|
|
|
|
}, {
|
2021-04-20 23:22:59 +09:00
|
|
|
icon: 'fas fa-link',
|
2020-12-26 10:47:36 +09:00
|
|
|
text: this.$ts.copyLink,
|
2020-10-25 01:21:41 +09:00
|
|
|
action: () => {
|
|
|
|
copyToClipboard(this.url);
|
|
|
|
}
|
2022-01-18 21:35:57 +09:00
|
|
|
}], ev);
|
2020-10-25 01:21:41 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.qvzfzxam {
|
|
|
|
$header-height: 58px; // TODO: どこかに集約したい
|
|
|
|
|
2021-04-10 12:40:50 +09:00
|
|
|
--root-margin: 16px;
|
2020-10-25 01:21:41 +09:00
|
|
|
--margin: var(--marginHalf);
|
|
|
|
|
|
|
|
> .container {
|
|
|
|
position: fixed;
|
|
|
|
width: 370px;
|
|
|
|
height: 100vh;
|
|
|
|
overflow: auto;
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
|
|
> .header {
|
|
|
|
display: flex;
|
|
|
|
position: sticky;
|
|
|
|
z-index: 1000;
|
|
|
|
top: 0;
|
|
|
|
height: $header-height;
|
|
|
|
width: 100%;
|
|
|
|
line-height: $header-height;
|
|
|
|
text-align: center;
|
|
|
|
font-weight: bold;
|
|
|
|
//background-color: var(--panel);
|
2021-08-11 22:34:45 +09:00
|
|
|
-webkit-backdrop-filter: var(--blur, blur(32px));
|
|
|
|
backdrop-filter: var(--blur, blur(32px));
|
2020-10-25 01:21:41 +09:00
|
|
|
background-color: var(--header);
|
|
|
|
|
|
|
|
> ._button {
|
|
|
|
height: $header-height;
|
|
|
|
width: $header-height;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
color: var(--fgHighlighted);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .title {
|
|
|
|
flex: 1;
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|