Former-commit-id: 28ec2beb0befdc6a796458fbcc1a0c3786fb8d62 Former-commit-id: 82768e538a271a2354616cd01f84fd73631a62b2 Former-commit-id: 450e74928f5d6bdba20e01ce57bebdfde0d512a1
536 B
536 B
在 src/mock/demo/001.js 配置拦截返回的数据
import Mock from 'mockjs'
Mock.mock('/api/demo/001', {
'list|4-10': [{
'id|+1': 1,
'name': '@CNAME',
'star|1-5': '★',
'delFlag|1': [0, 1],
'creatDate': '@DATE',
'address': '@CITY',
'zip': '@ZIP'
}]
})
请求数据
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
})
}