Laravel 如何解决使用axios时的小问题?
我将使用axios从数据库中获取数据 道具宣布如下:Laravel 如何解决使用axios时的小问题?,laravel,vuetify.js,Laravel,Vuetify.js,我将使用axios从数据库中获取数据 道具宣布如下: <script> export default { props:['data'], } </script> 导出默认值{ 道具:[“数据”], } 在数据连接路由器链接过程中出现了一些问题 <h3 class="headline mb-0"> <router-link :to="data.path"> {{ data.title
<script>
export default {
props:['data'],
}
</script>
导出默认值{
道具:[“数据”],
}
在数据连接路由器链接过程中出现了一些问题
<h3 class="headline mb-0">
<router-link :to="data.path">
{{ data.title }}
</router-link>
<!-- <router-link to="data.path">
{{ data.title }}
</router-link> -->
</h3>
<div class="class=grey--text text--darken-2"> {{ data.created_at }} </div>
{{data.title}}
{{data.created_at}}
题目是:
无效的道具:道具“to”的类型检查失败。预期的字符串、对象未定义
详情:
found in
---> <RouterLink>
<VCard>
<Question> at resources/js/components/Forum/Question.vue
<Forum> at resources/js/components/Forum/Forum.vue
<AppHome> at resources/js/components/AppHome.vue
<Root>
在中找到
--->
参考资料/js/components/Forum/Question.vue
参考资料/js/components/Forum/Forum.vue
在参考资料/js/components/AppHome.vue中
这是因为您的道具数据
不包含路径
元素,这就是为什么错误告诉您它需要字符串
或对象
,但它们收到的未定义
确保正确地将道具传递给该组件,并且道具数据
必须包含路径
元素,如下所示
<script>
export default {
props:{
data: {
type:Object,
default: {
path:'',
created_at: '',
}
}
},
}
</script>
导出默认值{
道具:{
数据:{
类型:对象,
默认值:{
路径:“”,
在以下位置创建了\u:“”,
}
}
},
}
<script>
export default {
props:{
data: {
type:Object,
default: {
path:'',
created_at: '',
}
}
},
}
</script>