首页 > 解决方案 > 在类条件中设置默认手风琴项时出错

问题描述

在我的 laravel 5.7 / Vuejs ( vue": "^2.6.10" ) / "bootstrap": "^4.3.1" 应用程序中使用手风琴,我想在调试目的中显示 1 块 openec,模板如下:

            <div :id="'collapse'+nextStateWithRegion.id" v-bind:class="'collapse'+{ ' show' : nextStateWithRegion.id == debugging_state_id }" :aria-labelledby="'heading'+nextStateWithRegion.id"
                 data-parent="#accordion_hostels_by_location">
                <div class="card-body">
                    <!--{{ nextStateWithRegion.regionsOfStateArray }}-->
                    <ul>

                        <li v-for="nextRegionOfState, index in nextStateWithRegion.regionsOfStateArray" :key="nextRegionOfState.id">
                            <!--nextRegionOfState::{{ nextRegionOfState }}-->
                            <router-link :to="{ name: 'hostelsByRegion', params: { region_id: nextRegionOfState.id, state_id : nextRegionOfState.state_id } }"
                                         class="nav-link">{{ nextRegionOfState.name }}
                                <small>( {{ nextRegionOfState.related_common_hostels_count }} hostels with {{ nextRegionOfState.related_featured_hostels_count }}
                                    featured)</small>
                            </router-link>
                        </li>
                    </ul>
                </div>
            </div>

但结果不同,因为我看到的不是“显示”字符串添加到类中,而是“[object Object]”: https ://imgur.com/a/YWenuxh

哪种方式是正确的?

谢谢!

标签: vuejs2bootstrap-4

解决方案


推荐阅读