Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
3234 Lượt xem

why when it doesn't enter the t-if it ignores the t-else?


If the t-if condition is not met, the foreach automatically exits and does not go through the t-else


<t-foreach="partner.parent_id.category_id"t-as="tags">      

    <t-if="'Custom' in tags.name">          

           <href="/"t-attf-class="navbar-brand logo #{_link_class}">              

                <h1 t-if="partner.image_1920">company logoh1>              

                <h1 t-else="">Latamconnect there is no company logoh1>         

           a>     

     t>      

     <t-else="">         

         <href="/"t-attf-class="navbar-brand logo #{_link_class}">             

              <h1>Latamconnect the company is not customh1>         

         a>     

     t>    

 t>

Ảnh đại diện
Huỷ bỏ

your xml is not correct(I know xml is not allowed to paste). you can paste your xml in comment.

Tác giả

este es el xml correcto

<t t-foreach="partner.parent_id.category_id"t-as="tags">

<t t-if="'Custom' in tags.name">

<a href="/"t-attf-class="navbar-brand logo #{_link_class}">

<h1 t-if="partner.image_1920">company logo</h1>

<h1 t-else="">Latamconnect there is no company logo</h1>

</a>

</t>

<t t-else="">

<a href="/"t-attf-class="navbar-brand logo #{_link_class}">

<h1>Latamconnect the company is not custom</h1>

</a>

</t>

</t>

Câu trả lời hay nhất

Hi Douglas: Your understanding of how the t-else is supposed to work is correct. In this case, the t-foreach condition does not seem correct. Check whether it's going inside the t-foreach.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 1 22
2005
1
thg 3 25
2286
1
thg 9 24
1874
1
thg 5 23
2583
2
thg 4 23
8153