laravel - 使用 router-view 和 Vue 传递 prop

标签 laravel vue.js vuejs2 vue-router

我有一个使用路由器 View 调用 Vue 页面的 Laravel Blade 页面。我在 Vue 页面上有一个“测试” Prop ,但该页面没有收到该 Prop 。

const routes = [
    {path: '/:test', component: MainPageIndex, name: 'mainPageIndex', props: true}
];

Blade页面上的代码是:

<router-view name="mainPageIndex" :test="Test message"> </router-view>
<router-view :test="Test message"> </router-view>

最佳答案

有两种类型的属性:静态和动态。

  • static: test="some message"(用于静态值)
  • dynamic: v-bind:test="variable"(用于计算值或对象等)

在你的情况下,你应该使用静态的

test="some message"

关于laravel - 使用 router-view 和 Vue 传递 prop,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50733285/

相关文章:

php - Laravel attempts() 不起作用,getAuthIdentifier 使用错误的列

vue.js - 计算嵌套属性 Vuejs

javascript - 更新: Mutation recieve the store,不是状态

javascript - 使用 v-for 填充 vue 中的多个选择菜单和选项

php - 如何跟上 PHP 框架的发展?

php - 处理程序类错误 - Laravel

postgresql - Eloquent ORM 和 postgres 迁移 - 是否可以分配表达式默认值?

javascript - 异步/等待 Vuex 调度

vue.js - Vuejs-更新数组中对象的数组

javascript - 继续在混合应用程序 Javascript 中获取 [Object Object]