♻️ (app)
This commit is contained in:
@@ -2,11 +2,11 @@ import { useQueryStackedNotes } from '@/hooks/useQueryStackedNotes.hook'
|
||||
import { useNotes } from '@/modules/note/hooks/useNotes'
|
||||
import { pathToNoteTitle } from '@/utils/noteTitle'
|
||||
import { useTitle } from '@vueuse/core'
|
||||
import { computed, watch } from 'vue'
|
||||
import { computed, Ref, toValue, watch } from 'vue'
|
||||
|
||||
export const generateTitle = (titles: string[]) => titles.join(' | ')
|
||||
|
||||
export const useTitleNotes = (prefix: string) => {
|
||||
export const useTitleNotes = (prefix: Ref<string> | string) => {
|
||||
const { stackedNotes } = useQueryStackedNotes()
|
||||
const { notes } = useNotes()
|
||||
const titleNotes = computed(() =>
|
||||
@@ -15,9 +15,9 @@ export const useTitleNotes = (prefix: string) => {
|
||||
.map((note) => pathToNoteTitle(note.path ?? ''))
|
||||
)
|
||||
|
||||
const title = useTitle(generateTitle([prefix, ...titleNotes.value]))
|
||||
const title = useTitle(generateTitle([toValue(prefix), ...titleNotes.value]))
|
||||
|
||||
watch(titleNotes, () => {
|
||||
title.value = generateTitle([prefix, ...titleNotes.value])
|
||||
title.value = generateTitle([toValue(prefix), ...titleNotes.value])
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user