Files
myprojplanet_vite/src/components/CMyPage/CMyPage.ts

75 lines
1.6 KiB
TypeScript
Raw Normal View History

2021-08-31 18:09:59 +02:00
import {
2021-10-03 15:09:17 +02:00
defineComponent, onMounted, ref, toRef, watch,
2021-08-31 18:09:59 +02:00
} from 'vue'
import { IMyPage } from '@src/model'
import { useGlobalStore } from '@store/globalStore'
2022-07-10 01:24:54 +02:00
import { LandingFooter } from '@/components/LandingFooter'
2021-08-31 18:09:59 +02:00
import { CImgTitle } from '../CImgTitle/index'
import { CTitle } from '../CTitle/index'
export default defineComponent({
name: 'CMyPage',
2022-07-10 01:24:54 +02:00
components: { LandingFooter, CImgTitle, CTitle },
2021-08-31 18:09:59 +02:00
props: {
title: String,
mypath: {
type: String,
required: false,
default: '',
},
img: {
type: String,
required: false,
default: '',
},
imgbackground: {
type: String,
required: false,
default: '',
},
sizes: {
type: String,
required: false,
default: '',
},
styleadd: {
type: String,
required: false,
default: '',
},
nofooter: {
type: Boolean,
required: false,
default: false,
},
},
setup(props) {
const rec = ref<IMyPage | null>(null)
const mypath = toRef(props, 'mypath')
const globalStore = useGlobalStore()
const load = async (): Promise<void> => {
2021-10-03 15:09:17 +02:00
// console.log('load', mypath.value)
2022-11-17 08:10:43 +01:00
if (mypath.value !== '') rec.value = await globalStore.loadPage('/' + mypath.value, 'cmypage')
2021-08-31 18:09:59 +02:00
}
2021-10-03 15:09:17 +02:00
watch(() => props.mypath, async (to: string, from: string) => {
2022-11-17 08:10:43 +01:00
console.log('load', mypath.value, to, from )
if (mypath.value !== '') rec.value = await globalStore.loadPage('/' + mypath.value, 'cmypage watch')
2021-10-03 15:09:17 +02:00
})
2022-11-13 22:39:25 +01:00
onMounted(load)
2021-10-03 15:09:17 +02:00
2022-11-13 22:39:25 +01:00
// load()
2021-08-31 18:09:59 +02:00
2022-11-10 19:32:56 +01:00
return {
rec, globalStore
}
2021-08-31 18:09:59 +02:00
},
})