Files
mes-ui-d2/src/pages/demo/plugins/mock/ajax.vue
李杨 65ec820e68 no message
Former-commit-id: 28ec2beb0befdc6a796458fbcc1a0c3786fb8d62
Former-commit-id: 82768e538a271a2354616cd01f84fd73631a62b2
Former-commit-id: 450e74928f5d6bdba20e01ce57bebdfde0d512a1
2018-03-21 20:29:50 +08:00

47 lines
989 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/md/插件 - 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.list[0]).map(e => ({
label: e,
prop: e
}))
this.table.data = res.list
})
}
}
}
</script>