-2

我在 laravel 中遇到了麻烦。

我有一个有效的模板。但是在博客页面,当我尝试通过 id 查看特定博客时,模板无法识别从母版页继承的链接和脚本。

将 id 传递给路由时样式消失。

怎么可能?

以下是 app.blade.php 中的链接和脚本

 <link rel="stylesheet" id="brk-direction-bootstrap" href="{{ asset('css/assets/bootstrap.css')}}">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous">
    <link rel="stylesheet" id="brk-skin-color" href="{{asset('css/skins/brk_blue.css')}}">
    <link id="brk-base-color" rel="stylesheet" href="{{asset('css/skins/brk-base-color.css')}}">
    <link rel="stylesheet" href="{{asset('css/assets/offsets.css')}}">
    <link id="brk-css-min" rel="stylesheet" href="{{asset('css/assets/styles.min.css')}}">
    <link rel="stylesheet" href="{{asset('vendor/revslider/css/settings.css')}}">
    <link rel="stylesheet" href="{{asset('vendor/revslider/css/revolution.addon.bubblemorph.css')}}">
  @yield('content')

………………………………………………………………………………

这是 post.blade.php

@extends('layouts.app')

@section('title')
    Post
@endsection

@section('content')
@endsection
4

1 回答 1

1

如果路由接受参数,您可以将它们作为第二个参数传递给方法,如下所示:

{{route('post', ['id' => $post->id]}}

https://laravel.com/docs/5.7/helpers#method-route

于 2018-10-05T10:10:59.257 回答