refactor(frontend): 非推奨となったReactivity Transformを使わないように (#12539)
* refactor(frontend): 非推奨となったReactivity Transformを使わないように * refactor: 不要な括弧を除去 * fix: 不要なアノテーションを除去 * fix: Refの配列をrefしている部分の対応 * refactor: 不要な括弧を除去 * fix: lint * refactor: Ref、ShallowRef、ComputedRefの変数の宣言をletからconstに置換 * fix: type error * chore: drop reactivity transform from eslint configuration * refactor: remove unnecessary import * fix: 対応漏れ
This commit is contained in:
parent
e42c91dee7
commit
406b4bdbe7
277 changed files with 3353 additions and 3441 deletions
|
@ -29,7 +29,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ComputedRef, onMounted, onUnmounted, provide, shallowRef } from 'vue';
|
||||
import { ComputedRef, onMounted, onUnmounted, provide, shallowRef, ref, computed } from 'vue';
|
||||
import RouterView from '@/components/global/RouterView.vue';
|
||||
import MkWindow from '@/components/MkWindow.vue';
|
||||
import { popout as _popout } from '@/scripts/popout.js';
|
||||
|
@ -55,16 +55,16 @@ defineEmits<{
|
|||
const router = new Router(routes, props.initialPath, !!$i, page(() => import('@/pages/not-found.vue')));
|
||||
|
||||
const contents = shallowRef<HTMLElement>();
|
||||
let pageMetadata = $ref<null | ComputedRef<PageMetadata>>();
|
||||
let windowEl = $shallowRef<InstanceType<typeof MkWindow>>();
|
||||
const history = $ref<{ path: string; key: any; }[]>([{
|
||||
const pageMetadata = ref<null | ComputedRef<PageMetadata>>();
|
||||
const windowEl = shallowRef<InstanceType<typeof MkWindow>>();
|
||||
const history = ref<{ path: string; key: any; }[]>([{
|
||||
path: router.getCurrentPath(),
|
||||
key: router.getCurrentKey(),
|
||||
}]);
|
||||
const buttonsLeft = $computed(() => {
|
||||
const buttonsLeft = computed(() => {
|
||||
const buttons = [];
|
||||
|
||||
if (history.length > 1) {
|
||||
if (history.value.length > 1) {
|
||||
buttons.push({
|
||||
icon: 'ti ti-arrow-left',
|
||||
onClick: back,
|
||||
|
@ -73,7 +73,7 @@ const buttonsLeft = $computed(() => {
|
|||
|
||||
return buttons;
|
||||
});
|
||||
const buttonsRight = $computed(() => {
|
||||
const buttonsRight = computed(() => {
|
||||
const buttons = [{
|
||||
icon: 'ti ti-reload',
|
||||
title: i18n.ts.reload,
|
||||
|
@ -86,21 +86,21 @@ const buttonsRight = $computed(() => {
|
|||
|
||||
return buttons;
|
||||
});
|
||||
let reloadCount = $ref(0);
|
||||
const reloadCount = ref(0);
|
||||
|
||||
router.addListener('push', ctx => {
|
||||
history.push({ path: ctx.path, key: ctx.key });
|
||||
history.value.push({ path: ctx.path, key: ctx.key });
|
||||
});
|
||||
|
||||
provide('router', router);
|
||||
provideMetadataReceiver((info) => {
|
||||
pageMetadata = info;
|
||||
pageMetadata.value = info;
|
||||
});
|
||||
provide('shouldOmitHeaderTitle', true);
|
||||
provide('shouldHeaderThin', true);
|
||||
provide('forceSpacerMin', true);
|
||||
|
||||
const contextmenu = $computed(() => ([{
|
||||
const contextmenu = computed(() => ([{
|
||||
icon: 'ti ti-player-eject',
|
||||
text: i18n.ts.showInPage,
|
||||
action: expand,
|
||||
|
@ -113,7 +113,7 @@ const contextmenu = $computed(() => ([{
|
|||
text: i18n.ts.openInNewTab,
|
||||
action: () => {
|
||||
window.open(url + router.getCurrentPath(), '_blank');
|
||||
windowEl.close();
|
||||
windowEl.value.close();
|
||||
},
|
||||
}, {
|
||||
icon: 'ti ti-link',
|
||||
|
@ -124,26 +124,26 @@ const contextmenu = $computed(() => ([{
|
|||
}]));
|
||||
|
||||
function back() {
|
||||
history.pop();
|
||||
router.replace(history.at(-1)!.path, history.at(-1)!.key);
|
||||
history.value.pop();
|
||||
router.replace(history.value.at(-1)!.path, history.value.at(-1)!.key);
|
||||
}
|
||||
|
||||
function reload() {
|
||||
reloadCount++;
|
||||
reloadCount.value++;
|
||||
}
|
||||
|
||||
function close() {
|
||||
windowEl.close();
|
||||
windowEl.value.close();
|
||||
}
|
||||
|
||||
function expand() {
|
||||
mainRouter.push(router.getCurrentPath(), 'forcePage');
|
||||
windowEl.close();
|
||||
windowEl.value.close();
|
||||
}
|
||||
|
||||
function popout() {
|
||||
_popout(router.getCurrentPath(), windowEl.$el);
|
||||
windowEl.close();
|
||||
_popout(router.getCurrentPath(), windowEl.value.$el);
|
||||
windowEl.value.close();
|
||||
}
|
||||
|
||||
useScrollPositionManager(() => getScrollContainer(contents.value), router);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue