विलय के गुण - कैसे क्या मैं प्राप्त उन्हें कार्य करने के लिए ठीक से?

0

सवाल

मैं निम्न में से एक घटक में संग्रहीत resources/views/components/green-button.blade.php में laravel 8.

<button {{ $attributes->merge(['type' => 'button', 'class' => 'px-4 inline-flex justify-center py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500']) }}>
    {{ $slot }}
</button>

मैं इसे का उपयोग करें :

<x-green-button class="px-0"
                title="Click to show or hide data entry for {{$person->firstname}}."
                wire:click="toggleVisibility({{$person->id}})">
  <h3 class="my-1">{{$person->FullName_fh}}</h3>
</x-green-button>

घटक है एक एक्स अक्ष गद्दी के px-4. मैं पास px-0, लेकिन वहाँ कोई प्रभाव नहीं है. मैं क्या कर रहा हूँ गलत?

आरबीडी

components laravel
2021-11-18 22:02:46
1

सबसे अच्छा जवाब

1

आप उपयोग कर सकते हैं @props() लक्ष्य हासिल करने के लिए.

// In your component

@props(['customClass' => ''])

<button {{ $attributes->merge([
    'type'  => 'button', 
    'class' => 'all-your-classes ' . $customClass
]) }}>
    {{ $slot }}
</button>
// In your blade file

<x-green-button customClass="px-0">
    {{ $person->FullName_fh }}
</x-green-button>

2021-11-18 22:15:11

हाय, धन्यवाद. अगर 'सब अपने-संस्थान' ने 'px-4' में यह है, और $customClass = 'px-0' होगा, px-4 पूर्वता ले, क्योंकि यह आता है सबसे पहले?, या पिछले विरोध वर्ग पूर्वता ले? Thx एस.
Robert Bryan Davis

@RobertBryanDavis यह निर्भर करता है पर स्टाइलशीट आदेश, देखें: stackoverflow.com/a/3066365/13916713
Samuel Ferdary

हाय, धन्यवाद प्रतिक्रिया के लिए. मैं प्राप्त funcctionality मैं था की मांग का उपयोग करके रंगमंच की सामग्री() और पासिंग में करने के लिए समायोजन शैलियों है कि जिस तरह से.
Robert Bryan Davis

अन्य भाषाओं में

यह पृष्ठ अन्य भाषाओं में है

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................

इस श्रेणी में लोकप्रिय

लोकप्रिय सवाल इस श्रेणी में