JSFiddle - React, Tailwind, and code Playground
HTML
<script src="//unpkg.com/vue/dist/vue.js"></script>
<script src="//unpkg.com/element-ui@1.4.2/lib/index.js"></script>
<div id="app">
<template>
<div>
<div :style="isVisible?'width:100%;height:500px':'display:none;'">
<el-table :data="tableData" stripe style="width: 100%" :height='300'>
<el-table-column prop="date" label="日期" width="180">
</el-table-column>
<el-table-column prop="name" label="姓名" width="180">
</el-table-column>
<el-table-column prop="address" label="地址">
</el-table-column>
</el-table>
</div>
<el-button ></el-button>
<el-button @click="setCurrent">取消选择</el-button>
</div>
</template>
</div>
CSS
@import url("//unpkg.com/element-ui@1.4.2/lib/theme-default/index.css");
JavaScript
var Main = {
data() {
return {
tableData: [{
date: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
}, {
date: '2016-05-04',
name: '王小虎',
address: '上海市普陀区金沙江路 1517 弄'
}, {
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄'
}, {
date: '2016-05-03',
name: '王小虎',
address: '上海市普陀区金沙江路 1516 弄'
}],
isVisible: true,
}
},
methods: {
setCurrent() {
var data = [
{
date: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
},
{
date: '2016-05-04',
name: '王小虎',
address: '上海市普陀区金沙江路 1517 弄'
},
{
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄'
},
{
date: '2016-05-03',
name: '王小虎',
address: '上海市普陀区金沙江路 1516 弄'
}
]
this.isVisible = false;
this.$nextTick(() => {
this.tableData = [];
this.$nextTick(() => {
this.tableData = data;
this.$nextTick(() => {
this.isVisible = true;
});
})
})
}
}
}
var Ctor = Vue.extend(Main)
new Ctor().$mount('#app')