Vue中引入Bootstrap的样式文件,Table没有样式+(表格循环的结构)

我在一个demo中,引入了Bootstrap.min.css 样式文件,
在写表格组件的时候,其他的都有效,唯独table 无效;
解决办法:
添加上<thead><tbody>标签

表头结构和数据结构如下:

head: [
	{
	    key: 'id',
	    title: 'ID'
	},
	{
	    key: 'name',
	    title: "姓名"
	},
	{
	    key: 'age',
	    title: "年龄"
	}
],
data: [
	{
	    id: '01',
	    name: '任重道远',
	    age: '22'
	},
	{
	    id: '02',
	    name: '木叶下',
	    age: '21'
	},
	{
	    id: '03',
	    name: '郭德纲',
	    age: '47'
	},
],

循环的时候:(嵌套循环)

<table class='table'>
    <thead>
        <tr>
            <td v-for="item in head">{{item.title}}</td>
        </tr>
    </thead>
    <tbody>
        <tr v-for="item in data">
            <td v-for="h in head">{{item[h.key]}}</td>
        </tr>
    </tbody>
</table>
  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值