refactor: avoid directly importing all methods from ~/utils

This commit is contained in:
Hakadao
2023-04-13 02:02:06 +08:00
parent b1ccf3e6fc
commit 495c9b460a
18 changed files with 28 additions and 36 deletions

View File

@@ -3,7 +3,8 @@ import { createApp } from 'vue'
import type { App as AppType } from 'vue'
import App from './views/App.vue'
import { setupApp } from '~/logic/common-setup'
import { SVG_ICONS, i18n } from '~/utils'
import { i18n } from '~/utils/i18n'
import { SVG_ICONS } from '~/utils/svgIcons'
let app: AppType | null = null;

View File

@@ -4,7 +4,8 @@ import AnimeTimeTable from './components/AnimeTimeTable.vue'
import AnimeCard from './components/AnimeCard.vue'
import AnimeCardSkeleton from './components/AnimeCardSkeleton.vue'
import type { AnimeItem, PopularAnime } from './types'
import { getUserID, numFormatter, openLinkToNewTab, removeHttpFromUrl } from '~/utils'
import { getUserID, openLinkToNewTab, removeHttpFromUrl } from '~/utils/main'
import { numFormatter } from '~/utils/dataFormatter'
const animeWatchList = reactive<AnimeItem[]>([])
const recommendAnimeList = reactive<AnimeItem[]>([])

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { removeHttpFromUrl } from '~/utils'
import { removeHttpFromUrl } from '~/utils/main'
defineProps<{
url: string

View File

@@ -3,7 +3,7 @@ import type { Ref } from 'vue'
import { useI18n } from 'vue-i18n'
import browser from 'webextension-polyfill'
import type { AnimeTimeTableItem } from '../types'
import { removeHttpFromUrl } from '~/utils'
import { removeHttpFromUrl } from '~/utils/main'
const { t } = useI18n()

View File

@@ -12,7 +12,7 @@ import Video from './Video/Video.vue'
import { activatedPage, settings } from '~/logic'
import '~/styles/index.ts'
import { AppPage, LanguageType } from '~/enums/appEnums'
import { hexToRGBA } from '~/utils'
import { hexToRGBA } from '~/utils/main'
const { locale } = useI18n()
const [showSettings, toggle] = useToggle(false)

View File

@@ -2,7 +2,8 @@
import type { Ref } from 'vue'
import { TransitionGroup, onMounted, reactive, ref, watch } from 'vue'
import type { FavoriteCategory, FavoriteResource } from './types'
import { calcCurrentTime, getUserID, removeHttpFromUrl } from '~/utils'
import { getUserID, removeHttpFromUrl } from '~/utils/main'
import { calcCurrentTime } from '~/utils/dataFormatter'
const favoriteCategories = reactive<Array<FavoriteCategory>>([])
const favoriteResources = reactive<Array<FavoriteResource>>([])

View File

@@ -3,12 +3,8 @@ import { useDateFormat } from '@vueuse/core'
import { useI18n } from 'vue-i18n'
import { HistoryType } from './types'
import type { HistoryItem } from './types'
import {
calcCurrentTime,
getCSRF,
openLinkToNewTab,
removeHttpFromUrl,
} from '~/utils'
import { getCSRF, openLinkToNewTab, removeHttpFromUrl } from '~/utils/main'
import { calcCurrentTime } from '~/utils/dataFormatter'
const { t } = useI18n()

View File

@@ -2,7 +2,8 @@
import type { Ref, UnwrapNestedRefs } from 'vue'
import { useDateFormat } from '@vueuse/core'
import type { Comment, UserCardInfo, VideoInfo } from './types'
import { calcTimeSince, getCSRF, numFormatter, removeHttpFromUrl } from '~/utils'
import { getCSRF, removeHttpFromUrl } from '~/utils/main'
import { calcTimeSince, numFormatter } from '~/utils/dataFormatter'
const videoContent = ref() as Ref<HTMLElement>
// const commentContent = ref() as Ref<HTMLElement>