Files
mes-ui-d2/src/pages/demo/plugins/mock/ajax.vue
liyang 9007fe59db 简化mock注册方式
优化mock ajax测试页面显示效果


Former-commit-id: 36a8a63d3126439f05be7f952b02f1794abbf10c [formerly 36a8a63d3126439f05be7f952b02f1794abbf10c [formerly 36a8a63d3126439f05be7f952b02f1794abbf10c [formerly 36a8a63d3126439f05be7f952b02f1794abbf10c [formerly 9c48d010555e8f55f5a6f57d9d2e65c811dde3c9 [formerly ca2e8994bc1545e1618923b35626d9319fb12fd8]]]]]
Former-commit-id: 6f573879bc4e610763fcb2f7bc37e70cbd6bb99a
Former-commit-id: fb7840d2d437eb5e5caa206b46c18309abfd0b47
Former-commit-id: 6f3841382d90cd623dd01db59e8223d4e36aa601 [formerly 43f2ade1abe6e8d0457cab18402c572f259dd80a]
Former-commit-id: 9d00de3566f053a7fa59a7027555e49fc695a460
Former-commit-id: 4af553c3d1c2803463c03514d8ba6c17bc313ea1
Former-commit-id: 2c638b3c4486b791436fc64cb163de153d8c1146
Former-commit-id: b970f98ee6c4276d2b454796295c5b2fd10ac526
Former-commit-id: fa2af9321d47dd1d0a69357d879f8b5541bead14
2018-08-07 19:08:42 +08:00

52 lines
990 B
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>
export default {
data () {
return {
table: {
columns: [],
data: [],
size: 'mini',
stripe: true,
border: true
}
}
},
methods: {
ajax () {
this.$axios.get('/api/demo/plugins/mock/ajax')
.then(res => {
this.table.columns = Object.keys(res.list[0]).map(e => ({
label: e,
prop: e
}))
this.table.data = res.list
})
}
}
}
</script>