【问题标题】:Livewire How to set the width of jetstream dialog-modal?Livewire 如何设置 jetstream 对话框模式的宽度?
【发布时间】:2021-02-13 15:17:38
【问题描述】:

我正在使用 Jet-Stream 的对话框模式,它工作得很好,但我不明白如何修复它的宽度。

下面是我的使用方式。

<x-dialog-modal wire:model="show_equipment_dialog" :maxWidth="'100%'">
    <x-slot name="title"> {{ __('Equipment Dialog') }}</x-slot>
    <x-slot name="content">
        @livewire('equipment-lw', ['usage' => 'chooser'])
    </x-slot>
    <x-slot name="footer">
        <x-secondary-button wire:click="closeEquipmentDialog">{{ __('Close the dialog') }}</x-secondary-button>
    </x-slot>
</x-dialog-modal>

在对话框模式中使用这个

@props(['id' => null, 'maxWidth' => null,'usage'=>'database'])

<x-jet-modal :id="$id" :maxWidth="$maxWidth" {{ $attributes }}>
<div class=" px-6 py-4">
    <div class="text-lg">
        {{ $title }}{{$maxWidth}}
    </div>

    <div class="mt-4">
        {{ $content }}
    </div>
</div>

<div class="px-6 py-4 bg-gray-100 text-right">
    {{ $footer }}
</div>
maxWidth 被传递给 dialog-modal(感谢内容槽中的 {{$maxWidth}},我可以看到这一点),但对 x-jet-modal 没有影响。什么是正确的语法?

谢谢你帮助我。

【问题讨论】:

    标签: modal-dialog laravel-livewire jetstream


    【解决方案1】:

    可以在vendor/jetstream/components“modal.blade.php”中设置modal的maxWidth,然后找到maxWidth的switch语句

    【讨论】:

      【解决方案2】:

      在您的模态中,只需添加 ma​​xWidth="size-you-want"。 可用大小位于 resources\views\vendor\jetstream\components\modal.blade.php 但您可以添加更多。默认情况下是 sm, md, lg, xl, 2xl

      <x-dialog-modal wire:model="show_equipment_dialog" maxWidth="md">
      <x-slot name="title"> {{ __('Equipment Dialog') }}</x-slot>
      <x-slot name="content">
          @livewire('equipment-lw', ['usage' => 'chooser'])
      </x-slot>
      <x-slot name="footer">
          <x-secondary-button wire:click="closeEquipmentDialog">{{ __('Close the dialog') }}</x-secondary-button>
      </x-slot>
      

      【讨论】:

        猜你喜欢
        • 2012-09-13
        • 1970-01-01
        • 1970-01-01
        • 2018-05-08
        • 1970-01-01
        • 2011-12-31
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多