【发布时间】:2018-02-13 05:00:03
【问题描述】:
我想自定义 Laravel 5.4 通知电子邮件模板
在 vendor/mail/html/message.blade 上,我尝试这样:
@component('mail::layout')
{{-- Header --}}
@slot('header')
@component('mail::header', ['url' => config('app.url')])
{{ config('app.name') }}
@endcomponent
@endslot
{{-- Body --}}
This is table one
@component('mail::table')
| Laravel | Table | Example |
| ------------- |:-------------:| --------:|
| Col 2 is | Centered | $10 |
| Col 3 is | Right-Aligned | $20 |
@endcomponent
This is table two
@component('mail::table')
| Laravel | Table | Example |
| ------------- |:-------------:| --------:|
| Col 2 is | Centered | $10 |
| Col 3 is | Right-Aligned | $20 |
@endcomponent
{{-- Subcopy --}}
@isset($subcopy)
@slot('subcopy')
@component('mail::subcopy')
{{ $subcopy }}
@endcomponent
@endslot
@endisset
{{-- Footer --}}
@slot('footer')
@component('mail::footer')
© {{ date('Y') }} {{ config('app.name') }}. All rights reserved.
@endcomponent
@endslot
@endcomponent
有 2 张桌子。第一个表看起来不错。但是第二张桌子,看起来并不整洁。似乎css不起作用。而除了表1之后的数据,文字都很小
邮件布局结果如下:
【问题讨论】:
-
你能转储生成的 html 吗? 但第二张桌子,看起来不整齐有点模糊。是视觉上的吗?还是通过生成的代码?
-
@Bagus Tesa,我更新了我的问题
-
嗯,很奇怪,注意到
<div class="table">在那里吗?它不应该在那里吗?你能转储html吗?另外,尝试运行php artisan view:clear(对不起,自从我上次接触 Laravel 以来已经很久了,我正在寻找的功能是清除视图缓存的功能)。 -
致有类似问题的任何人;我想添加表格的地方也有奇怪的 div 标签。它实际上很容易修复并且很有意义:Markdown 将所有缩进的内容解释为代码块。我需要做的就是不缩进任何东西。
-
@SuccessMan 你解决了吗?
标签: laravel email notifications laravel-5.4