Files
mes-ui-d2/src/pages/demo/plugins/mock/ajax.vue
李杨 8d783c5bc8 no message
Former-commit-id: 347253b910c9c8fd2c5a7d563e5c59dff6759ea3
Former-commit-id: 11a8486ada0efc2244927c648ee96511b06b27dd
Former-commit-id: 2549cc4501bc5f40eccdba413c8ca458dae7a3b9
2018-01-16 09:13:15 +08:00

47 lines
1006 B
Vue

<template>
<Container type="ghost">
<el-card>
<div slot="header">
<el-button @click="ajax">发送请求</el-button>
</div>
<el-table v-bind="table" style="width: 100%" class="mb">
<el-table-column
v-for="(item, index) in table.columns"
:key="index"
:prop="item.prop"
:label="item.label">
</el-table-column>
</el-table>
<Markdown url="/static/markdownFiles/article/mock拦截ajax.md"></Markdown>
</el-card>
</Container>
</template>
<script>
export default {
data () {
return {
table: {
columns: [],
data: [],
size: 'mini',
stripe: true,
border: true
}
}
},
methods: {
ajax () {
this.$axios.get('/api/demo/001')
.then(res => {
this.table.columns = Object.keys(res.data.list[0]).map(e => ({
label: e,
prop: e
}))
this.table.data = res.data.list
})
}
}
}
</script>