问答

Vue中td标签不能使用v-for中的数据?

作者:admin 2021-09-08 我要评论

tbody tr v-for="item in books" td {{item.id}}/td td {{item.name}}/td td {{item.date}}/td td {{item.price}}/td td button type="button"-/button {{item.c...

在说正事之前,我要推荐一个福利:你还在原价购买阿里云、腾讯云、华为云服务器吗?那太亏啦!来这里,新购、升级、续费都打折,能够为您省60%的钱呢!2核4G企业级云服务器低至69元/年,点击进去看看吧>>>)

<tbody>

            <tr v-for="item in books" > 
                <td >{{item.id}}</td>
                <td >{{item.name}}</td>
                <td >{{item.date}}</td>
                <td >{{item.price}}</td>
                <td>
                <button type="button">-</button>
                {{item.count}}
                <button type="button">+</button>
                </td>
                <td><button type="button">操作</button></td>
            </tr>
            
            
        </tbody>
        
        
        const app  = new Vue({
            el:"#app",
            data:{
            
                books:[
                    {
                        id:1,
                        name:'(C++)',
                        date:'1998-5',
                        price:85.00,
                        count:1
                    },
                    {
                        id:2,
                        name:'(A++)',
                        date:'1998-5',
                        price:815.00,
                        count:1
                    },
                    {
                        id:3,
                        name:'(B++)',
                        date:'1998-5',
                        price:855.00,
                        count:1
                    },
                    {
                        id:4,
                        name:'(E++)',
                        date:'1998-5',
                        price:835.00,
                        count:1
                    },
                    {
                        id:5,
                        name:'(D++)',
                        date:'1998-5',
                        price:845.00,
                        count:1
                    },
                ]
            
            }
            
        })
###

试试下面这样呢

   <template v-for="(item,index) in list">
     <tr>
        <template v-for="(sitem,sindex) in list1">
           <td></td>
        </template>
    </tr>
</template>
###
是不是没加<table></table>

版权声明:本文转载自网络,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。本站转载出于传播更多优秀技术知识之目的,如有侵权请联系QQ/微信:153890879删除

相关文章
  • Vue中td标签不能使用v-for中的数据?

    Vue中td标签不能使用v-for中的数据?

  • Kibana连接不上ElasticSearch,报错:

    Kibana连接不上ElasticSearch,报错:

  • 怎样用Java实现AES算法中的S盒

    怎样用Java实现AES算法中的S盒

  • PHP的协程有什么用?

    PHP的协程有什么用?

腾讯云代理商
海外云服务器