vue中的横向排列_vue + ElementUI 的横向表格代码

本文展示了如何在Vue中使用ElementUI组件库创建一个横向排列的表格。通过定义数据结构和应用样式,实现了将数据以横向形式展示在表格中,每个单元格包含关键信息如订单详情。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

{{tableData[index*2-2].key}}{{tableData[index*2-2].value}}{{tableData[index*2-1] !== undefined ? tableData[index*2-1].key : ‘‘}}{{tableData[index*2-1] !== undefined ? tableData[index*2-1].value : ‘‘}}商品序号{{tableData[index*2-2].index}}
{{tableData[index-1].key}}22{{tableData[index-1].value}}{{tableData[rowCount+index-1] !== undefined ? tableData[rowCount+index-1].key : ‘‘}}{{tableData[rowCount+index-1] !== undefined ? tableData[rowCount+index-1].value : ‘‘}}

var Main = {

data() {

return {

styleObject: {},

s_showByRow: true,

tableData: [

{key: ‘单号‘, value: ‘1001‘,index: ‘1‘,},

{key: ‘商品名称‘, value: ‘篮球‘,index: ‘1‘},

{key: ‘价格‘, value: ‘120.00‘, index: ‘1‘},

{key: ‘订单日期‘, value: ‘2017-03-01‘, index: ‘1‘},

{key: ‘付款方式‘, value: ‘在线支付‘, index: ‘1‘},

{key: ‘收货地址‘, value: ‘北京市海淀区西北旺镇‘, index: ‘1‘},

],

};

},

//props: [‘tableData‘, ‘tableStyle‘, ‘showByRow‘],

computed: {

rowCount: function() {

return Math.ceil(this.tableData.length/2);

}

},

created() {

this.styleObject = this.tableStyle;

if(this.showByRow !== undefined){

this.s_showByRow = this.showByRow;

}

},

}

var Ctor = Vue.extend(Main)

new Ctor().$mount(‘#app‘)

.mailTable, .mailTable tr, .mailTable tr td{ border:1px solid #E6EAEE; }

.mailTable{ font-size: 12px; color: #71787E; }

.mailTable tr td{ border:1px solid #E6EAEE; width: 150px; height: 35px; line-height: 35px; box-sizing: border-box; padding: 0 10px; }

.mailTable tr td.column { background-color: #EFF3F6; color: #393C3E; }

原文:https://www.cnblogs.com/lhqdbk/p/12206477.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值