Files
mes-ui-d2/src/pages/demo/plugins/mock/ajax.vue
rongxingsun 1f2d17a7ec axios fix
Former-commit-id: 4e67b101d7613dc5a908a9710a298ab452e3a73e [formerly 4e67b101d7613dc5a908a9710a298ab452e3a73e [formerly 4e67b101d7613dc5a908a9710a298ab452e3a73e [formerly 4e67b101d7613dc5a908a9710a298ab452e3a73e [formerly e18674e079add9386877561fd5ff11e26d8a444d [formerly 9eea4ceea3d3b77eab71336bd5a35f3865865a7a]]]]]
Former-commit-id: 309a390168260b7182beb6cefb1d3fce25f41ad7
Former-commit-id: 2357580897c1c29d440ef3df6f59ccf8ecf6c898
Former-commit-id: 4dec8fba40d4f2d2c38e214281019b42cb937d0f [formerly d5986fb5b1d943e920a5e9f298bcfe2f39db84a6]
Former-commit-id: 2f5e3bf693e575217a377d633480e214609a257b
Former-commit-id: 67a233f1a96a698c8a303437bd350eef012f426a
Former-commit-id: 3529a8cb845e843a7971eaa2ae108e8c4abd7859
Former-commit-id: 75fdfbf8e6258c417b6f187dc4d5a4be1090aa56
Former-commit-id: b089d7b7d80123e876bf9b03d5bf9593fd79f780
2018-08-26 10:28:26 +08:00

53 lines
1.0 KiB
Vue

<template>
<d2-container>
<div slot="header">
<el-button
size="mini"
type="primary"
@click="ajax">
<d2-icon name="paper-plane"/>
发送请求
</el-button>
</div>
<el-table
v-bind="table"
style="width: 100%">
<el-table-column
v-for="(item, index) in table.columns"
:key="index"
:prop="item.prop"
:label="item.label">
</el-table-column>
</el-table>
</d2-container>
</template>
<script>
import { PluginMocksAjax } from '@/api/demo/plugins/mocks/ajax'
export default {
data () {
return {
table: {
columns: [],
data: [],
size: 'mini',
stripe: true,
border: true
}
}
},
methods: {
ajax () {
PluginMocksAjax()
.then(res => {
this.table.columns = Object.keys(res.list[0]).map(e => ({
label: e,
prop: e
}))
this.table.data = res.list
})
}
}
}
</script>