如何在此刀片文件顶部放置编码?

问题描述

我在刀片文件中使用@stack 和@push。但它不起作用,因为@stack 在布局刀片中工作,在截面刀片中不起作用

@stack('test-section')

this is test section

@push('test-section')
    this is test put
@endpush

我只是想让一个部分有认数据,例如

@extends('body')
@section('content')
@stack('test-section')

this is test section{{$top}}

@endsection

@push('test-section')
    this is test put
    @PHP
        $top = $top??'this top';
    @endPHP
@endpush

$top 在此刀片顶部声明 $top 时没问题。我的想法来自 shopify 的液体 {% schema %}

是的,没有必要,section数据需要在section top中声明,如果我在section top中声明,代码将变得糟糕

@extends('body')
@section('content')
    @PHP
        $top = $top??'this top';
        $top1 = $top??'this top';
        $top2 = $top??'this top';
        $top3 = $top??'this top';
        $top3 = $top??'this top';
        $top4 = $top??'this top';
        $top5 = $top??'this top';
        $top6 = $top??'this top';
        $top7 = $top??'this top';
        ...
    @endPHP

    this is test section{{$top}}

@endsection

这是我在堆栈溢出中的第一个问题,我需要帮助。谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)