mirror of
https://github.com/directus/directus.git
synced 2026-04-03 03:00:39 -04:00
Add page titles (#4775)
* restructure template rendering * add useTitle composable * Split up render-string-template from getFieldsFromTemplate Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
This commit is contained in:
@@ -72,6 +72,7 @@ import NotificationsPreview from './components/notifications-preview/';
|
||||
import NotificationDialogs from './components/notification-dialogs/';
|
||||
import { useUserStore, useAppStore } from '@/stores';
|
||||
import router from '@/router';
|
||||
import useTitle from '@/composables/use-title';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
@@ -90,7 +91,8 @@ export default defineComponent({
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
setup() {
|
||||
setup(props) {
|
||||
const { title } = toRefs(props);
|
||||
const navOpen = ref(false);
|
||||
const contentEl = ref<Element>();
|
||||
const userStore = useUserStore();
|
||||
@@ -113,20 +115,10 @@ export default defineComponent({
|
||||
|
||||
router.afterEach(async (to, from) => {
|
||||
contentEl.value?.scrollTo({ top: 0 });
|
||||
|
||||
// await nextTick();
|
||||
|
||||
// const hash = to.hash;
|
||||
|
||||
// if (hash) {
|
||||
// const linkedEl = document.querySelector(hash) as HTMLElement;
|
||||
|
||||
// if (linkedEl) {
|
||||
// contentEl.value?.scrollTo({ top: linkedEl.offsetTop - 100, behavior: 'smooth' });
|
||||
// }
|
||||
// }
|
||||
});
|
||||
|
||||
useTitle(title);
|
||||
|
||||
return {
|
||||
navOpen,
|
||||
contentEl,
|
||||
|
||||
Reference in New Issue
Block a user