【发布时间】:2016-01-25 11:36:06
【问题描述】:
谁知道是否可以延长儿童刀片?
我的应用程序有一个通用布局模板,然后每个页面都从该模板扩展而来。 每个页面都可以根据需要为其他 HTML 块(例如模式)引入一系列 @include。
@extends('common.layout')
@section('content')
... Some other content ...
@include('modals.modal-1')
@include('modals.modal-2')
@endsection
所有的模态都有很多通用的样板代码(Bootstrap),所以我想做的是定义一个主模型模板,让所有模态都@extend,然后在我的页面中@include必需的。所以 /modals/modal-1.blade.php 看起来像:
@extends('common.modals')
@section('modal-id', 'modal-1')
@section('modal-title','Modal title')
@section('modal-body')
... Some HTML / Blade here ...
@endsection
但每次我尝试时,生成的 HTML 都会损坏。在上述情况下,modal-1 将显示两次,因为它首先出现,而 modal-2 则根本不存在。翻转顺序,modal-2会出现两次。
我想我可以简单地将模态体放在一个变量中,并在@include 语句@include('modal.blade', ['body' => '<div>...</div>']) 中使用它,但使用@extends 感觉更正确。
有什么想法吗?
【问题讨论】: