-
Good morning, Any ideas? <script setup>
import { useRoute } from "vue-router";
import {onMounted, ref} from "vue";
import { useRepo } from "pinia-orm";
import Pet from "@/models/Pet.js"
const route = useRoute()
const pet = ref({})
onMounted(() => {
// works
#pet.value = useRepo(Pet).find(2)
// does not work
pet.value = useRepo(Pet).find(route.params.id)
})
</script>
<template>
<el-card>
<el-row :gutter="20">
<el-col :span="6">{{ pet.name }}</el-col>
<el-col :span="6">test</el-col>
</el-row>
</el-card>
</template> |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
@Jens-dev |
Beta Was this translation helpful? Give feedback.
-
If you use @sergerdn debugging solution i think you will see that your are passing a string with |
Beta Was this translation helpful? Give feedback.
If you use @sergerdn debugging solution i think you will see that your are passing a string with
route.params.id
instead of a number which your ids seems to be. So all you need to do isparseInt(route.params.id)