lint code

This commit is contained in:
lyswhut
2023-08-27 15:09:07 +08:00
parent 0d76c9ccb4
commit 71b84fb10d
69 changed files with 346 additions and 413 deletions
+1 -1
View File
@@ -65,7 +65,7 @@ export default {
})
const menuClick = (item) => {
if (item && item.disabled) return
if (item?.disabled) return
emit('menu-click', item)
}
+8 -8
View File
@@ -28,7 +28,7 @@ const easeInOutQuad = (t, b, c, d) => {
return (-c / 2) * (t * (t - 2) - 1) + b
}
const handleScroll = (element, to, duration = 300, callback = () => {}, onCancel = () => {}) => {
if (!element) return callback()
if (!element) { callback(); return }
const start = element.scrollTop || element.scrollY || 0
let cancel = false
if (to > start) {
@@ -36,10 +36,10 @@ const handleScroll = (element, to, duration = 300, callback = () => {}, onCancel
if (to > maxScrollTop) to = maxScrollTop
} else if (to < start) {
if (to < 0) to = 0
} else return callback()
} else { callback(); return }
const change = to - start
const increment = 10
if (!change) return callback()
if (!change) { callback(); return }
let currentTime = 0
let val
@@ -145,7 +145,7 @@ export default {
case 'down':
break
default:
console.log(render(null, slots.default(list[0])[0]))
render(null, slots.default(list[0])[0])
break
}
}
@@ -196,14 +196,14 @@ export default {
emit('scroll', event)
}
const scrollTo = (scrollTop, animate = false) => {
const scrollTo = async(scrollTop, animate = false) => {
return new Promise(resolve => {
if (cancelScroll) {
cancelScroll(resolve)
} else {
resolve()
}
}).then(() => {
}).then(async() => {
return new Promise((resolve, reject) => {
if (animate) {
isScrolling = true
@@ -224,7 +224,7 @@ export default {
})
}
const scrollToIndex = (index, offset = 0, animate = false) => {
const scrollToIndex = async(index, offset = 0, animate = false) => {
return scrollTo(Math.max(index * props.itemHeight + offset, 0), animate)
}
@@ -245,7 +245,7 @@ export default {
cachedList = Array(list.length)
startIndex = -1
endIndex = -1
nextTick(() => {
void nextTick(() => {
updateView(true)
})
}
+4 -6
View File
@@ -22,13 +22,11 @@ import { ref, watch, onMounted, onBeforeUnmount, reactive } from '@common/utils/
// https://github.com/vuejs/core/issues/2855#issuecomment-768388962
import {
Teleport as teleport_,
TeleportProps,
VNodeProps,
type TeleportProps,
type VNodeProps,
} from 'vue'
const Teleport = teleport_ as {
new (): {
$props: VNodeProps & TeleportProps
}
const Teleport = teleport_ as new () => {
$props: VNodeProps & TeleportProps
}
const props = defineProps<{
@@ -50,7 +50,7 @@ const easeInOutQuad = (t, b, c, d) => {
return (-c / 2) * (t * (t - 2) - 1) + b
}
const handleScroll = (element, to, duration = 300, callback = () => {}, onCancel = () => {}) => {
if (!element) return callback()
if (!element) { callback(); return }
const start = element.scrollTop || element.scrollY || 0
let cancel = false
if (to > start) {
@@ -58,10 +58,10 @@ const handleScroll = (element, to, duration = 300, callback = () => {}, onCancel
if (to > maxScrollTop) to = maxScrollTop
} else if (to < start) {
if (to < 0) to = 0
} else return callback()
} else { callback(); return }
const change = to - start
const increment = 10
if (!change) return callback()
if (!change) { callback(); return }
let currentTime = 0
let val
@@ -214,7 +214,7 @@ export default {
const scrollTo = (scrollTop, animate = false, onScrollEnd) => {
if (onScrollEnd) {
new Promise(resolve => {
void new Promise(resolve => {
if (cancelScroll) {
cancelScroll(resolve)
} else {
@@ -270,7 +270,7 @@ export default {
cachedList = Array(list.length)
startIndex = -1
endIndex = -1
nextTick(() => {
void nextTick(() => {
updateView()
})
}
@@ -51,7 +51,7 @@ export default {
},
methods: {
handleClick(quality) {
createDownloadTasks([this.musicInfo], quality)
void createDownloadTasks([this.musicInfo], quality)
this.handleClose()
},
handleClose() {
@@ -37,7 +37,7 @@ export default {
emits: ['update:show', 'confirm'],
methods: {
handleClick(quality) {
createDownloadTasks(this.list.filter(item => item.source != 'local'), quality)
void createDownloadTasks(this.list.filter(item => item.source != 'local'), quality)
this.handleClose()
this.$emit('confirm')
},
@@ -71,7 +71,7 @@ export default {
const checkMusicExist = (musicInfo) => {
const mid = musicInfo.id
getMusicExistListIds(mid).then(ids => {
void getMusicExistListIds(mid).then(ids => {
if (mid != musicInfo.id) return
for (const list of lists.value) {
if (ids.includes(list.id)) list.isExist = true
@@ -150,9 +150,8 @@ export default {
: width < 3840 ? 5 : 6
},
handleClick(index) {
this.isMove
? moveListMusics(this.fromListId, this.lists[index].id, [this.currentMusicInfo])
: addListMusics(this.lists[index].id, [this.currentMusicInfo])
if (this.isMove) void moveListMusics(this.fromListId, this.lists[index].id, [this.currentMusicInfo])
else void addListMusics(this.lists[index].id, [this.currentMusicInfo])
this.lists[index].isExist = true
if (this.keyModDown && !this.isMove) return
@@ -174,7 +173,7 @@ export default {
this.newListName = event.target.value = ''
this.isEditing = false
if (!name) return
createUserList({ name })
void createUserList({ name })
},
},
}
@@ -111,9 +111,8 @@ export default {
handleClick(index) {
const list = 'progress' in this.musicList[0] ? this.musicList.map(t => t.metadata.musicInfo) : this.musicList
this.isMove
? moveListMusics(this.fromListId, this.lists[index].id, list)
: addListMusics(this.lists[index].id, list)
if (this.isMove) void moveListMusics(this.fromListId, this.lists[index].id, list)
else void addListMusics(this.lists[index].id, list)
if (this.keyModDown && !this.isMove) return
this.$nextTick(() => {
@@ -135,7 +134,7 @@ export default {
this.newListName = event.target.value = ''
this.isEditing = false
if (!name) return
createUserList({ name })
void createUserList({ name })
},
},
}
@@ -25,7 +25,7 @@ const handleEditing = () => {
if (isEditing.value) return
// if (!this.newPresetName) this.newPresetName = this.listName
isEditing.value = true
nextTick(() => {
void nextTick(() => {
input.value.$el.focus()
})
}
@@ -36,7 +36,7 @@ const handleSave = (event) => {
isEditing.value = false
if (!name) return
if (name.length > 20) name = name.substring(0, 20)
saveUserConvolutionPreset({
void saveUserConvolutionPreset({
id: Date.now().toString(),
name,
source: appSetting['player.soundEffect.convolution.fileName'],
@@ -18,7 +18,7 @@ const handleEditing = () => {
if (isEditing.value) return
// if (!this.newPresetName) this.newPresetName = this.listName
isEditing.value = true
nextTick(() => {
void nextTick(() => {
input.value.$el.focus()
})
}
@@ -29,7 +29,7 @@ const handleSave = (event) => {
isEditing.value = false
if (!name) return
if (name.length > 20) name = name.substring(0, 20)
saveUserEQPreset({
void saveUserEQPreset({
id: Date.now().toString(),
name,
hz31: appSetting['player.soundEffect.biquadFilter.hz31'],
@@ -69,7 +69,7 @@ const handleSetPreset = (item) => {
}
const userPresetList = ref([])
const handleRemovePreset = id => {
removeUserConvolutionPreset(id)
void removeUserConvolutionPreset(id)
}
const disabledConvolution = computed(() => {
@@ -77,7 +77,7 @@ const disabledConvolution = computed(() => {
})
onMounted(() => {
getUserConvolutionPresetList().then(list => {
void getUserConvolutionPresetList().then(list => {
userPresetList.value = list
})
})
@@ -65,11 +65,11 @@ const handleSetPreset = (item) => {
const userPresetList = ref([])
const handleRemovePreset = id => {
removeUserEQPreset(id)
void removeUserEQPreset(id)
}
onMounted(() => {
getUserEQPresetList().then(list => {
void getUserEQPresetList().then(list => {
userPresetList.value = list
})
})
@@ -30,7 +30,7 @@ import { computed, ref } from '@common/utils/vueTools'
export default {
setup() {
const lastStartVersion = ref(null)
getLastStartInfo().then(version => {
void getLastStartInfo().then(version => {
lastStartVersion.value = version
})
@@ -43,7 +43,7 @@ export default {
history: [],
isLatest: true,
}
if (!versionInfo.newVersion || !versionInfo.newVersion?.history) return info
if (!versionInfo.newVersion?.history) return info
info.isLatest = compareVer(currentVer, versionInfo.newVersion.version) >= 0
const history = [{ version: versionInfo.newVersion.version, desc: versionInfo.newVersion.desc }, ...versionInfo.newVersion.history]
+2 -2
View File
@@ -81,11 +81,11 @@ export default {
}, 2e3)
},
handleClose(isExit) {
if (isExit) return quitApp(true)
if (isExit) { quitApp(true); return }
isShowPact.value = false
},
openUrl(url) {
openUrl(url)
void openUrl(url)
},
startTimeout() {
window.setTimeout(() => {
@@ -101,7 +101,7 @@ export default {
const listId = playMusicInfo.listId
if (!listId || listId == LIST_IDS.DOWNLOAD || !playMusicInfo.musicInfo) return
if (playInfo.playIndex == -1) return
router.push({
void router.push({
path: '/list',
query: {
id: listId,
@@ -101,7 +101,7 @@ export default {
const listId = playMusicInfo.listId
if (!listId || listId == LIST_IDS.DOWNLOAD || !playMusicInfo.musicInfo) return
if (playInfo.playIndex == -1) return
router.push({
void router.push({
path: '/list',
query: {
id: listId,
@@ -103,7 +103,7 @@ export default {
const listId = playMusicInfo.listId
if (!listId || listId == LIST_IDS.DOWNLOAD || !playMusicInfo.musicInfo) return
if (playInfo.playIndex == -1) return
router.push({
void router.push({
path: '/list',
query: {
id: listId,
@@ -113,7 +113,7 @@ export default {
lyricMenuXY.x = event.pageX
lyricMenuXY.y = event.pageY
if (lyricMenuVisible.value) return
nextTick(() => {
void nextTick(() => {
lyricMenuVisible.value = true
})
}
@@ -55,10 +55,10 @@ const offsetTagRxp = /(?:^|\n)\s*\[offset:\s*(\S+(?:\d+)*)\s*\]/
const offsetTagAllRxp = /(^|\n)\s*\[offset:\s*(\S+(?:\d+)*)\s*\]/g
const saveLyric = debounce((musicInfo, lyricInfo) => {
saveLyricEdited(musicInfo, lyricInfo)
void saveLyricEdited(musicInfo, lyricInfo)
})
const removeLyric = debounce(musicInfo => {
removeLyricEdited(musicInfo)
void removeLyricEdited(musicInfo)
})
const getOffset = lrc => {
@@ -138,7 +138,7 @@ export default {
visibled,
isFullscreen,
fullscreenExit() {
setFullScreen(false).then((fullscreen) => {
void setFullScreen(false).then((fullscreen) => {
isFullscreen.value = fullscreen
})
},
@@ -61,7 +61,7 @@ export default {
}
const handleSelectMode = (mode) => {
if (mode.startsWith('overwrite') && isOverwrite.value) mode += '_full'
sendSyncAction({ action: 'select_mode', data: mode })
void sendSyncAction({ action: 'select_mode', data: mode })
handleClose()
}
return {
@@ -97,7 +97,7 @@ export default {
break
case 'listClick':
searchText.value = tipList.value[data]
nextTick(handleSearch)
void nextTick(handleSearch)
}
}
@@ -113,7 +113,7 @@ export default {
},
computed: {
history() {
if (!this.versionInfo.newVersion || !this.versionInfo.newVersion?.history) return []
if (!this.versionInfo.newVersion?.history) return []
let arr = []
let currentVer = this.versionInfo.version
this.versionInfo.newVersion?.history.forEach(ver => {
@@ -134,7 +134,7 @@ export default {
},
},
created() {
getIgnoreVersion().then(version => {
void getIgnoreVersion().then(version => {
this.ignoreVersion = version
})
},
@@ -143,7 +143,7 @@ export default {
versionInfo.showModal = false
},
handleOpenUrl(url) {
openUrl(url)
void openUrl(url)
},
handleRestartClick(event) {
this.handleClose()
@@ -166,7 +166,7 @@ export default {
confirmButtonText: window.i18n.t('update__ignore_confirm'),
})) {
setTimeout(() => {
dialog({
void dialog({
message: window.i18n.t('update__ignore_confirm_tip'),
confirmButtonText: window.i18n.t('update__ignore_confirm_tip_confirm'),
})
+1 -1
View File
@@ -161,7 +161,7 @@ export default {
// }
this.setRandomAnimation()
this.showModal = true
nextTick(() => {
void nextTick(() => {
this.$refs.dom_container.parentNode.classList.add('show-modal')
this.showContent = true
})
@@ -234,7 +234,7 @@ export default {
handleShowDownloadModal(index, true)
break
case 'play':
handlePlayMusic(index, true)
void handlePlayMusic(index, true)
break
case 'search':
handleSearch(index)
@@ -83,6 +83,7 @@ export default {
if (this.maxPage <= this.btnLength) return Array.from({ length: this.maxPage }, (_, i) => i + 1)
let start =
this.page - this.pageEvg > 1
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
? this.maxPage - this.page < this.pageEvg + 1
? this.maxPage - (this.btnLength - 1)
: this.page - this.pageEvg
@@ -141,7 +141,7 @@ export default {
},
handleSearch() {
this.hideList()
if (this.selectIndex < 0) return this.sendEvent('submit')
if (this.selectIndex < 0) { this.sendEvent('submit'); return }
this.sendEvent('listClick', this.selectIndex)
},
showList() {
+1 -1
View File
@@ -141,7 +141,7 @@ export const getCachedLyricInfo = async(musicInfo: LX.Music.MusicInfo): Promise<
export const getPlayQuality = (highQuality: boolean, musicInfo: LX.Music.MusicInfoOnline): LX.Quality => {
let type: LX.Quality = '128k'
let list = qualityList.value[musicInfo.source]
if (highQuality && musicInfo.meta._qualitys['320k'] && list && list.includes('320k')) type = '320k'
if (highQuality && musicInfo.meta._qualitys['320k'] && list?.includes('320k')) type = '320k'
return type
}
+1 -1
View File
@@ -7,7 +7,7 @@ export const getPlayType = (highQuality: boolean, musicInfo: LX.Music.MusicInfo
if ('progress' in musicInfo || musicInfo.source == 'local') return null
let type: LX.Quality = '128k'
let list = qualityList.value[musicInfo.source]
if (highQuality && musicInfo.meta._qualitys['320k'] && list && list.includes('320k')) type = '320k'
if (highQuality && musicInfo.meta._qualitys['320k'] && list?.includes('320k')) type = '320k'
return type
}
+1 -1
View File
@@ -16,7 +16,7 @@ export default () => {
userApi.status = status
userApi.message = message
if (status && apiInfo && apiInfo.sources) {
if (status && apiInfo?.sources) {
if (apiInfo.id === appSetting['common.apiSource']) {
let apis: any = {}
let qualitys: LX.QualityList = {}
@@ -73,7 +73,7 @@ export default () => {
navigator.mediaSession.playbackState = 'none'
}
const handleSetPlayInfo = () => {
emptyAudio.play().finally(() => {
void emptyAudio.play().finally(() => {
updateMediaSessionInfo()
updatePositionState({
position: playProgress.nowPlayTime,
@@ -100,12 +100,12 @@ export default () => {
})
navigator.mediaSession.setActionHandler('seekbackward', details => {
console.log('seekbackward')
const seekOffset = details.seekOffset == null ? 5 : details.seekOffset
const seekOffset = details.seekOffset ?? 5
setProgress(Math.max(getCurrentTime() - seekOffset, 0))
})
navigator.mediaSession.setActionHandler('seekforward', details => {
console.log('seekforward')
const seekOffset = details.seekOffset == null ? 5 : details.seekOffset
const seekOffset = details.seekOffset ?? 5
setProgress(Math.min(getCurrentTime() + seekOffset, getDuration()))
})
navigator.mediaSession.setActionHandler('seekto', details => {
-1
View File
@@ -1 +0,0 @@
export default LX
+6 -6
View File
@@ -143,9 +143,9 @@ export default {
if (task.isComplate) {
handlePlayMusic(list.value.indexOf(task), true)
} else if (task.status === downloadStatus.RUN || task.status === downloadStatus.WAITING) {
handlePauseTask(index, true)
void handlePauseTask(index, true)
} else {
handleStartTask(index, true)
void handleStartTask(index, true)
}
clickTime = 0
clickIndex = -1
@@ -172,16 +172,16 @@ export default {
handlePlayMusic(index, true)
break
case 'start':
handleStartTask(index, true)
void handleStartTask(index, true)
break
case 'pause':
handlePauseTask(index, true)
void handlePauseTask(index, true)
break
case 'remove':
handleRemoveTask(index, true)
void handleRemoveTask(index, true)
break
case 'file':
handleOpenFile(index)
void handleOpenFile(index)
break
case 'search':
handleSearch(index)
@@ -25,9 +25,8 @@
<script setup lang="ts">
import { watch, shallowReactive, ref } from '@common/utils/vueTools'
import { getBoardsList, setBoard } from '@renderer/store/leaderboard/action'
import { boards, Board } from '@renderer/store/leaderboard/state'
import { boards, type Board } from '@renderer/store/leaderboard/state'
import useMenu from './useMenu'
import LX from '@renderer/types/lx'
import { useRouter, useRoute } from '@common/utils/vueRouter'
const props = defineProps<{
@@ -44,7 +43,7 @@ const list = shallowReactive<Board['list']>([])
const rightClickItemIndex = ref(-1)
const handleToggleList = (id: string) => {
router.replace({
void router.replace({
path: route.path,
query: {
source: props.source,
@@ -65,7 +64,7 @@ const handleRigthClick = (event: MouseEvent, index: number) => {
rightClickItemIndex.value = index
showMenu(event, index)
}
const handleMenuClick = (action?: { action: string}) => {
const handleMenuClick = (action?: { action: string }) => {
if (rightClickItemIndex.value < 0) return
let index = rightClickItemIndex.value
rightClickItemIndex.value = -1
@@ -16,7 +16,6 @@
<script setup lang="ts">
import { watch } from '@common/utils/vueTools'
import LX from '@renderer/types/lx'
import useList from './useList'
+2 -2
View File
@@ -44,7 +44,7 @@ const verifyQueryParams = async function(to, from, next) {
next()
source.value = _source
boardId.value = _boardId
setLeaderboardSetting({ source: _source, boardId: _boardId })
void setLeaderboardSetting({ source: _source, boardId: _boardId })
}
@@ -64,7 +64,7 @@ export default {
const router = useRouter()
const route = useRoute()
const handleToggleSource = (id) => {
router.replace({
void router.replace({
path: route.path,
query: {
source: id,
+2 -2
View File
@@ -139,12 +139,12 @@ export default {
const handleRestoreScroll = (_scrollIndex, _isAnimation) => {
scrollIndex = _scrollIndex
isAnimation = _isAnimation
if (isAnimation) restoreScroll(scrollIndex, isAnimation)
if (isAnimation) void restoreScroll(scrollIndex, isAnimation)
// console.log('handleRestoreScroll', scrollIndex, isAnimation)
}
const onLoadedList = () => {
// console.log('restoreScroll', scrollIndex, isAnimation)
restoreScroll(scrollIndex, isAnimation)
void restoreScroll(scrollIndex, isAnimation)
}
const {
@@ -84,7 +84,7 @@ export default {
watch(() => props.visible, (visible) => {
if (visible) {
if (duplicateList.value.length) duplicateList.value = []
handleFilterList()
void handleFilterList()
}
})
@@ -117,7 +117,7 @@ export default {
console.log(sortType.value, sortField.value)
closeModal()
updateListMusicsPosition({ listId: props.listInfo.id, position: 0, ids: list.map(m => m.id) })
void updateListMusicsPosition({ listId: props.listInfo.id, position: 0, ids: list.map(m => m.id) })
}
const listName = computed(() => {
@@ -56,7 +56,7 @@ export default {
const updateInfo = ref({})
// const updateTimes = ref({})
getListUpdateInfo().then((listUpdateInfo) => {
void getListUpdateInfo().then((listUpdateInfo) => {
updateInfo.value = listUpdateInfo
// if (listUpdateTimes._inited) {
// for (const [id, value] of Object.entries(info)) {
@@ -72,12 +72,12 @@ export default {
})
const handleUpdate = (targetListInfo) => {
handleSyncSourceList(targetListInfo)
void handleSyncSourceList(targetListInfo)
// console.log(targetListInfo.list.length, list.length)
}
const handleChangeAutoUpdate = (list, enable) => {
setListAutoUpdate(list.id, enable)
void setListAutoUpdate(list.id, enable)
}
return {
+4 -4
View File
@@ -148,16 +148,16 @@ export default {
url = await musicSdk[source].songList.getDetailPageUrl(sourceListId)
}
if (!url) return
openUrl(url)
void openUrl(url)
}
const handleRemove = (listInfo) => {
dialog.confirm({
void dialog.confirm({
message: t('lists__remove_tip', { name: listInfo.name }),
confirmButtonText: t('lists__remove_tip_button'),
}).then(isRemove => {
if (!isRemove) return
removeUserList([listInfo.id])
void removeUserList([listInfo.id])
if (props.listId == listInfo.id) {
handleListToggle(LIST_IDS.DEFAULT)
}
@@ -212,7 +212,7 @@ export default {
watch(() => userLists, (lists) => {
if (lists.some(l => l.id == props.listId)) return
router.replace({
void router.replace({
path: '/list',
query: {
id: defaultList.id,
+2 -2
View File
@@ -6,7 +6,7 @@ import useDarg from '@renderer/utils/compositions/useDrag'
export default ({ dom_lists_list, handleSaveListName, handleMenuClick }: {
dom_lists_list: Ref<HTMLElement | null>
handleSaveListName: () => void
handleSaveListName: () => Promise<void> | void
handleMenuClick: () => void
}) => {
const isModDown = ref(false)
@@ -34,7 +34,7 @@ export default ({ dom_lists_list, handleSaveListName, handleMenuClick }: {
isModDown.value = true
setDisabled(false)
handleSaveListName()
void handleSaveListName()
}
handleMenuClick()
}
@@ -19,7 +19,7 @@
import { watch } from '@common/utils/vueTools'
import { searchText } from '@renderer/store/search/state'
import { useRouter, useRoute } from '@common/utils/vueRouter'
import useList, { SearchSource } from './useList'
import useList, { type SearchSource } from './useList'
interface Props {
sourceId: SearchSource
@@ -51,7 +51,7 @@ watch(searchText, (searchText) => {
})
const handleTogglePage = (page: number) => {
router.replace({
void router.replace({
path: route.path,
query: {
...route.query,
@@ -8,7 +8,7 @@
import { watch } from '@common/utils/vueTools'
import { searchText } from '@renderer/store/search/state'
import { useRouter, useRoute } from '@common/utils/vueRouter'
import useList, { SearchSource } from './useList'
import useList, { type SearchSource } from './useList'
import SongList from '@renderer/views/songList/List/components/SongList.vue'
interface Props {
@@ -40,7 +40,7 @@ watch(searchText, (searchText) => {
})
const togglePage = (page: number) => {
router.replace({
void router.replace({
path: route.path,
query: {
...route.query,
@@ -44,7 +44,7 @@ const hotSearchList = shallowRef([])
if (appSetting['search.isShowHotSearch']) {
watch(() => props.visible, (visible) => {
if (!visible) return
getList(props.source).then(list => {
void getList(props.source).then(list => {
hotSearchList.value = list
})
}, {
@@ -53,7 +53,7 @@ if (appSetting['search.isShowHotSearch']) {
watch(() => props.source, (source) => {
if (!props.visible) return
getList(source).then(list => {
void getList(source).then(list => {
if (source != props.source) return
hotSearchList.value = list
})
@@ -61,12 +61,12 @@ if (appSetting['search.isShowHotSearch']) {
}
if (appSetting['search.isShowHistorySearch']) {
getHistoryList()
void getHistoryList()
}
const router = useRouter()
const handleSearch = (text) => {
router.replace({
void router.replace({
path: '/search',
query: {
text,
+3 -3
View File
@@ -54,7 +54,7 @@ const verifyQueryParams = async(to, from, next) => {
if (!_page) page.value = 1
}
next()
setSearchSetting({ source: _source, type: _type })
void setSearchSetting({ source: _source, type: _type })
}
export default {
@@ -76,7 +76,7 @@ export default {
}
})
const handleSourceChange = (id) => {
router.replace({
void router.replace({
path: route.path,
query: {
...route.query,
@@ -93,7 +93,7 @@ export default {
]
})
const handleTypeChange = (type) => {
router.replace({
void router.replace({
path: route.path,
query: {
...route.query,
@@ -148,11 +148,11 @@ export default {
await importNewListData(allData.playList)
importNewSettingData(allData.setting)
break
default: return showImportTip(allData.type)
default: { showImportTip(allData.type) }
}
}
const handleImportAllData = () => {
showSelectDialog({
void showSelectDialog({
title: t('setting__backup_all_import_desc'),
properties: ['openFile'],
filters: [
@@ -161,13 +161,13 @@ export default {
],
}).then(result => {
if (result.canceled) return
dialog.confirm({
void dialog.confirm({
message: t('setting__backup_part_import_list_confirm'),
cancelButtonText: t('cancel_button_text'),
confirmButtonText: t('confirm_button_text'),
}).then(confirm => {
if (!confirm) return
importAllData(result.filePaths[0])
void importAllData(result.filePaths[0])
})
})
}
@@ -178,15 +178,15 @@ export default {
setting: { ...appSetting },
playList: await getAllLists(),
}
window.lx.worker.main.saveLxConfigFile(path, allData)
void window.lx.worker.main.saveLxConfigFile(path, allData)
}
const handleExportAllData = () => {
openSaveDir({
void openSaveDir({
title: t('setting__backup_all_export_desc'),
defaultPath: 'lx_datas_v2.lxmc',
}).then(result => {
if (result.canceled) return
exportAllData(result.filePath)
void exportAllData(result.filePath)
})
}
@@ -195,10 +195,10 @@ export default {
type: 'setting_v2',
data: { ...appSetting },
}
window.lx.worker.main.saveLxConfigFile(path, data)
void window.lx.worker.main.saveLxConfigFile(path, data)
}
const handleExportSetting = () => {
openSaveDir({
void openSaveDir({
title: t('setting__backup_part_export_setting_desc'),
defaultPath: 'lx_setting_v2.lxmc',
}).then(result => {
@@ -222,11 +222,11 @@ export default {
case 'setting_v2':
importNewSettingData(settingData.data)
break
default: return showImportTip(settingData.type)
default: { showImportTip(settingData.type) }
}
}
const handleImportSetting = () => {
showSelectDialog({
void showSelectDialog({
title: t('setting__backup_part_import_setting_desc'),
properties: ['openFile'],
filters: [
@@ -235,7 +235,7 @@ export default {
],
}).then(result => {
if (result.canceled) return
importSetting(result.filePaths[0])
void importSetting(result.filePaths[0])
})
}
@@ -244,15 +244,15 @@ export default {
type: 'playList_v2',
data: await getAllLists(),
}
window.lx.worker.main.saveLxConfigFile(path, data)
void window.lx.worker.main.saveLxConfigFile(path, data)
}
const handleExportPlayList = () => {
openSaveDir({
void openSaveDir({
title: t('setting__backup_part_export_list_desc'),
defaultPath: 'lx_list.lxmc',
}).then(result => {
if (result.canceled) return
exportPlayList(result.filePath)
void exportPlayList(result.filePath)
})
}
@@ -275,11 +275,11 @@ export default {
case 'playList_v2':
await importNewListData(listData.data)
break
default: return showImportTip(listData.type)
default: { showImportTip(listData.type) }
}
}
const handleImportPlayList = () => {
showSelectDialog({
void showSelectDialog({
title: t('setting__backup_part_import_list_desc'),
properties: ['openFile'],
filters: [
@@ -288,13 +288,13 @@ export default {
],
}).then(result => {
if (result.canceled) return
dialog.confirm({
void dialog.confirm({
message: t('setting__backup_part_import_list_confirm'),
cancelButtonText: t('cancel_button_text'),
confirmButtonText: t('confirm_button_text'),
}).then(confirm => {
if (!confirm) return
importPlayList(result.filePaths[0])
void importPlayList(result.filePaths[0])
})
})
}
@@ -310,23 +310,23 @@ export default {
confirmButtonText: t('confirm_button_text'),
})
if (confirm) {
openSaveDir({
void openSaveDir({
title: t('setting__backup_other_export_dir'),
defaultPath: 'lx_list_all.txt',
}).then(result => {
if (result.canceled) return
let path = result.filePath
if (!path.endsWith('.txt')) path += '.txt'
exportPlayListToText(path, true)
void exportPlayListToText(path, true)
})
} else {
showSelectDialog({
void showSelectDialog({
title: t('setting__backup_other_export_dir'),
// defaultPath: currentStting.value.download.savePath,
properties: ['openDirectory'],
}).then(result => {
if (result.canceled) return
exportPlayListToText(result.filePaths[0], false)
void exportPlayListToText(result.filePaths[0], false)
})
}
}
@@ -342,23 +342,23 @@ export default {
confirmButtonText: t('confirm_button_text'),
})
if (confirm) {
openSaveDir({
void openSaveDir({
title: t('setting__backup_other_export_dir'),
defaultPath: 'lx_list_all.csv',
}).then(result => {
if (result.canceled) return
let path = result.filePath
if (!path.endsWith('.csv')) path += '.csv'
exportPlayListToCsv(path, true)
void exportPlayListToCsv(path, true)
})
} else {
showSelectDialog({
void showSelectDialog({
title: t('setting__backup_other_export_dir'),
// defaultPath: currentStting.value.download.savePath,
properties: ['openDirectory'],
}).then(result => {
if (result.canceled) return
exportPlayListToCsv(result.filePaths[0], false)
void exportPlayListToCsv(result.filePaths[0], false)
})
}
}
@@ -186,7 +186,7 @@ export default {
const handleEditTheme = (theme) => {
// console.log(theme)
if (!theme && userThemes.length >= 10) {
dialog({
void dialog({
message: t('theme_max_tip'),
confirmButtonText: t('alert_button_text'),
})
@@ -214,7 +214,7 @@ export default {
if (themeId.value == 'auto') return
if (window.localStorage.getItem('theme-auto-tip') != 'true') {
window.localStorage.setItem('theme-auto-tip', 'true')
dialog({
void dialog({
message: t('setting__basic_theme_auto_tip'),
confirmButtonText: t('ok'),
})
@@ -271,7 +271,7 @@ export default {
const fontList = computed(() => {
return [{ id: '', label: t('setting__desktop_lyric_font_default') }, ...systemFontList.value]
})
getSystemFonts().then(fonts => {
void getSystemFonts().then(fonts => {
systemFontList.value = fonts.map(f => ({ id: f, label: f.replace(/(^"|"$)/g, '') }))
})
@@ -269,7 +269,7 @@ export default {
const fontList = computed(() => {
return [{ id: '', label: t('setting__desktop_lyric_font_default') }, ...systemFontList.value]
})
getSystemFonts().then(fonts => {
void getSystemFonts().then(fonts => {
systemFontList.value = fonts.map(f => ({ id: f, label: f.replace(/(^"|"$)/g, '') }))
})
@@ -67,7 +67,7 @@ export default {
const t = useI18n()
const handleChangeSavePath = () => {
showSelectDialog({
void showSelectDialog({
title: t('setting__download_select_save_path'),
defaultPath: appSetting['download.savePath'],
properties: ['openDirectory'],
@@ -134,6 +134,7 @@ export default {
if (config) {
if (config.key == newHotKey) return
originKey = config.key
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete current_hot_key.value[type].keys[config.key]
} else if (!newHotKey) return
@@ -143,6 +144,7 @@ export default {
config = tempInfo.keys[newHotKey]
if (config) {
console.log(newHotKey, info, config, info.name, config.name)
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete current_hot_key.value[tempType].keys[newHotKey]
break
}
@@ -203,7 +205,7 @@ export default {
await handleHotKeySaveConfig()
await getHotKeyStatus()
}
const getHotKeyStatus = () => {
const getHotKeyStatus = async() => {
return hotKeyGetStatus().then(status => {
// console.log(status)
hotKeyStatus.value = status
@@ -213,7 +215,7 @@ export default {
current_hot_key.value = window.lx.appHotKeyConfig
initHotKeyConfig()
getHotKeyStatus()
void getHotKeyStatus()
window.app_event.on('keyDown', handleKeyDown)
@@ -83,7 +83,7 @@ export default {
const isDisabledResourceCacheClear = ref(false)
// const isDisabledListCacheClear = ref(false)
const refreshCacheSize = () => {
getCacheSize().then(size => {
void getCacheSize().then(size => {
cacheSize.value = sizeFormate(size)
})
}
@@ -94,7 +94,7 @@ export default {
confirmButtonText: t('setting__other_resource_cache_confirm'),
})) return
isDisabledResourceCacheClear.value = true
clearCache().then(() => {
void clearCache().then(() => {
refreshCacheSize()
isDisabledResourceCacheClear.value = false
})
@@ -105,13 +105,13 @@ export default {
const otherSourceCount = ref(0)
const isDisabledOtherSourceCacheClear = ref(false)
const refreshOtherSourceCount = () => {
getOtherSourceCount().then(count => {
void getOtherSourceCount().then(count => {
otherSourceCount.value = count
})
}
const handleClearOtherSourceCache = async() => {
isDisabledOtherSourceCacheClear.value = true
clearOtherSource().then(() => {
void clearOtherSource().then(() => {
refreshOtherSourceCount()
isDisabledOtherSourceCacheClear.value = false
})
@@ -122,13 +122,13 @@ export default {
const musicUrlCount = ref(0)
const isDisabledMusicUrlCacheClear = ref(false)
const refreshMusicUrlCount = () => {
getMusicUrlCount().then(count => {
void getMusicUrlCount().then(count => {
musicUrlCount.value = count
})
}
const handleClearMusicUrlCache = async() => {
isDisabledMusicUrlCacheClear.value = true
clearMusicUrl().then(() => {
void clearMusicUrl().then(() => {
refreshMusicUrlCount()
isDisabledMusicUrlCacheClear.value = false
})
@@ -139,13 +139,13 @@ export default {
const lyricRawCount = ref(0)
const isDisabledLyricRawCacheClear = ref(false)
const refreshLyricRawCount = () => {
getLyricRawCount().then(count => {
void getLyricRawCount().then(count => {
lyricRawCount.value = count
})
}
const handleClearLyricRawCache = async() => {
isDisabledLyricRawCacheClear.value = true
clearLyricRaw().then(() => {
void clearLyricRaw().then(() => {
refreshLyricRawCount()
isDisabledLyricRawCacheClear.value = false
})
@@ -156,7 +156,7 @@ export default {
const lyricEditedCount = ref(0)
const isDisabledLyricEditedCacheClear = ref(false)
const refreshLyricEditedCount = () => {
getLyricEditedCount().then(count => {
void getLyricEditedCount().then(count => {
lyricEditedCount.value = count
})
}
@@ -167,7 +167,7 @@ export default {
confirmButtonText: t('setting__other_resource_cache_confirm'),
})) return
isDisabledLyricEditedCacheClear.value = true
clearLyricEdited().then(() => {
void clearLyricEdited().then(() => {
refreshLyricEditedCount()
isDisabledLyricEditedCacheClear.value = false
})
@@ -180,7 +180,7 @@ export default {
cancelButtonText: t('cancel_button_text'),
confirmButtonText: t('setting__other_resource_cache_confirm'),
})) return
overwriteListFull({
void overwriteListFull({
defaultList: [],
loveList: [],
userList: [],
@@ -47,7 +47,7 @@ export default {
mediaDevices.value = audioDevices
// console.log(this.mediaDevices)
}
getMediaDevice()
void getMediaDevice()
navigator.mediaDevices.addEventListener('devicechange', getMediaDevice)
onBeforeUnmount(() => {
@@ -91,7 +91,7 @@ export default {
})
const refreshSyncCode = () => {
sendSyncAction({ action: 'generate_code' })
void sendSyncAction({ action: 'generate_code' })
}
const setSyncServerPort = debounce(port => {
@@ -288,39 +288,39 @@ export default {
// console.log('appBgColor', color)
theme.config.extInfo['--color-app-background'] = color == appBgColor ? appBgColorOrigin : color
createPreview()
}, () => setAppBgColor(getColor(appBgColorOrigin, theme)))
}, () => { setAppBgColor(getColor(appBgColorOrigin, theme)) })
initAsideFontColor(asideFontColor, (color) => {
theme.config.extInfo['--color-nav-font'] = color == asideFontColor ? asideFontColorOrigin : color
createPreview()
}, () => setAsideFontColor(getColor(asideFontColorOrigin, theme)))
}, () => { setAsideFontColor(getColor(asideFontColorOrigin, theme)) })
initMainBgColor(mainBgColor, (color) => {
theme.config.extInfo['--color-main-background'] = color == mainBgColor ? mainBgColorOrigin : color
createPreview()
}, () => setMainBgColor(getColor(mainBgColorOrigin, theme)))
}, () => { setMainBgColor(getColor(mainBgColorOrigin, theme)) })
initBadgePrimaryColor(badgePrimaryColor, (color) => {
theme.config.extInfo['--color-badge-primary'] = color == badgePrimaryColor ? badgePrimaryColorOrigin : color
createPreview()
}, () => setBadgePrimaryColor(getColor(badgePrimaryColorOrigin, theme)))
}, () => { setBadgePrimaryColor(getColor(badgePrimaryColorOrigin, theme)) })
initBadgeSecondaryColor(badgeSecondaryColor, (color) => {
theme.config.extInfo['--color-badge-secondary'] = color == badgeSecondaryColor ? badgeSecondaryColorOrigin : color
createPreview()
}, () => setBadgeSecondaryColor(getColor(badgeSecondaryColorOrigin, theme)))
}, () => { setBadgeSecondaryColor(getColor(badgeSecondaryColorOrigin, theme)) })
initBadgeTertiaryColor(badgeTertiaryColor, (color) => {
theme.config.extInfo['--color-badge-tertiary'] = color == badgeTertiaryColor ? badgeTertiaryColorOrigin : color
createPreview()
}, () => setBadgeTertiaryColor(getColor(badgeTertiaryColorOrigin, theme)))
}, () => { setBadgeTertiaryColor(getColor(badgeTertiaryColorOrigin, theme)) })
initCloseBtnColor(closeBtnColor, (color) => {
theme.config.extInfo['--color-btn-close'] = color == closeBtnColor ? closeBtnColorOrigin : color
createPreview()
}, () => setCloseBtnColor(getColor(closeBtnColorOrigin, theme)))
}, () => { setCloseBtnColor(getColor(closeBtnColorOrigin, theme)) })
initMinBtnColor(minBtnColor, (color) => {
theme.config.extInfo['--color-btn-min'] = color == minBtnColor ? minBtnColorOrigin : color
createPreview()
}, () => setMinBtnColor(getColor(minBtnColorOrigin, theme)))
}, () => { setMinBtnColor(getColor(minBtnColorOrigin, theme)) })
initHideBtnColor(hideBtnColor, (color) => {
theme.config.extInfo['--color-btn-hide'] = color == hideBtnColor ? hideBtnColorOrigin : color
createPreview()
}, () => setHideBtnColor(getColor(hideBtnColorOrigin, theme)))
}, () => { setHideBtnColor(getColor(hideBtnColorOrigin, theme)) })
createPreview()
}
@@ -339,7 +339,7 @@ export default {
}
watch(() => props.modelValue, (visible) => {
nextTick(() => {
void nextTick(() => {
getThemes(({ themes, userThemes }) => {
if (visible) {
if (props.themeId) {
@@ -392,7 +392,7 @@ export default {
}
const removeBgImg = async() => {
if (currentBgPath) {
removeFile(currentBgPath)
void removeFile(currentBgPath)
currentBgPath = ''
}
bgImg.value = ''
@@ -432,7 +432,7 @@ export default {
// 移除旧背景
if (originBgName &&
theme.config.extInfo['--background-image'] != originBgName &&
!isUrl(theme.config.extInfo['--background-image'])) removeFile(joinPath(themeInfo.dataPath, originBgName))
!isUrl(theme.config.extInfo['--background-image'])) void removeFile(joinPath(themeInfo.dataPath, originBgName))
if (props.themeId) {
const index = themeInfo.userThemes.findIndex(t => t.id == theme.id)
if (index > -1) themeInfo.userThemes.splice(index, 1, theme)
@@ -468,7 +468,7 @@ export default {
}
}
if (isRequireUpdateSetting) updateSetting(newSetting)
if (originBgName) removeFile(joinPath(themeInfo.dataPath, originBgName))
if (originBgName) void removeFile(joinPath(themeInfo.dataPath, originBgName))
await removeTheme(props.themeId)
const index = themeInfo.userThemes.findIndex(t => t.id == theme.id)
console.log(index)
@@ -60,16 +60,16 @@ export default {
})
return
}
showSelectDialog({
void showSelectDialog({
title: this.$t('user_api__import_file'),
properties: ['openFile'],
filters: [
{ name: 'LX API File', extensions: ['js'] },
{ name: 'All Files', extensions: ['*'] },
],
}).then(result => {
}).then(async result => {
if (result.canceled) return
return readFile(result.filePaths[0]).then(data => {
return readFile(result.filePaths[0]).then(async data => {
return importUserApi(data.toString()).then(({ apiList }) => {
userApi.list = apiList
})
@@ -92,10 +92,10 @@ export default {
this.$emit('update:modelValue', false)
},
handleOpenUrl(url) {
openUrl(url)
void openUrl(url)
},
handleChangeAllowUpdateAlert(api, enable) {
setAllowShowUserApiUpdateAlert(api.id, enable)
void setAllowShowUserApiUpdateAlert(api.id, enable)
},
},
}
+1 -1
View File
@@ -119,7 +119,7 @@ export default {
const toggleTab = id => {
avtiveComponentName.value = id
nextTick(() => {
void nextTick(() => {
dom_content_ref.value?.scrollTo({
top: 0,
behavior: 'smooth',
+5 -6
View File
@@ -45,7 +45,6 @@
import { ref, watch } from '@common/utils/vueTools'
import { listDetailInfo } from '@renderer/store/songList/state'
import { setVisibleListDetail } from '@renderer/store/songList/action'
import LX from '@renderer/types/lx'
import { useRouter } from '@common/utils/vueRouter'
import { addSongListDetail, playSongListDetail } from './action'
import useList from './useList'
@@ -68,7 +67,7 @@ interface Query {
fromName?: string
}
const verifyQueryParams = async function(this: any, to: { query: Query, path: string}, from: any, next: (route?: { path: string; query: Query }) => void) {
const verifyQueryParams = async function(this: any, to: { query: Query, path: string }, from: any, next: (route?: { path: string, query: Query }) => void) {
let _source = to.query.source
let _id = to.query.id
let _page: string | undefined = to.query.page
@@ -119,25 +118,25 @@ export default {
const togglePage = (page: number) => {
getListData(source.value, id.value, page, refresh.value)
void getListData(source.value, id.value, page, refresh.value)
}
const handleBack = () => {
setVisibleListDetail(false)
if (window.lx.songListInfo.fromName) router.replace({ name: window.lx.songListInfo.fromName })
if (window.lx.songListInfo.fromName) void router.replace({ name: window.lx.songListInfo.fromName })
else router.back()
}
useKeyBack(handleBack)
watch([source, id, page, refresh], ([_source, _id, _page, _refresh]) => {
watch([source, id, page, refresh], async([_source, _id, _page, _refresh]) => {
if (!_source || !_id) return router.replace({ path: '/songList/list' })
// console.log(_source, _id, _page, _refresh, picUrl.value)
// source.value = _source
// id.value = _id
// refresh.value = _refresh
// page.value = _page ?? 1
getListData(_source, _id, _page, _refresh)
void getListData(_source, _id, _page, _refresh)
}, {
immediate: true,
})
@@ -7,7 +7,6 @@ import { watch, ref, nextTick } from '@common/utils/vueTools'
import { listInfo } from '@renderer/store/songList/state'
import { getAndSetList } from '@renderer/store/songList/action'
import { useRouter, useRoute, onBeforeRouteLeave } from '@common/utils/vueRouter'
import LX from '@renderer/types/lx'
import SongList from './components/SongList.vue'
@@ -28,12 +27,12 @@ const getListData = async(source: LX.OnlineSource, tabId: string, sortId: string
// console.log(source, tabId, sortId, page)
await getAndSetList(source, tabId, sortId, page).then(() => {
if (listInfo.key == window.lx.songListInfo.songlistKey && window.lx.songListInfo.songlistPosition) {
nextTick(() => {
void nextTick(() => {
list_ref.value?.scrollTo(window.lx.songListInfo.songlistPosition)
})
} else if (list_ref.value) {
window.lx.songListInfo.songlistKey = null
nextTick(() => {
void nextTick(() => {
list_ref.value.scrollTo(0)
})
}
@@ -41,7 +40,7 @@ const getListData = async(source: LX.OnlineSource, tabId: string, sortId: string
}
const togglePage = (page: number) => {
router.replace({
void router.replace({
path: route.path,
query: {
...route.query,
@@ -57,7 +56,7 @@ watch(() => [props.source, props.tagId, props.sortId, props.page], ([source, tag
// console.log(source, tagId, sortId)
if (!source || !sortId) return
// console.log(source, tagId, sortId, page)
getListData(source as LX.OnlineSource, tagId as string, sortId as string, page as number)
void getListData(source as LX.OnlineSource, tagId as string, sortId as string, page as number)
}, {
immediate: true,
})
@@ -65,7 +65,7 @@ watch(() => props.modelValue, (visible) => {
const handleSubmit = () => {
if (!text.value.length) return
setOpenSongListInputInfo(text.value, source.value)
router.push({
void router.push({
path: '/songList/detail',
query: {
source: source.value,
@@ -36,7 +36,6 @@
<script setup lang="ts">
import { ref } from '@common/utils/vueTools'
import type { ListInfo, ListInfoItem } from '@renderer/store/songList/state'
// import LX from '@renderer/types/lx'
import { useRoute, useRouter } from '@common/utils/vueRouter'
@@ -60,7 +59,7 @@ const togglePage = (page: number) => {
}
const toDetail = (info: ListInfoItem) => {
router.push({
void router.push({
path: '/songList/detail',
query: {
source: info.source,
@@ -29,7 +29,7 @@ const list = shallowReactive([])
const handleToggle = (id) => {
router.replace({
void router.replace({
path: route.path,
query: {
source: props.source,
@@ -24,7 +24,6 @@
import { watch, shallowReactive, ref, onMounted, onBeforeUnmount, computed, reactive } from '@common/utils/vueTools'
import { setTags, getTags } from '@renderer/store/songList/action'
import { tags, type TagInfoTypeItem } from '@renderer/store/songList/state'
import LX from '@renderer/types/lx'
import { useRouter, useRoute } from '@common/utils/vueRouter'
import { useI18n } from '@renderer/plugins/i18n'
@@ -40,7 +39,7 @@ const t = useI18n()
const list = shallowReactive<TagInfoTypeItem[]>([])
const handleToggleTag = (id: string) => {
router.replace({
void router.replace({
path: route.path,
query: {
source: props.source,
+3 -4
View File
@@ -22,7 +22,6 @@ import OpenListModal from './components/OpenListModal.vue'
import ListView from './ListView.vue'
import { sources, listInfo, isVisibleListDetail } from '@renderer/store/songList/state'
import { sourceNames } from '@renderer/store'
import LX from '@renderer/types/lx'
import { useRoute, useRouter } from '@common/utils/vueRouter'
const source = ref<LX.OnlineSource>('kw')
@@ -38,7 +37,7 @@ interface Query {
page?: string
}
const verifyQueryParams = async function(this: any, to: { query: Query, path: string}, from: any, next: (route?: { path: string; query: Query }) => void) {
const verifyQueryParams = async function(this: any, to: { query: Query, path: string }, from: any, next: (route?: { path: string, query: Query }) => void) {
let _source = to.query.source
let _tagId = to.query.tagId
let _sortId = to.query.sortId
@@ -72,7 +71,7 @@ const verifyQueryParams = async function(this: any, to: { query: Query, path: st
tagId.value = _tagId ?? ''
sortId.value = _sortId ?? ''
page.value = _page ? parseInt(_page) : 1
setSongListSetting({ source: _source, tagId: _tagId, sortId: _sortId })
void setSongListSetting({ source: _source, tagId: _tagId, sortId: _sortId })
}
@@ -95,7 +94,7 @@ export default {
const route = useRoute()
const handleToggleSource = (id: LX.OnlineSource) => {
if (id == source.value) return
router.replace({
void router.replace({
path: route.path,
query: {
source: id,