اذهب إلى المحتوى
  • 0

حل مشكلة Alpine Expression Error: Cannot read properties of undefined (reading 'after')

أحمد مصطفى كامل

السؤال

يظهر لى هذا الخطا عن كتابه كود Alpine Js
لا اعلم السبب
Alpine Expression Error: Cannot read properties of undefined (reading 'after')
 

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    @vite(['resources/css/app.css', 'resources/js/app.js'])
{{-- <script defer src="https://unpkg.com/alpinejs@3.10.5/dist/cdn.min.js"></script> --}}

</head>


<body class="text-gray-700 bg-gray-300">




    <div class="container mx-auto text-lg mt-6" x-data="{  faqs: [
        {
            question : 'Q1',
            answer : 'answer1 our technology and expanding our product offering to stay at the cutting edge of technology',
            isOpen : false,
        },
        {
            question : 'Q2',
            answer : 'answer2 our technology and expanding our product offering to stay at the cutting edge',
            isOpen : false,
         },
         {
            question : 'Q2',
            answer : 'answer2 our technology and expanding our product offering to stay at the cutting edge of',
            isOpen : false,
        },
         ]}">


        <h2 class="text-2xl font-bold">FAQs</h2>


        <template x-for="faq in faqs" :key="faq.question">
            <h1 x-text="faq.answer"></h1>

        </template>

    </div>






</body>

</html>

وهذا هو ال doc الخاص بهذه الجزئيه
https://alpinejs.dev/directives/for
لا اعرف اين الخطا

رابط هذا التعليق
شارك على الشبكات الإجتماعية

Recommended Posts

  • 0

المشكلة أنك استخدمت نفس الـ key مرتين لاحظ :

[
  {
    question : 'Q1',
    answer : 'answer1 our technology and expanding our product offering to stay at the cutting edge of technology',
    isOpen : false,
  },
  {
    question : 'Q2',
    answer : 'answer2 our technology and expanding our product offering to stay at the cutting edge',
    isOpen : false,
  },
  {
    // هنا key استخدمت نفس الـ 
    // مرتين Q2 حيث كررت الـ 
    question : 'Q2',
    answer : 'answer2 our technology and expanding our product offering to stay at the cutting edge of',
    isOpen : false,
  },
]

عدل الـ Q2 إلى Q3 وستحل المشكلة.

رابط هذا التعليق
شارك على الشبكات الإجتماعية

انضم إلى النقاش

يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.

زائر
أجب على هذا السؤال...

×   لقد أضفت محتوى بخط أو تنسيق مختلف.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   جرى استعادة المحتوى السابق..   امسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

  • إعلانات

  • تابعنا على



×
×
  • أضف...