【问题标题】:how to route from laravel.blade.php to other page depending on react router?如何根据反应路由器从 laravel.blade.php 路由到其他页面?
【发布时间】:2021-08-22 16:17:57
【问题描述】:

我正在使用 laravel 的反应。
根据反应路由器制作我的视图路线 我在 web.php 中使用了这条路线

Route::get('/{path?}',function(){return view('welcome');});

除了其他 laravel 路线

Route::post("history",[historyController::class,'store']);
...

反应路线:

<Route exact path="/history" render={  
                    ()=>auth?  
                    <React.Fragment>  
                    <NavbarComp />  
                    <Container>  
                        <History/>  
                    </Container>  
                    </React.Fragment>  
                    :
                    <Redirect to={{pathname:'/login'}}/>
                }/>

我也有 laravel mail.blade.php

@component('mail::button', ['url' =>""]) shopping
 history   
@endcomponent

所以问题是如何在上面的 react 路由中从这个 mail.blade.php 路由到 /history 页面?

【问题讨论】:

    标签: reactjs laravel react-router-dom


    【解决方案1】:

    你只需要使用辅助函数url 像这样:

    @component('mail::button', ['url' =>url('history')]) shopping
     history   
    @endcomponent
    

    【讨论】:

      猜你喜欢
      • 2023-03-16
      • 1970-01-01
      • 2020-10-27
      • 1970-01-01
      • 2020-12-13
      • 2017-12-08
      • 2021-03-29
      • 2021-09-25
      • 2018-07-28
      相关资源
      最近更新 更多