vue + ElementUI 的横向表格代码

摘要:
{{tableData[index*2-2].key}}{{tableData[索引*2-2].value}}{tableData[索引*2-1]!==undefined?tableData[index*2-1].key:'}{tableData[idex*2-1]*2-1]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:'}[rowCount+index-1]!==未定义?tableData[rowCount+index-1]。值:“”}}˂!

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- import CSS -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>
<div id="app">
<template>
<div>
<table : v-if="s_showByRow">
<tr v-for="index in rowCount">
<td class="column">{{tableData[index*2-2].key}}</td>
<td>{{tableData[index*2-2].value}}</td>
<td class="column">{{tableData[index*2-1] !== undefined ? tableData[index*2-1].key : ''}}</td>
<td>{{tableData[index*2-1] !== undefined ? tableData[index*2-1].value : ''}}</td>
<td class="column">商品序号</td>
<td>{{tableData[index*2-2].index}}</td>
</tr>
</table>
<table : v-else>
<tr v-for="index in rowCount">
<td class="column">{{tableData[index-1].key}}22</td>
<td>{{tableData[index-1].value}}</td>
<td class="column">{{tableData[rowCount+index-1] !== undefined ? tableData[rowCount+index-1].key : ''}}</td>
<td>{{tableData[rowCount+index-1] !== undefined ? tableData[rowCount+index-1].value : ''}}</td>
</tr>
</table>
</div>
</template>
</div>
</body>
<!-- import Vue before Element -->
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<!-- import JavaScript -->

<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
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')
</script>
<style>
 .mailTable, .mailTable tr, .mailTable tr td{ border:1px solid #E6EAEE; }
  .mailTable{ font-size: 12px; color: #71787E; }
  .mailTable tr td{ border:1px solid #E6EAEE; 150px; height: 35px; line-height: 35px; box-sizing: border-box; padding: 0 10px; }
  .mailTable tr td.column { background-color: #EFF3F6; color: #393C3E; }
</style>
</html>

免责声明:文章转载自《vue + ElementUI 的横向表格代码》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇动态规划法-01背包问题学习Python:StringIO与cStringIO下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

CSS布局之display: tables布局

首先来看看display: table的兼容性: 可以看到,除非你还要跟IE6/7较劲,否则display: table不需考虑兼容性。 接下来看看关于table的display可选值: table:指定对象作为块元素级的表格,相当于html标签<table> inline-table:指定对象作为内联元素级的表格,相当于html标签&l...

JQuery实现表格的相同单元格合并的三种方法

表格中相同单元格合并是经常需要用到的,针对自己做的方法做个小总结,先看一下合并前效果图, 合并后的效果图: 代码: <!DOCTYPE html><html>  <head>    <title>merge.html</title>     <meta http-equiv="keyword...

Vue在ASP.NET MVC中的进行前后端的交互

Vue在ASP.NET MVC中的进行前后端的交互 Preface: 由于最近在研究前端相关的技术,作为前端非常优秀的框架Vue,个人在学习的过程中遇到一些问题,网上相关资料有限,所以在这这里总结一下个人使用Vue的一点经验,以便后来者借鉴! 官方文档:Vue.js 使用Vue在ASP.NET MVC中进行前后端交互在阅读下面的文章之前你需要先了解一下V...

一道DOM操作题

创建一个表格,表头为姓名,性别,年龄,班级 1. 点击单元格内的内容,弹窗输入值,修改单元格内原有数据; 2. 设置加粗,标红按钮,在修改完单元格内容后显示按钮并能够对修改的内容进行样式改变; 3. 设置添加按钮,点击添加一行新的单元格(4个); 代码如下: 1 <!doctype html> 2 <html> 3 <h...

ASP.NET MVC 3.0(十六): MVC 3.0 实例系列之表格数据的分页

ASP.NET MVC 3.0(一): MVC 3.0 的新特性 摘要 ASP.NET MVC 3.0(二): MVC的概念及MVC 3.0开发环境 ASP.NET MVC 3.0(三): 初识MVC的Url映射潜规则Routing ASP.NET MVC 3.0(四): 我要MVC潜规则之配置Routing ASP.NET MVC 3.0(五): 入手C...

bootstrap 3 之 表格(table的各种样式)

1、table-striped:斑马线表格 2、table-bordered:带边框的表格 3、table-hover:鼠标悬停高亮的表格 4、table-condensed:紧凑型表格(单元格的内距由8px调至5px。) 5、table-responsive:响应式表格(当你的浏览器可视区域小于768px时,表格底部会出现水平滚动条。当你的浏览器...