直接使用:

<a href="#picture" v-if="shopListData.attrs.length >0 " class="mui-navigate-right">选择 <span >{{ product_attr }}</span></a>

<a v-else >选择 <span >{{ shopListData.guide }}</span></a>

报错:Error in render: "TypeError: Cannot read property 'length' of undefined"

解决办法:

shopListData.attrs !== undefined && shopListData.attrs.length >0

代码如下:

<a href="#picture" v-if="shopListData.attrs !== undefined && shopListData.attrs.length >0 " class="mui-navigate-right">选择 <span >{{ product_attr }}</span></a>

<a v-else >选择 <span >{{ shopListData.guide }}</span></a>

Logo

前往低代码交流专区

更多推荐