zoukankan      html  css  js  c++  java
  • vue + ElementUI 的横向表格代码

    <!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 class="mailTable" :style="styleObject" 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 class="mailTable" :style="styleObject" 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>

  • 相关阅读:
    WCF 第十章 异常处理 创建并使用强类型错误
    WCF 第十章 总结
    WCF 第十章 异常处理
    WCF 第十章 异常处理 使用FaultException管理服务异常
    WCF 第十章 异常处理 通信异常细节
    哪本书是对程序员最有影响、每个程序员都该阅读的书?(转自外刊IT评论)
    WCF 第十一章 工作流服务 从WF调用一个WCF服务
    比尔盖茨给大学毕业生的11条人生忠告
    王爽 汇编语言 实验七
    王爽 汇编语言 实验五第5题和第6题
  • 原文地址:https://www.cnblogs.com/lhqdbk/p/12206477.html
Copyright © 2011-2022 走看看