Fixed more TypeScript issues
This commit is contained in:
parent
5a4f6939d1
commit
3f756437ee
|
@ -41,7 +41,7 @@ export default defineComponent({
|
|||
},
|
||||
|
||||
setup(props, { root }) {
|
||||
let title = props.title;
|
||||
let title = computed<string>(() => {
|
||||
if (props.title.includes('loadFromStore')) {
|
||||
const startIndex = props.title.indexOf('(') + 1;
|
||||
const endIndex = props.title.indexOf(')');
|
||||
|
@ -49,12 +49,11 @@ export default defineComponent({
|
|||
.substring(startIndex, endIndex)
|
||||
.replace(/"/g, '');
|
||||
console.log(substring);
|
||||
console.log(root.$store.getters[substring]);
|
||||
console.log('loadFromStore');
|
||||
title = computed(() => {
|
||||
return root.$store.getters[substring];
|
||||
});
|
||||
return <string>root.$store.getters[substring];
|
||||
}
|
||||
return props.title;
|
||||
});
|
||||
return { realTitle: title };
|
||||
}
|
||||
});
|
||||
|
|
|
@ -22,10 +22,7 @@
|
|||
/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<q-btn
|
||||
label="show sessions"
|
||||
@click="showRootGetters"
|
||||
/>
|
||||
<q-btn label="show sessions" @click="showRootGetters" />
|
||||
</div>
|
||||
</q-page>
|
||||
</div>
|
||||
|
@ -41,18 +38,22 @@ export default defineComponent({
|
|||
components: { CircularProgress, Sessions, Main },
|
||||
setup(_, { root }) {
|
||||
onBeforeMount(() => {
|
||||
root.$store.dispatch('sessions/getSessions');
|
||||
root.$store.dispatch('sessions/getSessions').catch(error => {
|
||||
console.warn(error);
|
||||
});
|
||||
const sessions = computed(() => root.$store.getters['sessions/sessions']);
|
||||
});
|
||||
const sessions = computed(
|
||||
() => <FG.Session[]>root.$store.getters['sessions/sessions']
|
||||
);
|
||||
|
||||
function showRootGetters() {
|
||||
//ctx.root.$store.dispatch('sessions/getSessions');
|
||||
console.log(sessions.value);
|
||||
}
|
||||
|
||||
const sessionsLoading = computed(() => {
|
||||
return root.$store.getters['sessions/loading'];
|
||||
});
|
||||
const sessionsLoading = computed(
|
||||
() => <boolean>root.$store.getters['sessions/loading']
|
||||
);
|
||||
|
||||
return {
|
||||
showRootGetters,
|
||||
|
|
Loading…
Reference in New Issue