no message
Former-commit-id: b16036f43f7da9accf820e4031c19920cd39d633 Former-commit-id: 102be84cd34388e4047b05bf90ab3bd7f71eb2e9 Former-commit-id: b3c28fcd34cf2ee63f07198a05d23acc67e4a93a
This commit is contained in:
parent
0ada98e57b
commit
ed08c6bf8a
|
|
@ -23,6 +23,9 @@ import '@/components'
|
|||
// 异步请求库
|
||||
import '@/plugin/axios'
|
||||
|
||||
// mock接口设置
|
||||
import '@/mock/index.js'
|
||||
|
||||
// vuex
|
||||
import store from '@/store/index.js'
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
import Mock from 'mockjs'
|
||||
|
||||
Mock.mock('/abc', {
|
||||
'list|1-10': [{
|
||||
'id|+1': 1,
|
||||
'email': '@EMAIL'
|
||||
}]
|
||||
})
|
||||
|
|
@ -1,7 +1,45 @@
|
|||
<template>
|
||||
<Container type="ghost">
|
||||
<el-card>
|
||||
Hello
|
||||
<div slot="header">
|
||||
<el-button @click="ajax">发送请求</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>
|
||||
</el-card>
|
||||
</Container>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
table: {
|
||||
columns: [],
|
||||
data: [],
|
||||
size: 'mini',
|
||||
stripe: true,
|
||||
border: true
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
ajax () {
|
||||
this.$axios.get('/abc')
|
||||
.then(res => {
|
||||
this.table.columns = Object.keys(res.data.list[0]).map(e => ({
|
||||
label: e,
|
||||
prop: e
|
||||
}))
|
||||
this.table.data = res.data.list
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue