Files
mes-ui-d2/src/pages/demo/plugins/mock/ajax.vue
liyang b6cc361e28 plugin
Former-commit-id: 93988f70554c765330c5193d56441c2604ab4b2d [formerly 93988f70554c765330c5193d56441c2604ab4b2d [formerly 93988f70554c765330c5193d56441c2604ab4b2d [formerly 93988f70554c765330c5193d56441c2604ab4b2d [formerly b710287bd2f9c06410802ad44d54704c085c116d [formerly 7ed4b11f2d9eb703ec9477fe9355a86f9b03b405]]]]]
Former-commit-id: 5303051d0a12181206778f792cefa73f052a7418
Former-commit-id: 33fb08ff3338f98e26949453b75870bd63f5c81f
Former-commit-id: 917ae45092168a1c50df694a4be47676b215f04e [formerly a030aebdbf62b93aaf043ebdc90274711a4bdd6e]
Former-commit-id: af31af61bd8fb7fb73e254bb9abcbc717b895d2e
Former-commit-id: 7e8d8043460886faf57ca65f0db6d8063b60f662
Former-commit-id: ac779841a167a1dc93b5ac6b859e916546059c67
Former-commit-id: dbb3da4b9abae7925c45d12ed4702ede33c21c7b
Former-commit-id: fc004c257a067974e4927c70576fbfd9fec53a15
2018-11-17 11:57:10 +08:00

58 lines
1.1 KiB
Vue

<template>
<d2-container :filename="filename">
<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 {
name: 'demo-plugins-mock-ajax',
data () {
return {
filename: __filename,
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
})
.catch(() => {
// 错误情况
})
}
}
}
</script>