b***@163.com
b***@163.com
  • 发布:2024-08-20 08:57
  • 更新:2024-08-20 08:57
  • 阅读:128

BuilderX v-for代码解析有误,

分类:HBuilder

由于
<template v-for="(item2,index2) in item['data'] as UTSJSONObject[]"> 中存在 as UTSJSONObject[] 导致后面代码解析都异常。
连script代码注释都成HTML语法注释

代码如下:
<view v-if="item['showtype']=='img'" class="c-fdrow c-fwrap ">

        <template v-for="(item2,index2) in item['data'] as UTSJSONObject[]">    
                <image v-if="item['column'] =='4'" :src="item2['img']"  
                    @click="redirect(item2['url'] as string)"  
                    style="width: 174rpx;height: 174rpx;padding: 5rpx; border-radius: 10rpx;">  
                </image>  
                <image v-else :src="item2['img']" @click="redirect(item2['url'])"  
                    style="width: 235rpx;height: 235rpx;padding: 10rpx; border-radius: 10rpx;"></image>  
            </template>   
        <view v-if="(item['data'] as UTSJSONObject[]).length==0" class="c-fvhc c-tc c-flex1"  
            style="height: 100rpx;">  
            <image src="/static/emptydata.png" style="width: 200rpx;" mode="aspectFit"></image>  
        </view>  
    </view>  

    <view v-else-if="item['showtype']=='title'">  
        <view class="c-fdrow c-fwrap">  
            <text @click="redirect(item2['url'])" class="c-fs14"  
                v-for="(item2,index2) in item['data'] as UTSJSONObject[]" :key="index2"  
                style="width:360rpx;padding-right: 10rpx;height: 50rpx;line-height: 50rpx;">  
                {{item2["title"]}}</text>  
        </view>  
        <view v-if="(item['data'] as UTSJSONObject[]).length==0" class="c-fvhc" style="height: 100rpx;">  
            <text class="c-colorDesc c-fs12 c-tc">数据为空,我要抢沙发。。。</text>  
        </view>  
    </view>  

2024-08-20 08:57 负责人:无 分享
已邀请:

要回复问题请先登录注册