Files
mes-ui-d2/src/pages/demo/plugins/mock/ajax.vue
李杨 68c34ef21a no message
Former-commit-id: 85ec7bbd986a27b5bf63f4c661bd992e0ee96cf7
Former-commit-id: c82d46c4a506965beb80b7c8dbea4e1650c91723
Former-commit-id: b7578889722e86782b775d382f87c5eb00ebd0b6
2018-01-16 22:20:04 +08:00

47 lines
1009 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="dd-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>