JSFiddle - React, Tailwind, and code Playground
by leopoldthecuber
HTML
<script src="//unpkg.com/vue/dist/vue.js"></script>
<script src="//unpkg.com/[email protected]/lib/index.js"></script>
<div id="app">
<template>
<el-table :data="tableData" style="width: 100%">
<el-table-column prop="date" label="日期">
</el-table-column>
<el-table-column label="姓名(地址)">
<template slot-scope="{ row }">
<name-tag :row="row"></name-tag>
</template>
</el-table-column>
</el-table>
</template>
</div>
Babel + JSX
var Main = {
components: {
'name-tag': {
template: `
<div>
<el-tag>{{ row.name }}</el-tag>
<span>{{ row.address }}</span>
</div>
`,
props: {
row: Object
}
}
},
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 弄'
}]
}
}
}
var Ctor = Vue.extend(Main)
new Ctor().$mount('#app')